diff --git a/world/net.cpp b/world/net.cpp index 599f01c8f..b6e7babcc 100644 --- a/world/net.cpp +++ b/world/net.cpp @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include #include +#include "../common/string_util.h" #include "../common/eqemu_logsys.h" #include "../common/queue.h" #include "../common/timer.h" @@ -104,6 +105,12 @@ WebInterfaceList web_interface; void CatchSignal(int sig_num); +inline void UpdateWindowTitle(std::string new_title) { +#ifdef _WINDOWS + SetConsoleTitle(new_title.c_str()); +#endif +} + int main(int argc, char** argv) { RegisterExecutablePlatform(ExePlatformWorld); LogSys.LoadLogSettingsDefaults(); @@ -527,8 +534,7 @@ int main(int argc, char** argv) { database.PurgeExpiredInstances(); } - if (EQTimeTimer.Check()) - { + if (EQTimeTimer.Check()) { TimeOfDay_Struct tod; zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod); if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year)) @@ -545,6 +551,9 @@ int main(int argc, char** argv) { if (InterserverTimer.Check()) { InterserverTimer.Start(); database.ping(); + + std::string window_title = StringFormat("World: %s Clients: %i", Config->LongName.c_str(), client_list.GetClientCount()); + UpdateWindowTitle(window_title); } EQ::EventLoop::Get().Process(); @@ -563,17 +572,4 @@ int main(int argc, char** argv) { void CatchSignal(int sig_num) { Log(Logs::General, Logs::World_Server, "Caught signal %d", sig_num); RunLoops = false; -} - -void UpdateWindowTitle(char* iNewTitle) { -#ifdef _WINDOWS - char tmp[500]; - if (iNewTitle) { - snprintf(tmp, sizeof(tmp), "World: %s", iNewTitle); - } - else { - snprintf(tmp, sizeof(tmp), "World"); - } - SetConsoleTitle(tmp); -#endif -} +} \ No newline at end of file diff --git a/world/net.h b/world/net.h index 5af1ef96a..06e918a5c 100644 --- a/world/net.h +++ b/world/net.h @@ -31,7 +31,6 @@ #endif void CatchSignal(int sig_num); -void UpdateWindowTitle(char* iNewTitle); #define EQ_WORLD_PORT 9000 //mandated by the client #define LOGIN_PORT 5997