From d744135e023fa82cb4aaeb25852091d2922582f4 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Fri, 5 Jan 2007 22:00:53 +0000 Subject: [PATCH] etc --- src/Client/DefScript/DefScript.h | 5 +++++ src/Client/DefScript/VarSet.cpp | 4 +++- src/Client/PseuWoW.cpp | 5 +++-- src/Client/Realm/RealmSocket.cpp | 4 +++- src/Client/World/Player.cpp | 4 ++-- src/shared/DebugStuff.h | 6 +++--- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Client/DefScript/DefScript.h b/src/Client/DefScript/DefScript.h index a168f0f..c3bc506 100644 --- a/src/Client/DefScript/DefScript.h +++ b/src/Client/DefScript/DefScript.h @@ -3,6 +3,11 @@ #define __DEFSCRIPT_H #define MAXARGS 99 +#ifdef _DEBUG +# define _DEFSC_DEBUG(code) code; +#else +# define _DEFSC_DEBUG(code) /* code */ +#endif #include #include "VarSet.h" diff --git a/src/Client/DefScript/VarSet.cpp b/src/Client/DefScript/VarSet.cpp index 66e2547..1736653 100644 --- a/src/Client/DefScript/VarSet.cpp +++ b/src/Client/DefScript/VarSet.cpp @@ -149,7 +149,9 @@ bool VarSet::ReadVarsFromFile(std::string fn) vn=prefix+v; vv=line.substr(pos+1,line.length()-1); Set(vn,vv); - DEB(printf("DEBUG: Var import [%s] = %s\n",vn.c_str(),vv.c_str());); + #ifdef _DEBUG + printf("DEBUG: Var import [%s] = %s\n",vn.c_str(),vv.c_str()); + #endif } // else invalid line, must have '=' } diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp index 89d2cd9..1d993f8 100644 --- a/src/Client/PseuWoW.cpp +++ b/src/Client/PseuWoW.cpp @@ -121,9 +121,10 @@ void PseuInstance::Run(void) _rsession->SetHost(GetConf()->realmlist); _rsession->SetPort(GetConf()->realmport); + _rsession->SetInstance(this); _rsession->Start(); - if(_rsession->IsValid()) + if(_rsession->IsValid()) // TODO: need better check for IsValid(), it must check also if it could connect { _sh.Add(_rsession); _rsession->SendLogonChallenge(); @@ -143,7 +144,7 @@ void PseuInstance::Update() if(_sh.GetCount()) _sh.Select(1,0); // update the realmsocket //else - // socket invalid + // socket invalid? _wsession->Update(); diff --git a/src/Client/Realm/RealmSocket.cpp b/src/Client/Realm/RealmSocket.cpp index 2b09a8d..1f8a8d4 100644 --- a/src/Client/Realm/RealmSocket.cpp +++ b/src/Client/Realm/RealmSocket.cpp @@ -104,12 +104,14 @@ void RealmSocket::SetInstance(PseuInstance *pi) void RealmSocket::Start(void) { - if(this->_rhost.empty() || _rport==0 || !_valid || _instance==NULL) + if(_rhost.empty() || _rport==0 || _instance==NULL) return; +// is here any other socket code neded? // _socket.Init() // _socket.SetHost(_host); // _socket.SetPort(_port); + Open(_rhost,_rport); //... _valid=true; diff --git a/src/Client/World/Player.cpp b/src/Client/World/Player.cpp index 1a09f8f..e0d40e6 100644 --- a/src/Client/World/Player.cpp +++ b/src/Client/World/Player.cpp @@ -59,7 +59,7 @@ bool PlayerNameCache::SaveToFile(void){ len=(*i)->_name.length(); fh.write( (char*)&len,sizeof(uint8) ); fh.write( (char*)(*i)->_name.c_str(),len ); - DEB(printf( "PlayerNameCache << " I64FMT " -> %s\n", (*i)->_guid, (*i)->_name.c_str());); + DEBUG(printf( "PlayerNameCache << " I64FMT " -> %s\n", (*i)->_guid, (*i)->_name.c_str());); } fh.close(); printf("PlayerNameCache saved successfully.\n"); @@ -100,7 +100,7 @@ bool PlayerNameCache::ReadFromFile(void){ cacheItem->_name=nameptr; AddInfo(cacheItem); printf("\rPlayerNameCache [ %u / %u ] items loaded",i+1,size); - DEB(printf( " >> " I64FMT " -> %s\n", cacheItem->_guid, nameptr);); + DEBUG(printf( " >> " I64FMT " -> %s\n", cacheItem->_guid, nameptr);); } printf("\n"); delete nameptr; diff --git a/src/shared/DebugStuff.h b/src/shared/DebugStuff.h index c5c0996..d6bb98e 100644 --- a/src/shared/DebugStuff.h +++ b/src/shared/DebugStuff.h @@ -3,13 +3,13 @@ #ifdef _DEBUG - #define DEB(code) code; + #define DEBUG(code) code; #define DEBUG_APPENDIX " - DEBUG" #define CODEDEB(code) fprintf(stderr,"[[ %s ]]\n",#code); code; #else - #define DEB(code) ; + #define DEBUG(code) /* code */ #define DEBUG_APPENDIX - #define CODEDEB(code) code; + #define CODEDEB(code) (code;) #endif #define ASSERT( assertion ) { if( !(assertion) ) { fprintf( stderr, "\n%s:%i ASSERTION FAILED:\n %s\n", __FILE__, __LINE__, #assertion ); throw "Assertion Failed";