mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Use the PYROGENESIS_VERSION macro instead of a global
Reviewed-At: https://gitea.wildfiregames.com/0ad/0ad/pulls/8222
This commit is contained in:
parent
f0c8db6422
commit
50f6da2a13
12 changed files with 19 additions and 15 deletions
|
|
@ -20,6 +20,11 @@
|
|||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_BUILDVERSION
|
||||
#define INCLUDED_BUILDVERSION
|
||||
|
||||
#define PYROGENESIS_VERSION "0.28.0"
|
||||
#define PYROGENESIS_VERSION_WORD 0,28,0,0
|
||||
extern wchar_t build_version[];
|
||||
|
||||
#endif // INCLUDED_BUILDVERSION
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ XmppClient::XmppClient(const ScriptInterface* scriptInterface, const std::string
|
|||
|
||||
m_client->registerConnectionListener(this);
|
||||
m_client->setPresence(gloox::Presence::Available, -1);
|
||||
m_client->disco()->setVersion("Pyrogenesis", engine_version);
|
||||
m_client->disco()->setVersion("Pyrogenesis", PYROGENESIS_VERSION);
|
||||
m_client->disco()->setIdentity("client", "bot");
|
||||
m_client->setCompression(false);
|
||||
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ static void RunGameOrAtlas(const std::span<const char* const> argv)
|
|||
|
||||
if (args.Has("version"))
|
||||
{
|
||||
debug_printf("Pyrogenesis %s\n", engine_version);
|
||||
debug_printf("Pyrogenesis %s\n", PYROGENESIS_VERSION);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ Message CreateHandshake() {
|
|||
handshake.m_Magic = PS_PROTOCOL_MAGIC;
|
||||
|
||||
handshake.m_ProtocolVersion = PS_PROTOCOL_VERSION;
|
||||
handshake.m_EngineVersion = engine_version;
|
||||
handshake.m_EngineVersion = PYROGENESIS_VERSION;
|
||||
|
||||
for (const Mod::ModData* mod : Mod::Instance().GetEnabledModsData())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void StartNetworkHost(const CStrW& playerName, const u16 serverPort, const CStr&
|
|||
* TODO: it should be possible to implement SRP or something along those lines to completely protect from this,
|
||||
* but the cost/benefit ratio is probably not worth it.
|
||||
*/
|
||||
CStr hashedPass = HashCryptographically(password, hostJID + password + engine_version);
|
||||
CStr hashedPass = HashCryptographically(password, hostJID + password + PYROGENESIS_VERSION);
|
||||
g_NetServer->SetPassword(hashedPass);
|
||||
g_NetClient->SetHostJID(hostJID);
|
||||
g_NetClient->SetGamePassword(hashedPass);
|
||||
|
|
@ -176,7 +176,7 @@ void StartNetworkJoinLobby(const CStrW& playerName, const CStr& hostJID, const C
|
|||
ENSURE(!g_NetServer);
|
||||
ENSURE(!g_Game);
|
||||
|
||||
CStr hashedPass = HashCryptographically(password, hostJID + password + engine_version);
|
||||
CStr hashedPass = HashCryptographically(password, hostJID + password + PYROGENESIS_VERSION);
|
||||
g_Game = new CGame(true);
|
||||
g_NetClient = new CNetClient(g_Game);
|
||||
g_NetClient->SetUserName(playerName);
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ CLogger::CLogger(std::ostream& mainLog, std::ostream& interestingLog, const bool
|
|||
m_InterestingLog{interestingLog},
|
||||
m_UseDebugPrintf{useDebugPrintf}
|
||||
{
|
||||
m_MainLog << html_header0 << engine_version << ") Main log" << html_header1;
|
||||
m_InterestingLog << html_header0 << engine_version << ") Main log (warnings and errors only)" << html_header1;
|
||||
m_MainLog << html_header0 << PYROGENESIS_VERSION << ") Main log" << html_header1;
|
||||
m_InterestingLog << html_header0 << PYROGENESIS_VERSION << ") Main log (warnings and errors only)" << html_header1;
|
||||
}
|
||||
|
||||
CLogger::~CLogger()
|
||||
|
|
|
|||
|
|
@ -19,14 +19,12 @@
|
|||
|
||||
#include "Pyrogenesis.h"
|
||||
|
||||
#include "lib/build_version.h"
|
||||
#include "lib/path.h"
|
||||
#include "lib/sysdep/sysdep.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cwchar>
|
||||
|
||||
const char* engine_version = PYROGENESIS_VERSION;
|
||||
const char* main_window_name = "0 A.D.";
|
||||
|
||||
// convert contents of file <in_filename> from char to wchar_t and
|
||||
|
|
@ -59,7 +57,7 @@ static void AppendAsciiFile(FILE* out, const OsPath& pathname)
|
|||
void psBundleLogs(FILE* f)
|
||||
{
|
||||
fwprintf(f, L"Build Version: %ls\n\n", build_version);
|
||||
fwprintf(f, L"Engine Version: %hs\n\n", engine_version);
|
||||
fwprintf(f, L"Engine Version: %hs\n\n", PYROGENESIS_VERSION);
|
||||
|
||||
fwprintf(f, L"System info:\n\n");
|
||||
OsPath path1 = psLogDir()/"system_info.txt";
|
||||
|
|
|
|||
|
|
@ -24,12 +24,13 @@ Standard declarations which are included in all projects.
|
|||
#ifndef INCLUDED_PYROGENESIS
|
||||
#define INCLUDED_PYROGENESIS
|
||||
|
||||
#include <lib/build_version.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
class Path;
|
||||
using OsPath = Path;
|
||||
|
||||
extern const char* engine_version;
|
||||
extern const char* main_window_name;
|
||||
|
||||
extern void psBundleLogs(FILE* f); // set during InitVfs
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void CReplayLogger::StartGame(JS::MutableHandleValue attribs)
|
|||
Script::SetProperty(rq, attribs, "timestamp", (double)std::time(nullptr));
|
||||
|
||||
// Add engine version and currently loaded mods for sanity checks when replaying
|
||||
Script::SetProperty(rq, attribs, "engine_version", engine_version);
|
||||
Script::SetProperty(rq, attribs, "engine_version", PYROGENESIS_VERSION);
|
||||
JS::RootedValue mods(rq.cx);
|
||||
Script::ToJSVal(rq, &mods, g_Mods.GetEnabledModsData());
|
||||
Script::SetProperty(rq, attribs, "mods", mods);
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ Status SavedGames::Save(const CStrW& name, const CStrW& description, CSimulation
|
|||
Script::CreateObject(
|
||||
rq,
|
||||
&metadata,
|
||||
"engine_version", engine_version,
|
||||
"engine_version", PYROGENESIS_VERSION,
|
||||
"time", static_cast<double>(now),
|
||||
"playerID", g_Game->GetPlayerID(),
|
||||
"mods", mods,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ const u8 minimumReplayDuration = 3;
|
|||
|
||||
OsPath VisualReplay::GetDirectoryPath()
|
||||
{
|
||||
return Paths(g_CmdLineArgs).UserData() / "replays" / engine_version;
|
||||
return Paths(g_CmdLineArgs).UserData() / "replays" / PYROGENESIS_VERSION;
|
||||
}
|
||||
|
||||
OsPath VisualReplay::GetCacheFilePath()
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ JS::Value GetEngineInfo(const ScriptInterface& scriptInterface)
|
|||
Script::CreateObject(
|
||||
rq,
|
||||
&metainfo,
|
||||
"engine_version", engine_version,
|
||||
"engine_version", PYROGENESIS_VERSION,
|
||||
"mods", mods);
|
||||
|
||||
Script::DeepFreezeObject(rq, metainfo);
|
||||
|
|
|
|||
Loading…
Reference in a new issue