From fe91c8ebd6425823d86aa6321893364c32e28546 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Fri, 5 Jan 2007 21:35:23 +0000 Subject: [PATCH] --- src/Client/DefScript/VarSet.cpp | 18 ++++++++++++++---- src/Client/PseuWoW.cpp | 15 ++++++++------- src/shared/DebugStuff.h | 2 +- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Client/DefScript/VarSet.cpp b/src/Client/DefScript/VarSet.cpp index 3f6d59a..66e2547 100644 --- a/src/Client/DefScript/VarSet.cpp +++ b/src/Client/DefScript/VarSet.cpp @@ -87,16 +87,22 @@ bool VarSet::ReadVarsFromFile(std::string fn) while(!fh.eof()) { c=fh.get(); - if(c=='\n') + if(c=='\n' || fh.eof()) { + if(line.empty()) + continue; + vn.clear(); vv.clear(); while(line.at(0)==' ' || line.at(0)=='\t') line.erase(0,1); - while(line.at(line.length()-1)==' ' || line.at(line.length()-1)=='\t') - line.erase(line.length(),1); + //while(line.at(line.length()-1)==' ' || line.at(line.length()-1)=='\t') + // line.erase(line.length(),1); if(line.empty() || (line.at(0)=='/' && line.at(0)=='/') ) + { + line.clear(); continue; + } if(line.at(0)=='[' && line.at(line.length()-1)==']') { prefix=line.substr(1,line.length()-2); @@ -108,16 +114,19 @@ bool VarSet::ReadVarsFromFile(std::string fn) { upper=true; lower=false; + prefix.clear(); } else if(prefix=="#normal") { upper=false; lower=false; + prefix.clear(); } else if(prefix=="#lowercase") { lower=true; upper=false; + prefix.clear(); } else { @@ -130,7 +139,7 @@ bool VarSet::ReadVarsFromFile(std::string fn) unsigned int pos=line.find("="); if(pos) { - std::string v=line.substr(0,pos-1);; + std::string v=line.substr(0,pos);; if(upper) v=toUpper(v); @@ -140,6 +149,7 @@ 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());); } // else invalid line, must have '=' } diff --git a/src/Client/PseuWoW.cpp b/src/Client/PseuWoW.cpp index 7012ed2..89d2cd9 100644 --- a/src/Client/PseuWoW.cpp +++ b/src/Client/PseuWoW.cpp @@ -38,6 +38,7 @@ PseuInstance::PseuInstance() _ver_short="A12-dev1" DEBUG_APPENDIX; _wsession=NULL; _rsession=NULL; + _stop=false; } @@ -69,18 +70,18 @@ bool PseuInstance::Init(void) { if(!_scp->variables.ReadVarsFromFile(_confdir + "PseuWoW.conf")) { - printf("Error reading conf file [%s]",_confdir.append("PseuoW.conf").c_str()); + printf("Error reading conf file [%s]",_confdir.append("PseuWoW.conf").c_str()); return false; } _conf->ApplyFromVarSet(_scp->variables); - if(!_scp->variables.ReadVarsFromFile(_confdir + "users.conf")) + if(_scp->variables.ReadVarsFromFile(_confdir + "users.conf")) { - //printf("-> Done.\n"); + printf("-> Done reading users.\n"); } else { - printf("Error reading conf file [%s] - NO PERMISSIONS SET!",_confdir.append("users.conf").c_str()); + printf("Error reading conf file [%s] - NO PERMISSIONS SET!\n",_confdir.append("users.conf").c_str()); } @@ -96,9 +97,9 @@ bool PseuInstance::Init(void) { // //DEBUG1(printf("Main_Init: Loading DefScripts from folder '%s'\n",defScpPath.c_str());); - if(!_scp->RunScriptByName("_startup",NULL,255)){ - printf("Main_Init: Error executing '_startup.def'\n"); - } + //if(!_scp->RunScriptByName("_startup",NULL,255)){ + // printf("Main_Init: Error executing '_startup.def'\n"); + //} if(_stop){ printf("Errors while initializing, proc halted!!\n"); diff --git a/src/shared/DebugStuff.h b/src/shared/DebugStuff.h index 9d2f17a..c5c0996 100644 --- a/src/shared/DebugStuff.h +++ b/src/shared/DebugStuff.h @@ -7,7 +7,7 @@ #define DEBUG_APPENDIX " - DEBUG" #define CODEDEB(code) fprintf(stderr,"[[ %s ]]\n",#code); code; #else - #define DEB(code) + #define DEB(code) ; #define DEBUG_APPENDIX #define CODEDEB(code) code; #endif