All pastes #960903 Raw Edit

Miscellany

public diff v1 · immutable
#960903 ·published 2008-03-28 15:14 UTC
rendered paste body
Index: Client/DefScript/DefScriptFunctions.cpp===================================================================--- Client/DefScript/DefScriptFunctions.cpp	(revision 258)+++ Client/DefScript/DefScriptFunctions.cpp	(working copy)@@ -53,7 +53,7 @@     }     if(ppos==std::string::npos || ppos < slashpos) // even if there was neither / nor . they will be equal         fn+=".def";-    +     result=LoadScriptFromFile(fn);      r.ret=fn;@@ -127,7 +127,7 @@      variables.Set(vname,vval);     r.ret=vval;-    +     DefScript *sc = GetScript(Set.myname);     if(sc && sc->GetDebug())         printf("VAR: %s = '%s'\n",vname.c_str(),vval.c_str());@@ -199,7 +199,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    ldbl a=toNumber(variables.Get(vname));+    std::string temp=variables.Get(vname);+    ldbl a=toNumber(temp);     ldbl b=toNumber(Set.defaultarg);     a+=b;     variables.Set(vname,toString(a));@@ -216,7 +217,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    ldbl a=toNumber(variables.Get(vname));+    std::string temp=variables.Get(vname);+    ldbl a=toNumber(temp);     ldbl b=toNumber(Set.defaultarg);     a-=b;     variables.Set(vname,toString(a));@@ -233,7 +235,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    ldbl a=toNumber(variables.Get(vname));+    std::string temp=variables.Get(vname);+    ldbl a=toNumber(temp);     ldbl b=toNumber(Set.defaultarg);     a*=b;     variables.Set(vname,toString(a));@@ -250,7 +253,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    ldbl a=toNumber(variables.Get(vname));+    std::string temp=variables.Get(vname);+    ldbl a=toNumber(temp);     ldbl b=toNumber(Set.defaultarg);     if(b==0)         a=0;@@ -270,7 +274,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    uint64 a=toUint64(variables.Get(vname));+    std::string temp=variables.Get(vname);+    uint64 a=toUint64(temp);     uint64 b=toUint64(Set.defaultarg);     if(b==0)         a=0;@@ -290,7 +295,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    ldbl a=toNumber(variables.Get(vname));+    std::string temp=variables.Get(vname);+    ldbl a=toNumber(temp);     ldbl b=toNumber(Set.defaultarg);     a=pow(a,b);     variables.Set(vname,toString(a));@@ -307,7 +313,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    uint64 a=toUint64(variables.Get(vname));+    std::string temp=variables.Get(vname);+    uint64 a=toUint64(temp);     uint64 b=toUint64(Set.defaultarg);     a|=b;     variables.Set(vname,toString(a));@@ -324,7 +331,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    uint64 a=toUint64(variables.Get(vname));+    std::string temp=variables.Get(vname);+    uint64 a=toUint64(temp);     uint64 b=toUint64(Set.defaultarg);     a&=b;     variables.Set(vname,toString(a));@@ -341,7 +349,8 @@     }      std::string vname=_NormalizeVarName(Set.arg[0], Set.myname);-    uint64 a=toUint64(variables.Get(vname));+    std::string temp=variables.Get(vname);+    uint64 a=toUint64(temp);     uint64 b=toUint64(Set.defaultarg);     a^=b;     variables.Set(vname,toString(a));@@ -523,7 +532,7 @@     unsigned int pos = Set.defaultarg.find(Set.arg[0],(unsigned int)toNumber(Set.arg[1]));     if(pos == std::string::npos)         return "";-    return toString((uint64)pos);    +    return toString((uint64)pos); }  DefReturnResult DefScriptPackage::func_scriptexists(CmdSet& Set)Index: Client/GUI/SceneWorld.cpp===================================================================--- Client/GUI/SceneWorld.cpp	(revision 258)+++ Client/GUI/SceneWorld.cpp	(working copy)@@ -13,7 +13,7 @@ #include "World.h"  #define MOUSE_SENSIVITY 0.5f-#define ANGLE_STEP (M_PI/180) +#define ANGLE_STEP (M_PI/180) #define DEG_TO_RAD(x) ((x)*ANGLE_STEP) #define RAD_TO_DEG(x) ((x)/ANGLE_STEP) #define RAD_FIX(x) ( (x)>(2*M_PI) ? ((x)-(2*M_PI)) : (x) )@@ -54,7 +54,7 @@      debugText = guienv->addStaticText(L"< debug text >",rect<s32>(0,0,driver->getScreenSize().Width,30),true,true,0,-1,true); -    smgr->addSkyDomeSceneNode(driver->getTexture("data/misc/sky.jpg"),64,64,1.0f,2.0f);    +    smgr->addSkyDomeSceneNode(driver->getTexture("data/misc/sky.jpg"),64,64,1.0f,2.0f);      driver->setFog(video::SColor(0,100,101,190), true, fogdist, fogdist + 30, 0.02f); @@ -101,7 +101,7 @@         else             camera->turnLeft(timediff_f * M_PI * 25);     }-    +     if(eventrecv->key.pressed_once(KEY_BACK))     {         debugmode = !debugmode;@@ -160,7 +160,7 @@             //device->getCursorControl()->setVisible(true);         mouse_pos = device->getCursorControl()->getPosition();     }-    +     // camera height control     if (eventrecv->mouse.wheel < 10) eventrecv->mouse.wheel = 10;     camera->setHeight(  eventrecv->mouse.wheel + terrain->getHeight(camera->getPosition())  );@@ -177,7 +177,7 @@     str += " ## HEAD: ";     str += DEG_TO_RAD(camera->getHeading());     str += L"  Pos: ";-    str = ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o; +    str = ((((((str + wp.x) + L" | ") + wp.y) + L" | ") + wp.z) + L" | OR:") + wp.o;     str += L"  -- Terrain: Sectors: ";     str += (int)terrain->getSectorsRendered();     str += L" / ";@@ -228,7 +228,7 @@ {     // check if we changed the maptile     if(map_gridX == mapmgr->GetGridX() && map_gridY == mapmgr->GetGridY())-        return; // grid not changed, not necessary to update tile data        +        return; // grid not changed, not necessary to update tile data      // ... if changed, do necessary stuff...     map_gridX = mapmgr->GetGridX();@@ -297,8 +297,8 @@         for(s32 i=0; i<terrain->getSize().Width+1; i++)         {             curheight = terrain->getHeight(i,j);-            highest = max(highest,curheight);-            lowest = min(lowest,curheight);+            highest = std::max(highest,curheight);+            lowest = std::min(lowest,curheight);         } //    f32 heightdiff = highest - lowest; @@ -359,10 +359,10 @@     cam.X = tile->GetBaseX() - wp.x + (tsize.Width * UNITSIZE);     cam.Z = tile->GetBaseX() - wp.y + (tsize.Height * UNITSIZE);     float heading = RAD_TO_DEG(((M_PI*3.0f)/2.0f) - wp.o);-    float heading_diff = camera->getHeading() - heading; +    float heading_diff = camera->getHeading() - heading;     logdebug("Setting camera to x: %3f y: %3f z:%3f head: %3f", cam.X, cam.Y, cam.Z, heading);     camera->turnLeft(heading_diff);-    +     // TODO:     // - correct the above formulas     // - find out terrain height where the camera should be setIndex: Client/GUI/MInput.h===================================================================--- Client/GUI/MInput.h	(revision 258)+++ Client/GUI/MInput.h	(working copy)@@ -124,7 +124,7 @@         mouse.right = false;     } -	virtual bool OnEvent(SEvent event)+	virtual bool OnEvent(const SEvent& event) 	{         bool value = false; Index: Client/GUI/ShTlTerrainSceneNode.cpp===================================================================--- Client/GUI/ShTlTerrainSceneNode.cpp	(revision 258)+++ Client/GUI/ShTlTerrainSceneNode.cpp	(working copy)@@ -188,8 +188,8 @@     Material[0].TextureLayer[1].TextureWrap = video::ETC_CLAMP_TO_EDGE;     */     // irrlicht 1.3:-    Material[0].Textures[1] = CTexture;-    Material[0].TextureWrap[1] = video::ETC_CLAMP_TO_EDGE;+    Material[0].TextureLayer[1].Texture = CTexture;+    Material[0].TextureLayer[1].TextureWrap = video::ETC_CLAMP_TO_EDGE;      // setup UV coordinates of vertices on 2nd texture layer     f32 ax = (f32)MeshSize.Width / CTexture->getSize().Width / MeshSize.Width;Index: Client/DefScriptInterface.cpp===================================================================--- Client/DefScriptInterface.cpp	(revision 258)+++ Client/DefScriptInterface.cpp	(working copy)@@ -1,4 +1,4 @@-+#include <stdarg.h> #include "common.h" #include "PseuWoW.h" #include "DefScript/DefScript.h"@@ -59,7 +59,7 @@     AddFunc("sendwho",&DefScriptPackage::SCSendWho);     AddFunc("getobjectdist",&DefScriptPackage::SCGetObjectDistance);     AddFunc("switchopcodehandler",&DefScriptPackage::SCSwitchOpcodeHandler);-    AddFunc("opcodedisabled",&DefScriptPackage::SCOpcodeDisabled);    +    AddFunc("opcodedisabled",&DefScriptPackage::SCOpcodeDisabled);     AddFunc("spoofworldpacket",&DefScriptPackage::SCSpoofWorldPacket); } Index: Client/World/MovementMgr.cpp===================================================================--- Client/World/MovementMgr.cpp	(revision 258)+++ Client/World/MovementMgr.cpp	(working copy)@@ -29,12 +29,12 @@     wp << _moveFlags;     wp << (uint8)0; // unk     wp << getMSTime();-    wp << _mychar->GetPosition();+    //wp << _mychar->GetPosition();     // TODO: transport not yet handled/done     if(_moveFlags & MOVEMENTFLAG_ONTRANSPORT)     {         wp << (uint64)0; // transport guid-        wp << WorldPosition(); // transport position+    //    wp << WorldPosition(); // transport position         wp << getMSTime(); // transport time (??)     }     // TODO: swimming not yet doneIndex: shared/Network/TcpSocket.cpp===================================================================--- shared/Network/TcpSocket.cpp	(revision 258)+++ shared/Network/TcpSocket.cpp	(working copy)@@ -746,7 +746,7 @@     va_list ap;     va_start(ap, format);     char slask[5000];-    vsnprintf(slask, 5000, format, ap);+    snprintf(slask, 5000, format, ap);     va_end(ap);     Send( slask ); }Index: shared/SysDefs.h===================================================================--- shared/SysDefs.h	(revision 258)+++ shared/SysDefs.h	(working copy)@@ -71,17 +71,17 @@     #define I64FMT "%016llX"     #define I64FMTD "%llu"     #define SI64FMTD "%lld"-#   if PLATFORM == PLATFORM_UNIX-        typedef __int64_t   int64;-        typedef __int32_t   int32;-        typedef __int16_t   int16;-        typedef __int8_t    int8;-        typedef __uint64_t  uint64;-        typedef __uint32_t  uint32;-        typedef __uint16_t  uint16;-        typedef __uint8_t   uint8;-        typedef uint16      WORD;-        typedef uint32      DWORD;+#if PLATFORM == PLATFORM_UNIX+        typedef long long int64;+        typedef long int32;+        typedef short int16;+        typedef char int8;+        typedef unsigned long long uint64;+        typedef unsigned long uint32;+        typedef unsigned short uint16;+        typedef unsigned char uint8;+        typedef unsigned short WORD;+        typedef uint32 DWORD; #   else         typedef long long int64;         typedef long int32;