This commit is contained in:
False.Genesis 2007-01-05 22:00:53 +00:00
parent fe91c8ebd6
commit d744135e02
6 changed files with 19 additions and 9 deletions

View File

@ -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 <map>
#include "VarSet.h"

View File

@ -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 '='
}

View File

@ -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();

View File

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

View File

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

View File

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