Remove duplication of the Hexify function.

Remove the useless extern keyword from function declarations in
ps/Util.h.

Patch by echotangoecho, refs #4095

This was SVN commit r18591.
This commit is contained in:
Nicolas Auvray 2016-08-08 12:50:39 +00:00
parent e3cdb2253d
commit bb1f86f515
5 changed files with 18 additions and 37 deletions

View File

@ -31,12 +31,11 @@
#include "ps/Pyrogenesis.h"
#include "ps/Replay.h"
#include "ps/SavedGame.h"
#include "ps/Util.h"
#include "scriptinterface/ScriptInterface.h"
#include "simulation2/Simulation2.h"
#include <sstream>
#include <fstream>
#include <iomanip>
const u32 DEFAULT_TURN_LENGTH_MP = 500;
const u32 DEFAULT_TURN_LENGTH_SP = 200;
@ -49,15 +48,6 @@ static const int COMMAND_DELAY = 2;
#define NETTURN_LOG(args)
#endif
static std::string Hexify(const std::string& s)
{
std::stringstream str;
str << std::hex;
for (size_t i = 0; i < s.size(); ++i)
str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];
return str.str();
}
CNetTurnManager::CNetTurnManager(CSimulation2& simulation, u32 defaultTurnLength, int clientId, IReplayLogger& replay) :
m_Simulation2(simulation), m_CurrentTurn(0), m_ReadyTurn(1), m_TurnLength(defaultTurnLength), m_DeltaSimTime(0),
m_PlayerId(-1), m_ClientId(clientId), m_HasSyncError(false), m_Replay(replay),

View File

@ -39,18 +39,7 @@
#include "simulation2/helpers/SimulationCommand.h"
#include <ctime>
#include <sstream>
#include <fstream>
#include <iomanip>
static std::string Hexify(const std::string& s)
{
std::stringstream str;
str << std::hex;
for (size_t i = 0; i < s.size(); ++i)
str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];
return str.str();
}
CReplayLogger::CReplayLogger(ScriptInterface& scriptInterface) :
m_ScriptInterface(scriptInterface), m_Stream(NULL)

View File

@ -422,3 +422,12 @@ void WriteBigScreenshot(const VfsPath& extension, int tiles)
free(tile_data);
}
std::string Hexify(const std::string& s)
{
std::stringstream str;
str << std::hex;
for (const char& c : s)
str << std::setfill('0') << std::setw(2) << (int)(unsigned char)c;
return str.str();
}

View File

@ -22,15 +22,17 @@
struct Tex;
extern void WriteSystemInfo();
void WriteSystemInfo();
extern const wchar_t* ErrorString(int err);
const wchar_t* ErrorString(int err);
extern OsPath createDateIndexSubdirectory(const OsPath& parentDir);
OsPath createDateIndexSubdirectory(const OsPath& parentDir);
extern void WriteScreenshot(const VfsPath& extension);
extern void WriteBigScreenshot(const VfsPath& extension, int tiles);
void WriteScreenshot(const VfsPath& extension);
void WriteBigScreenshot(const VfsPath& extension, int tiles);
extern Status tex_write(Tex* t, const VfsPath& filename);
Status tex_write(Tex* t, const VfsPath& filename);
std::string Hexify(const std::string& s);
#endif // PS_UTIL_H

View File

@ -46,15 +46,6 @@
#include <iomanip>
static std::string Hexify(const std::string& s) // TODO: shouldn't duplicate this function in so many places
{
std::stringstream str;
str << std::hex;
for (size_t i = 0; i < s.size(); ++i)
str << std::setfill('0') << std::setw(2) << (int)(unsigned char)s[i];
return str.str();
}
class CSimulation2Impl
{
public: