Ticket #4095: movehexify.patch
File movehexify.patch, 4.4 KB (added by , 8 years ago) |
---|
-
source/network/NetTurnManager.cpp
29 29 #include "ps/CLogger.h" 30 30 #include "ps/Profile.h" 31 31 #include "ps/Pyrogenesis.h" 32 32 #include "ps/Replay.h" 33 33 #include "ps/SavedGame.h" 34 #include "ps/Util.h" 34 35 #include "scriptinterface/ScriptInterface.h" 35 36 #include "simulation2/Simulation2.h" 36 37 37 #include <sstream>38 38 #include <fstream> 39 #include <iomanip>40 39 41 40 const u32 DEFAULT_TURN_LENGTH_MP = 500; 42 41 const u32 DEFAULT_TURN_LENGTH_SP = 200; 43 42 44 43 static const int COMMAND_DELAY = 2; … … static const int COMMAND_DELAY = 2; 47 46 #define NETTURN_LOG(args) debug_printf args 48 47 #else 49 48 #define NETTURN_LOG(args) 50 49 #endif 51 50 52 static std::string Hexify(const std::string& s)53 {54 std::stringstream str;55 str << std::hex;56 for (size_t i = 0; i < s.size(); ++i)57 str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];58 return str.str();59 }60 61 51 CNetTurnManager::CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) : 62 52 m_Simulation2(simulation), m_CurrentTurn(0), m_ReadyTurn(1), m_TurnLength(defaultTurnLength), m_DeltaSimTime(0), 63 53 m_PlayerId(-1), m_ClientId(clientId), m_HasSyncError(false), m_Replay(replay), 64 54 m_TimeWarpNumTurns(0), m_FinalTurn(std::numeric_limits<u32>::max()) 65 55 { -
source/ps/Replay.cpp
37 37 #include "scriptinterface/ScriptStats.h" 38 38 #include "simulation2/Simulation2.h" 39 39 #include "simulation2/helpers/SimulationCommand.h" 40 40 41 41 #include <ctime> 42 #include <sstream>43 42 #include <fstream> 44 #include <iomanip>45 46 static std::string Hexify(const std::string& s)47 {48 std::stringstream str;49 str << std::hex;50 for (size_t i = 0; i < s.size(); ++i)51 str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];52 return str.str();53 }54 43 55 44 CReplayLogger::CReplayLogger(ScriptInterface& scriptInterface) : 56 45 m_ScriptInterface(scriptInterface), m_Stream(NULL) 57 46 { 58 47 } -
source/ps/Util.cpp
void WriteBigScreenshot(const VfsPath& e 420 420 else 421 421 LOGERROR("Error writing screenshot to '%s'", filename.string8()); 422 422 423 423 free(tile_data); 424 424 } 425 426 std::string Hexify(const std::string& s) 427 { 428 std::stringstream str; 429 str << std::hex; 430 for (size_t i = 0; i < s.size(); ++i) 431 str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i]; 432 return str.str(); 433 } -
source/ps/Util.h
20 20 21 21 #include "lib/file/vfs/vfs_path.h" 22 22 23 23 struct Tex; 24 24 25 externvoid WriteSystemInfo();25 void WriteSystemInfo(); 26 26 27 externconst wchar_t* ErrorString(int err);27 const wchar_t* ErrorString(int err); 28 28 29 externOsPath createDateIndexSubdirectory(const OsPath& parentDir);29 OsPath createDateIndexSubdirectory(const OsPath& parentDir); 30 30 31 externvoid WriteScreenshot(const VfsPath& extension);32 externvoid WriteBigScreenshot(const VfsPath& extension, int tiles);31 void WriteScreenshot(const VfsPath& extension); 32 void WriteBigScreenshot(const VfsPath& extension, int tiles); 33 33 34 extern Status tex_write(Tex* t, const VfsPath& filename); 34 Status tex_write(Tex* t, const VfsPath& filename); 35 36 std::string Hexify(const std::string& s); 35 37 36 38 #endif // PS_UTIL_H -
source/simulation2/Simulation2.cpp
44 44 #include "ps/Util.h" 45 45 #include "ps/XML/Xeromyces.h" 46 46 47 47 #include <iomanip> 48 48 49 static std::string Hexify(const std::string& s) // TODO: shouldn't duplicate this function in so many places50 {51 std::stringstream str;52 str << std::hex;53 for (size_t i = 0; i < s.size(); ++i)54 str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];55 return str.str();56 }57 58 49 class CSimulation2Impl 59 50 { 60 51 public: 61 52 CSimulation2Impl(CUnitManager* unitManager, shared_ptr<ScriptRuntime> rt, CTerrain* terrain) : 62 53 m_SimContext(), m_ComponentManager(m_SimContext, rt),