Added const strings for versions

This commit is contained in:
mathusummut
2018-10-06 17:20:22 +02:00
parent 481fbbe534
commit e12f168a01
23 changed files with 98 additions and 124 deletions

View File

@@ -71,6 +71,7 @@
#include "platform_util.h"
#include "utf8.h"
#include "byte_order.h"
#include "shared_definitions.h"
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
#include <unistd.h>
@@ -97,8 +98,6 @@ namespace Shared {
const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24;
static string crcCachePath = "";
static void(*unexpected_handler)(const char*) = NULL;
static string gameVersion = "";
static string gameGITVersion = "";
namespace Private {
@@ -687,19 +686,6 @@ namespace Shared {
unexpected_handler = handler;
}
//string getGameVersion() {
// return gameVersion;
//}
//string getGameGITVersion() {
// return gameGITVersion;
//}
void setGameVersion(const string &version) {
gameVersion = version;
}
void setGameGITVersion(const string &git) {
gameGITVersion = git;
}
string getCRCCacheFileName(std::pair<string, string> cacheKeys) {
string crcCacheFile = cacheKeys.first + cacheKeys.second;
return crcCacheFile;
@@ -859,8 +845,7 @@ namespace Shared {
char szBuf1[100] = "";
strftime(szBuf1, 100, "%Y-%m-%d %H:%M:%S", &loctime);
string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(gameVersion);
string writeGameGITVersion = Shared::PlatformByteOrder::toCommonEndian(gameGITVersion);
string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(GameVersionString);
string writeActualFileName = Shared::PlatformByteOrder::toCommonEndian(actualFileName);
fprintf(fp, "%20ld,%20u,%20ld",
@@ -868,9 +853,8 @@ namespace Shared {
Shared::PlatformByteOrder::toCommonEndian(crcValue),
(long) Shared::PlatformByteOrder::toCommonEndian(now));
fprintf(fp, "\n%s\n%s\n%s",
fprintf(fp, "\n%s\n%s",
writeGameVer.c_str(),
writeGameGITVersion.c_str(),
writeActualFileName.c_str());
fclose(fp);

View File

@@ -38,7 +38,7 @@
#include <string.h>
#include <stdlib.h>
#include "conversion.h"
#include "versions.h"
#include "shared_definitions.h"
using namespace Shared::Util;
using namespace Shared::PlatformCommon;
@@ -837,7 +837,7 @@ namespace Shared {
if (SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf("===> IRC: Line: %d\n", __LINE__);
safeMutex.Lock();
if (irc_connect(ircSession, argv[0].c_str(), IRC_SERVER_PORT, 0, this->nick.c_str(), this->username.c_str(), (string("ZetaGlest ") + GAME_VERSION).c_str())) {
if (irc_connect(ircSession, argv[0].c_str(), IRC_SERVER_PORT, 0, this->nick.c_str(), this->username.c_str(), (string("ZetaGlest ") + GameVersionString).c_str())) {
safeMutex.ReleaseLock();
if (SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf("===> IRC Could not connect: %s\n", irc_strerror(irc_errno(ircSession)));
return;

View File

@@ -33,6 +33,7 @@
#include "utf8.h"
#include "font.h"
#include "string_utils.h"
#include "shared_definitions.h"
#include "leak_dumper.h"
using namespace std;
@@ -45,7 +46,6 @@ namespace Shared {
string Properties::applicationPath = "";
string Properties::applicationDataPath = "";
string Properties::gameVersion = "";
string Properties::techtreePath = "";
string Properties::scenarioPath = "";
@@ -270,7 +270,7 @@ namespace Shared {
mapTagReplacementValues["{SCENARIOPATH}"] = Properties::scenarioPath;
mapTagReplacementValues["{TUTORIALPATH}"] = Properties::tutorialPath;
mapTagReplacementValues["$GAMEVERSION"] = Properties::gameVersion;
mapTagReplacementValues["$GAMEVERSION"] = GameVersionString;
//
// #2
@@ -407,7 +407,7 @@ namespace Shared {
// }
replaceAll(value, "{TUTORIALPATH}", Properties::tutorialPath);
replaceAll(value, "$GAMEVERSION", Properties::gameVersion);
replaceAll(value, "$GAMEVERSION", GameVersionString);
}
//if(originalValue != value || originalValue.find("$APPLICATIONDATAPATH") != string::npos) {