From 993bc000df000beaa28f18ef9cf8b0287bccc356 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Tue, 16 Oct 2007 12:07:11 +0000 Subject: [PATCH] * fixed a major bug in the DefScript engine that messed up correct bracketing in nested fuctions (example: ?{equal,{hello world} {hello world}} returning false. * enabled map tile duming also for release mode * small fix with SCP reading in case this should ever be ported to mac osx. --- src/Client/DefScript/DefScript.cpp | 4 ++-- src/Client/SCPDatabase.cpp | 2 +- src/shared/MapTile.cpp | 7 +------ src/shared/MapTile.h | 3 --- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Client/DefScript/DefScript.cpp b/src/Client/DefScript/DefScript.cpp index 77e1508..fb6fa6d 100644 --- a/src/Client/DefScript/DefScript.cpp +++ b/src/Client/DefScript/DefScript.cpp @@ -810,7 +810,7 @@ DefXChgResult DefScriptPackage::ReplaceVars(std::string str, CmdSet *pSet, unsig if(!bracketsOpen) { closingBracket=i; - if(nextVar==DEFSCRIPT_NONE && VarType!=DEFSCRIPT_NONE && !hasVar) // remove brackets in var names, like ${var{ia}ble} + if(nextVar==DEFSCRIPT_NONE && VarType==DEFSCRIPT_VAR && !hasVar) // remove brackets in var names, like ${var{ia}ble} { str.erase(closingBracket,1); str.erase(openingBracket,1); @@ -861,7 +861,7 @@ DefXChgResult DefScriptPackage::ReplaceVars(std::string str, CmdSet *pSet, unsig std::string subs=vname.substr(1,str.length()-1); unsigned int vn=atoi( subs.c_str() ); vns << vn; - if(pSet && vns.str()==subs) // resolve arg macros @0 - @99 + if(pSet && vns.str()==subs) // resolve arg macros @0 - @4294967295 str=pSet->arg[vn]; else if(pSet && subs=="def") str=pSet->defaultarg; diff --git a/src/Client/SCPDatabase.cpp b/src/Client/SCPDatabase.cpp index 709ba53..309bac3 100644 --- a/src/Client/SCPDatabase.cpp +++ b/src/Client/SCPDatabase.cpp @@ -42,7 +42,7 @@ uint32 SCPDatabase::LoadFromMem(char *buf, uint32 size) line.clear(); continue; } - if(line[line.size()-1] == 13) // this fixes the annoying newline problems on windows + binary mode + if(line[line.size()-1] == 13 || line[line.size()-1] == 10) // this fixes the annoying newline problems on windows + binary mode line[line.size()-1] = 0; if(line[0]=='[') { diff --git a/src/shared/MapTile.cpp b/src/shared/MapTile.cpp index 238d69b..74afc57 100644 --- a/src/shared/MapTile.cpp +++ b/src/shared/MapTile.cpp @@ -93,7 +93,7 @@ float MapTile::GetZ(float x, float y) return real_z; } -#ifdef _DEBUG + void MapTile::DebugDumpToFile(void) { const char *f = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -125,8 +125,3 @@ void MapTile::DebugDumpToFile(void) fprintf(fh, out.c_str()); fclose(fh); } -#endif - - - - diff --git a/src/shared/MapTile.h b/src/shared/MapTile.h index a70f016..d544554 100644 --- a/src/shared/MapTile.h +++ b/src/shared/MapTile.h @@ -30,10 +30,7 @@ public: ~MapTile(); void ImportFromADT(ADTFile*); float GetZ(float,float); - -#ifdef _DEBUG void DebugDumpToFile(void); -#endif private: MapChunk _chunks[256]; // 16x16