From 992f497ae2e135cd47d9b14648b27dbee73c2055 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Sun, 4 Feb 2007 01:42:25 +0000 Subject: [PATCH] * fixed endless loop on startup with missing data (unread conf file, etc) * fixed logcritical() * visual enhancement in loadall.def --- bin/scripts/loadall.def | 2 +- src/Client/PseuWoW.cpp | 20 ++++++++++++++------ src/Client/Realm/RealmSocket.cpp | 9 ++++++++- src/Client/log.cpp | 2 -- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/bin/scripts/loadall.def b/bin/scripts/loadall.def index 7a17dc4..1aa5194 100644 --- a/bin/scripts/loadall.def +++ b/bin/scripts/loadall.def @@ -1,7 +1,7 @@ // preloads the most important scripts -LOG Loading DefScripts... +LOG * Loading DefScripts... RELOADDEF _enterworld RELOADDEF _leaveworld diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp index d136fdf..11e5567 100644 --- a/src/Client/PseuWoW.cpp +++ b/src/Client/PseuWoW.cpp @@ -101,7 +101,8 @@ bool PseuInstance::Init(void) { log("Loading DefScripts from folder '%s'",_scpdir.c_str()); if(!_scp->RunScript("_startup",NULL)) { - printf("Error executing '_startup.def'"); + logerror("Error executing '_startup.def'"); + SetError(); } if(GetConf()->enablecli) @@ -111,11 +112,10 @@ bool PseuInstance::Init(void) { ZThread::Thread t(_cli); } - if(_stop){ - log("Errors while initializing, proc halted!!"); - if(GetConf()->exitonerror) - exit(0); - while(true)this->Sleep(1000); + if(_error) + { + logcritical("Errors while initializing!"); + return false; } log("Init complete.\n"); @@ -130,6 +130,14 @@ void PseuInstance::Run(void) if(!_initialized) return; + if(GetConf()->realmlist.empty() || GetConf()->realmport==0) + { + logcritical("Realmlist address not set, can't connect."); + SetError(); + break; + } + + _rsession=new RealmSocket(_sh); _rsession->SetDeleteByHandler(); _rsession->SetHost(GetConf()->realmlist); diff --git a/src/Client/Realm/RealmSocket.cpp b/src/Client/Realm/RealmSocket.cpp index 387acf2..af3daef 100644 --- a/src/Client/Realm/RealmSocket.cpp +++ b/src/Client/Realm/RealmSocket.cpp @@ -218,7 +218,14 @@ void RealmSocket::SendLogonChallenge(void) { if(!this->Ready()) { - log("Error sending AUTH_LOGON_CHALLENGE, port is not ready!\n"); + logerror("Error sending AUTH_LOGON_CHALLENGE, port is not ready!\n"); + return; + } + if( GetInstance()->GetConf()->accname.empty() || GetInstance()->GetConf()->clientversion_string.empty() + || GetInstance()->GetConf()->clientbuild==0 || GetInstance()->GetConf()->clientlang.empty() ) + { + logcritical("Missing data, can't send Login to Realm Server!"); + GetInstance()->SetError(); return; } std::string acc = stringToUpper(GetInstance()->GetConf()->accname); diff --git a/src/Client/log.cpp b/src/Client/log.cpp index 8a5dccd..4cde5cc 100644 --- a/src/Client/log.cpp +++ b/src/Client/log.cpp @@ -114,8 +114,6 @@ void logerror(const char *str, ...) void logcritical(const char *str, ...) { - if(!str || instance->GetConf()->debug < 2) - return; va_list ap; _log_setcolor(false,RED); va_start(ap, str);