[Windows] World process window title now updates with server name and amount of clients connected

This commit is contained in:
Akkadius 2017-09-17 05:34:44 -05:00
parent 240f04eda7
commit b71f3031bc
2 changed files with 12 additions and 17 deletions

View File

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <stdlib.h>
#include <signal.h>
#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
}
}

View File

@ -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