mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
refactor: get rid of global game variables
This commit is contained in:
parent
ce16d8e6c8
commit
b00c65c8c0
26
src/Common/Game/IGame.cpp
Normal file
26
src/Common/Game/IGame.cpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include "IGame.h"
|
||||||
|
|
||||||
|
#include "IW3/GameIW3.h"
|
||||||
|
#include "IW4/GameIW4.h"
|
||||||
|
#include "IW5/GameIW5.h"
|
||||||
|
#include "T5/GameT5.h"
|
||||||
|
#include "T6/GameT6.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
IGame* IGame::GetGameById(GameId gameId)
|
||||||
|
{
|
||||||
|
static IGame* games[static_cast<unsigned>(GameId::COUNT)]{
|
||||||
|
new IW3::Game(),
|
||||||
|
new IW4::Game(),
|
||||||
|
new IW5::Game(),
|
||||||
|
new T5::Game(),
|
||||||
|
new T6::Game(),
|
||||||
|
};
|
||||||
|
|
||||||
|
assert(static_cast<unsigned>(gameId) < static_cast<unsigned>(GameId::COUNT));
|
||||||
|
auto* result = games[static_cast<unsigned>(gameId)];
|
||||||
|
assert(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
@ -36,13 +36,13 @@ public:
|
|||||||
IGame& operator=(const IGame& other) = default;
|
IGame& operator=(const IGame& other) = default;
|
||||||
IGame& operator=(IGame&& other) noexcept = default;
|
IGame& operator=(IGame&& other) noexcept = default;
|
||||||
|
|
||||||
virtual GameId GetId() = 0;
|
[[nodiscard]] virtual GameId GetId() const = 0;
|
||||||
virtual std::string GetFullName() = 0;
|
[[nodiscard]] virtual const std::string& GetFullName() const = 0;
|
||||||
virtual std::string GetShortName() = 0;
|
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
|
||||||
virtual void AddZone(Zone* zone) = 0;
|
virtual void AddZone(Zone* zone) = 0;
|
||||||
virtual void RemoveZone(Zone* zone) = 0;
|
virtual void RemoveZone(Zone* zone) = 0;
|
||||||
virtual std::vector<Zone*> GetZones() = 0;
|
[[nodiscard]] virtual const std::vector<Zone*>& GetZones() const = 0;
|
||||||
virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() = 0;
|
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
|
||||||
|
|
||||||
static IGame* GetGameById(GameId gameId);
|
static IGame* GetGameById(GameId gameId);
|
||||||
};
|
};
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
#include "GameIW3.h"
|
#include "GameIW3.h"
|
||||||
|
|
||||||
#include "IW3.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW3;
|
using namespace IW3;
|
||||||
|
|
||||||
GameIW3 g_GameIW3;
|
GameId Game::GetId() const
|
||||||
|
|
||||||
GameId GameIW3::GetId()
|
|
||||||
{
|
{
|
||||||
return GameId::IW3;
|
return GameId::IW3;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW3::GetFullName()
|
const std::string& Game::GetFullName() const
|
||||||
{
|
{
|
||||||
return "Call Of Duty 4: Modern Warfare";
|
static std::string fullName = "Call Of Duty 4: Modern Warfare";
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW3::GetShortName()
|
const std::string& Game::GetShortName() const
|
||||||
{
|
{
|
||||||
return "IW3";
|
static std::string shortName = "IW3";
|
||||||
|
return shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW3::AddZone(Zone* zone)
|
void Game::AddZone(Zone* zone)
|
||||||
{
|
{
|
||||||
m_zones.push_back(zone);
|
m_zones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW3::RemoveZone(Zone* zone)
|
void Game::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::ranges::find(m_zones, zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
@ -36,12 +34,12 @@ void GameIW3::RemoveZone(Zone* zone)
|
|||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Zone*> GameIW3::GetZones()
|
const std::vector<Zone*>& Game::GetZones() const
|
||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GameLanguagePrefix>& GameIW3::GetLanguagePrefixes()
|
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||||
{
|
{
|
||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
class GameIW3 final : public IGame
|
namespace IW3
|
||||||
|
{
|
||||||
|
class Game final : public IGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameId GetId() override;
|
[[nodiscard]] GameId GetId() const override;
|
||||||
std::string GetFullName() override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
std::string GetShortName() override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
|
||||||
const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Zone*> m_zones;
|
std::vector<Zone*> m_zones;
|
||||||
};
|
};
|
||||||
|
} // namespace IW3
|
||||||
extern GameIW3 g_GameIW3;
|
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
#include "GameIW4.h"
|
#include "GameIW4.h"
|
||||||
|
|
||||||
#include "IW4.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW4;
|
using namespace IW4;
|
||||||
|
|
||||||
GameIW4 g_GameIW4;
|
GameId Game::GetId() const
|
||||||
|
|
||||||
GameId GameIW4::GetId()
|
|
||||||
{
|
{
|
||||||
return GameId::IW4;
|
return GameId::IW4;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW4::GetFullName()
|
const std::string& Game::GetFullName() const
|
||||||
{
|
{
|
||||||
return "Call Of Duty: Modern Warfare 2";
|
static std::string fullName = "Call Of Duty: Modern Warfare 2";
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW4::GetShortName()
|
const std::string& Game::GetShortName() const
|
||||||
{
|
{
|
||||||
return "IW4";
|
static std::string shortName = "IW4";
|
||||||
|
return shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW4::AddZone(Zone* zone)
|
void Game::AddZone(Zone* zone)
|
||||||
{
|
{
|
||||||
m_zones.push_back(zone);
|
m_zones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW4::RemoveZone(Zone* zone)
|
void Game::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::ranges::find(m_zones, zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
@ -36,12 +34,12 @@ void GameIW4::RemoveZone(Zone* zone)
|
|||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Zone*> GameIW4::GetZones()
|
const std::vector<Zone*>& Game::GetZones() const
|
||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GameLanguagePrefix>& GameIW4::GetLanguagePrefixes()
|
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||||
{
|
{
|
||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
class GameIW4 final : public IGame
|
namespace IW4
|
||||||
|
{
|
||||||
|
class Game final : public IGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameId GetId() override;
|
[[nodiscard]] GameId GetId() const override;
|
||||||
std::string GetFullName() override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
std::string GetShortName() override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
|
||||||
const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Zone*> m_zones;
|
std::vector<Zone*> m_zones;
|
||||||
};
|
};
|
||||||
|
} // namespace IW4
|
||||||
extern GameIW4 g_GameIW4;
|
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
#include "GameIW5.h"
|
#include "GameIW5.h"
|
||||||
|
|
||||||
#include "IW5.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace IW5;
|
using namespace IW5;
|
||||||
|
|
||||||
GameIW5 g_GameIW5;
|
GameId Game::GetId() const
|
||||||
|
|
||||||
GameId GameIW5::GetId()
|
|
||||||
{
|
{
|
||||||
return GameId::IW5;
|
return GameId::IW5;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW5::GetFullName()
|
const std::string& Game::GetFullName() const
|
||||||
{
|
{
|
||||||
return "Call Of Duty: Modern Warfare 3";
|
static std::string fullName = "Call Of Duty: Modern Warfare 3";
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameIW5::GetShortName()
|
const std::string& Game::GetShortName() const
|
||||||
{
|
{
|
||||||
return "IW5";
|
static std::string shortName = "IW5";
|
||||||
|
return shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW5::AddZone(Zone* zone)
|
void Game::AddZone(Zone* zone)
|
||||||
{
|
{
|
||||||
m_zones.push_back(zone);
|
m_zones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameIW5::RemoveZone(Zone* zone)
|
void Game::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::ranges::find(m_zones, zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
@ -36,12 +34,12 @@ void GameIW5::RemoveZone(Zone* zone)
|
|||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Zone*> GameIW5::GetZones()
|
const std::vector<Zone*>& Game::GetZones() const
|
||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GameLanguagePrefix>& GameIW5::GetLanguagePrefixes()
|
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||||
{
|
{
|
||||||
static std::vector<GameLanguagePrefix> prefixes;
|
static std::vector<GameLanguagePrefix> prefixes;
|
||||||
return prefixes;
|
return prefixes;
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
class GameIW5 final : public IGame
|
namespace IW5
|
||||||
|
{
|
||||||
|
class Game final : public IGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameId GetId() override;
|
[[nodiscard]] GameId GetId() const override;
|
||||||
std::string GetFullName() override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
std::string GetShortName() override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
|
||||||
const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Zone*> m_zones;
|
std::vector<Zone*> m_zones;
|
||||||
};
|
};
|
||||||
|
} // namespace IW5
|
||||||
extern GameIW5 g_GameIW5;
|
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
#include "GameT5.h"
|
#include "GameT5.h"
|
||||||
|
|
||||||
#include "T5.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace T5;
|
using namespace T5;
|
||||||
|
|
||||||
GameT5 g_GameT5;
|
GameId Game::GetId() const
|
||||||
|
|
||||||
GameId GameT5::GetId()
|
|
||||||
{
|
{
|
||||||
return GameId::T5;
|
return GameId::T5;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameT5::GetFullName()
|
const std::string& Game::GetFullName() const
|
||||||
{
|
{
|
||||||
return "Call Of Duty: Black Ops";
|
static std::string fullName = "Call Of Duty: Black Ops";
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameT5::GetShortName()
|
const std::string& Game::GetShortName() const
|
||||||
{
|
{
|
||||||
return "T5";
|
static std::string shortName = "T5";
|
||||||
|
return shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameT5::AddZone(Zone* zone)
|
void Game::AddZone(Zone* zone)
|
||||||
{
|
{
|
||||||
m_zones.push_back(zone);
|
m_zones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameT5::RemoveZone(Zone* zone)
|
void Game::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::ranges::find(m_zones, zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
@ -36,12 +34,12 @@ void GameT5::RemoveZone(Zone* zone)
|
|||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Zone*> GameT5::GetZones()
|
const std::vector<Zone*>& Game::GetZones() const
|
||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GameLanguagePrefix>& GameT5::GetLanguagePrefixes()
|
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||||
{
|
{
|
||||||
static std::vector<GameLanguagePrefix> prefixes{
|
static std::vector<GameLanguagePrefix> prefixes{
|
||||||
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
class GameT5 final : public IGame
|
namespace T5
|
||||||
|
{
|
||||||
|
class Game final : public IGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameId GetId() override;
|
[[nodiscard]] GameId GetId() const override;
|
||||||
std::string GetFullName() override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
std::string GetShortName() override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
|
||||||
const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Zone*> m_zones;
|
std::vector<Zone*> m_zones;
|
||||||
};
|
};
|
||||||
|
} // namespace T5
|
||||||
extern GameT5 g_GameT5;
|
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
#include "GameT6.h"
|
#include "GameT6.h"
|
||||||
|
|
||||||
#include "T6.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
|
|
||||||
GameT6 g_GameT6;
|
GameId Game::GetId() const
|
||||||
|
|
||||||
GameId GameT6::GetId()
|
|
||||||
{
|
{
|
||||||
return GameId::T6;
|
return GameId::T6;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameT6::GetFullName()
|
const std::string& Game::GetFullName() const
|
||||||
{
|
{
|
||||||
return "Call Of Duty: Black Ops II";
|
static std::string fullName = "Call Of Duty: Black Ops II";
|
||||||
|
return fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameT6::GetShortName()
|
const std::string& Game::GetShortName() const
|
||||||
{
|
{
|
||||||
return "T6";
|
static std::string shortName = "T6";
|
||||||
|
return shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameT6::AddZone(Zone* zone)
|
void Game::AddZone(Zone* zone)
|
||||||
{
|
{
|
||||||
m_zones.push_back(zone);
|
m_zones.push_back(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameT6::RemoveZone(Zone* zone)
|
void Game::RemoveZone(Zone* zone)
|
||||||
{
|
{
|
||||||
const auto foundEntry = std::ranges::find(m_zones, zone);
|
const auto foundEntry = std::ranges::find(m_zones, zone);
|
||||||
|
|
||||||
@ -36,12 +34,12 @@ void GameT6::RemoveZone(Zone* zone)
|
|||||||
m_zones.erase(foundEntry);
|
m_zones.erase(foundEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Zone*> GameT6::GetZones()
|
const std::vector<Zone*>& Game::GetZones() const
|
||||||
{
|
{
|
||||||
return m_zones;
|
return m_zones;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<GameLanguagePrefix>& GameT6::GetLanguagePrefixes()
|
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
|
||||||
{
|
{
|
||||||
static std::vector<GameLanguagePrefix> prefixes{
|
static std::vector<GameLanguagePrefix> prefixes{
|
||||||
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
{GameLanguage::LANGUAGE_ENGLISH, "en_"},
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Game/IGame.h"
|
#include "Game/IGame.h"
|
||||||
|
|
||||||
class GameT6 final : public IGame
|
namespace T6
|
||||||
|
{
|
||||||
|
class Game final : public IGame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameId GetId() override;
|
[[nodiscard]] GameId GetId() const override;
|
||||||
std::string GetFullName() override;
|
[[nodiscard]] const std::string& GetFullName() const override;
|
||||||
std::string GetShortName() override;
|
[[nodiscard]] const std::string& GetShortName() const override;
|
||||||
void AddZone(Zone* zone) override;
|
void AddZone(Zone* zone) override;
|
||||||
void RemoveZone(Zone* zone) override;
|
void RemoveZone(Zone* zone) override;
|
||||||
std::vector<Zone*> GetZones() override;
|
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
|
||||||
const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() override;
|
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<Zone*> m_zones;
|
std::vector<Zone*> m_zones;
|
||||||
};
|
};
|
||||||
|
} // namespace T6
|
||||||
extern GameT6 g_GameT6;
|
|
||||||
|
@ -40,7 +40,7 @@ GameId ZoneCreator::GetGameId() const
|
|||||||
|
|
||||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||||
{
|
{
|
||||||
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW3);
|
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(GameId::IW3));
|
||||||
CreateZoneAssetPools(zone.get());
|
CreateZoneAssetPools(zone.get());
|
||||||
|
|
||||||
for (const auto& assetEntry : context.m_definition->m_assets)
|
for (const auto& assetEntry : context.m_definition->m_assets)
|
||||||
|
@ -39,7 +39,7 @@ GameId ZoneCreator::GetGameId() const
|
|||||||
|
|
||||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||||
{
|
{
|
||||||
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW4);
|
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(GameId::IW4));
|
||||||
CreateZoneAssetPools(zone.get());
|
CreateZoneAssetPools(zone.get());
|
||||||
|
|
||||||
for (const auto& assetEntry : context.m_definition->m_assets)
|
for (const auto& assetEntry : context.m_definition->m_assets)
|
||||||
|
@ -39,7 +39,7 @@ GameId ZoneCreator::GetGameId() const
|
|||||||
|
|
||||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||||
{
|
{
|
||||||
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameIW5);
|
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(GameId::IW5));
|
||||||
CreateZoneAssetPools(zone.get());
|
CreateZoneAssetPools(zone.get());
|
||||||
|
|
||||||
for (const auto& assetEntry : context.m_definition->m_assets)
|
for (const auto& assetEntry : context.m_definition->m_assets)
|
||||||
|
@ -40,7 +40,7 @@ GameId ZoneCreator::GetGameId() const
|
|||||||
|
|
||||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||||
{
|
{
|
||||||
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameT5);
|
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(GameId::T5));
|
||||||
CreateZoneAssetPools(zone.get());
|
CreateZoneAssetPools(zone.get());
|
||||||
|
|
||||||
for (const auto& assetEntry : context.m_definition->m_assets)
|
for (const auto& assetEntry : context.m_definition->m_assets)
|
||||||
|
@ -91,7 +91,7 @@ GameId ZoneCreator::GetGameId() const
|
|||||||
|
|
||||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||||
{
|
{
|
||||||
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, &g_GameT6);
|
auto zone = std::make_unique<Zone>(context.m_definition->m_name, 0, IGame::GetGameById(GameId::T6));
|
||||||
CreateZoneAssetPools(zone.get());
|
CreateZoneAssetPools(zone.get());
|
||||||
|
|
||||||
for (const auto& assetEntry : context.m_definition->m_assets)
|
for (const auto& assetEntry : context.m_definition->m_assets)
|
||||||
|
@ -288,7 +288,7 @@ namespace T6
|
|||||||
std::cout << std::format("Loading common ipaks for zone \"{}\"\n", zone.m_name);
|
std::cout << std::format("Loading common ipaks for zone \"{}\"\n", zone.m_name);
|
||||||
|
|
||||||
LoadIPakForZone(searchPath, "base", zone);
|
LoadIPakForZone(searchPath, "base", zone);
|
||||||
const auto languagePrefixes = g_GameT6.GetLanguagePrefixes();
|
const auto& languagePrefixes = IGame::GetGameById(GameId::T6)->GetLanguagePrefixes();
|
||||||
for (const auto& languagePrefix : languagePrefixes)
|
for (const auto& languagePrefix : languagePrefixes)
|
||||||
LoadIPakForZone(searchPath, std::format("{}base", languagePrefix.m_prefix), zone);
|
LoadIPakForZone(searchPath, std::format("{}base", languagePrefix.m_prefix), zone);
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ namespace IW5
|
|||||||
|
|
||||||
void MaterialConstantZoneState::ExtractNamesFromZoneInternal()
|
void MaterialConstantZoneState::ExtractNamesFromZoneInternal()
|
||||||
{
|
{
|
||||||
for (const auto* zone : g_GameIW5.GetZones())
|
for (const auto* zone : IGame::GetGameById(GameId::IW5)->GetZones())
|
||||||
{
|
{
|
||||||
const auto* iw5AssetPools = dynamic_cast<const GameAssetPoolIW5*>(zone->m_pools.get());
|
const auto* iw5AssetPools = dynamic_cast<const GameAssetPoolIW5*>(zone->m_pools.get());
|
||||||
if (!iw5AssetPools)
|
if (!iw5AssetPools)
|
||||||
|
@ -201,7 +201,7 @@ namespace
|
|||||||
public:
|
public:
|
||||||
void Initialize()
|
void Initialize()
|
||||||
{
|
{
|
||||||
for (const auto& zone : g_GameT6.GetZones())
|
for (const auto& zone : IGame::GetGameById(GameId::T6)->GetZones())
|
||||||
{
|
{
|
||||||
auto& sndBankPool = *dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get())->m_sound_bank;
|
auto& sndBankPool = *dynamic_cast<GameAssetPoolT6*>(zone->m_pools.get())->m_sound_bank;
|
||||||
for (auto* entry : sndBankPool)
|
for (auto* entry : sndBankPool)
|
||||||
|
@ -473,7 +473,7 @@ namespace T6
|
|||||||
|
|
||||||
void MaterialConstantZoneState::ExtractNamesFromZoneInternal()
|
void MaterialConstantZoneState::ExtractNamesFromZoneInternal()
|
||||||
{
|
{
|
||||||
for (const auto* zone : g_GameT6.GetZones())
|
for (const auto* zone : IGame::GetGameById(GameId::T6)->GetZones())
|
||||||
{
|
{
|
||||||
const auto* t6AssetPools = dynamic_cast<const GameAssetPoolT6*>(zone->m_pools.get());
|
const auto* t6AssetPools = dynamic_cast<const GameAssetPoolT6*>(zone->m_pools.get());
|
||||||
if (!t6AssetPools)
|
if (!t6AssetPools)
|
||||||
|
@ -47,7 +47,7 @@ namespace
|
|||||||
|
|
||||||
std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(Zone* zone) const
|
std::unique_ptr<ZoneWriter> ZoneWriterFactory::CreateWriter(Zone* zone) const
|
||||||
{
|
{
|
||||||
std::unique_ptr<ZoneWriter> writer;
|
auto writer = std::make_unique<ZoneWriter>();
|
||||||
|
|
||||||
SetupBlocks(*writer);
|
SetupBlocks(*writer);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace
|
|||||||
"test,data,lol\n"
|
"test,data,lol\n"
|
||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, &g_GameIW3);
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW3));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
AssetLoaderStringTable assetLoader;
|
||||||
|
@ -21,7 +21,7 @@ namespace
|
|||||||
"test,data,lol\n"
|
"test,data,lol\n"
|
||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, &g_GameIW4);
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW4));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
AssetLoaderStringTable assetLoader;
|
||||||
|
@ -28,7 +28,7 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
MenuParsingItHelper()
|
MenuParsingItHelper()
|
||||||
: m_zone("MockZone", 0, &g_GameIW4),
|
: m_zone("MockZone", 0, IGame::GetGameById(GameId::IW4)),
|
||||||
m_manager(m_zone, m_search_path)
|
m_manager(m_zone, m_search_path)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace
|
|||||||
"test,data,lol\n"
|
"test,data,lol\n"
|
||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, &g_GameIW5);
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW5));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
AssetLoaderStringTable assetLoader;
|
||||||
|
@ -20,7 +20,7 @@ namespace
|
|||||||
"test,data,lol\n"
|
"test,data,lol\n"
|
||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, &g_GameT5);
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T5));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
AssetLoaderStringTable assetLoader;
|
||||||
|
@ -20,7 +20,7 @@ namespace
|
|||||||
"test,data,lol\n"
|
"test,data,lol\n"
|
||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, &g_GameT6);
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T6));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
AssetLoaderStringTable assetLoader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user