User:Freeyorp/Patches/Extended present Command
From The Mana World
Pushed as 672f0be78bbd818a67728a0446cb0caf153c5d97
From b68977d53ec7735e05f35ecdd4bf892fcaaad0b0 Mon Sep 17 00:00:00 2001
From: Freeyorp <freeyorp101@hotmail.com>
Date: Sun, 26 Apr 2009 12:03:55 +1200
Subject: [PATCH] Extend the /present command.
/present will now output the number of players present in addition to the names of players that are present.
---
src/gui/chat.cpp | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 9930fe0..4aee024 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -309,7 +309,8 @@ void ChatWindow::doPresent()
{
const Beings &beings = beingManager->getAll();
std::string response = "";
-
+ unsigned short playercount = 0;
+ char cpc[25];
for (Beings::const_iterator bi = beings.begin(), be = beings.end();
bi != be; ++bi)
{
@@ -320,9 +321,10 @@ void ChatWindow::doPresent()
response += ", ";
}
response += (*bi)->getName();
+ ++playercount;
}
}
-
+ sprintf(cpc,"%u players are present.",playercount);
if (mRecorder->isRecording())
{
// Get the current system time
@@ -338,13 +340,13 @@ void ChatWindow::doPresent()
<< "] ";
- mRecorder->record(timeStr.str() + _("Present: ") + response + ".");
+ mRecorder->record(timeStr.str() + _("Present: ") + response + _("; ") + cpc);
getFocused()->chatLog(_("Attendance written to record log."),
BY_SERVER, true);
}
else
{
- getFocused()->chatLog(_("Present: ") + response, BY_SERVER);
+ getFocused()->chatLog(_("Present: ") + response + _("; ") + cpc, BY_SERVER);
}
}
--
1.6.0.4