* fixed endless loop on startup with missing data (unread conf file, etc)

* fixed logcritical()
* visual enhancement in loadall.def
This commit is contained in:
False.Genesis 2007-02-04 01:42:25 +00:00
parent 931435b751
commit 992f497ae2
4 changed files with 23 additions and 10 deletions

View File

@ -1,7 +1,7 @@
// preloads the most important scripts // preloads the most important scripts
LOG Loading DefScripts... LOG * Loading DefScripts...
RELOADDEF _enterworld RELOADDEF _enterworld
RELOADDEF _leaveworld RELOADDEF _leaveworld

View File

@ -101,7 +101,8 @@ bool PseuInstance::Init(void) {
log("Loading DefScripts from folder '%s'",_scpdir.c_str()); log("Loading DefScripts from folder '%s'",_scpdir.c_str());
if(!_scp->RunScript("_startup",NULL)) if(!_scp->RunScript("_startup",NULL))
{ {
printf("Error executing '_startup.def'"); logerror("Error executing '_startup.def'");
SetError();
} }
if(GetConf()->enablecli) if(GetConf()->enablecli)
@ -111,11 +112,10 @@ bool PseuInstance::Init(void) {
ZThread::Thread t(_cli); ZThread::Thread t(_cli);
} }
if(_stop){ if(_error)
log("Errors while initializing, proc halted!!"); {
if(GetConf()->exitonerror) logcritical("Errors while initializing!");
exit(0); return false;
while(true)this->Sleep(1000);
} }
log("Init complete.\n"); log("Init complete.\n");
@ -130,6 +130,14 @@ void PseuInstance::Run(void)
if(!_initialized) if(!_initialized)
return; return;
if(GetConf()->realmlist.empty() || GetConf()->realmport==0)
{
logcritical("Realmlist address not set, can't connect.");
SetError();
break;
}
_rsession=new RealmSocket(_sh); _rsession=new RealmSocket(_sh);
_rsession->SetDeleteByHandler(); _rsession->SetDeleteByHandler();
_rsession->SetHost(GetConf()->realmlist); _rsession->SetHost(GetConf()->realmlist);

View File

@ -218,7 +218,14 @@ void RealmSocket::SendLogonChallenge(void)
{ {
if(!this->Ready()) 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; return;
} }
std::string acc = stringToUpper(GetInstance()->GetConf()->accname); std::string acc = stringToUpper(GetInstance()->GetConf()->accname);

View File

@ -114,8 +114,6 @@ void logerror(const char *str, ...)
void logcritical(const char *str, ...) void logcritical(const char *str, ...)
{ {
if(!str || instance->GetConf()->debug < 2)
return;
va_list ap; va_list ap;
_log_setcolor(false,RED); _log_setcolor(false,RED);
va_start(ap, str); va_start(ap, str);