2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-10-26 16:25:51 +00:00

refactor: only refer to game id in zone

This commit is contained in:
Jan Laupetin
2025-08-30 16:49:09 +02:00
parent 495e85f945
commit 734173066b
56 changed files with 145 additions and 193 deletions

View File

@@ -1,11 +1,10 @@
#pragma once
#include "GameLanguage.h"
#include <type_traits>
#include <vector>
class Zone;
enum class GameId
{
IW3,
@@ -39,9 +38,6 @@ public:
[[nodiscard]] virtual GameId GetId() const = 0;
[[nodiscard]] virtual const std::string& GetFullName() const = 0;
[[nodiscard]] virtual const std::string& GetShortName() const = 0;
virtual void AddZone(Zone* zone) = 0;
virtual void RemoveZone(Zone* zone) = 0;
[[nodiscard]] virtual const std::vector<Zone*>& GetZones() const = 0;
[[nodiscard]] virtual const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const = 0;
static IGame* GetGameById(GameId gameId);

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW3
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW3

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW4
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW4

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes;

View File

@@ -9,12 +9,6 @@ namespace IW5
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace IW5

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes{

View File

@@ -9,12 +9,6 @@ namespace T5
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace T5

View File

@@ -21,24 +21,6 @@ const std::string& Game::GetShortName() const
return shortName;
}
void Game::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void Game::RemoveZone(Zone* zone)
{
const auto foundEntry = std::ranges::find(m_zones, zone);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}
const std::vector<Zone*>& Game::GetZones() const
{
return m_zones;
}
const std::vector<GameLanguagePrefix>& Game::GetLanguagePrefixes() const
{
static std::vector<GameLanguagePrefix> prefixes{

View File

@@ -9,12 +9,6 @@ namespace T6
[[nodiscard]] GameId GetId() const override;
[[nodiscard]] const std::string& GetFullName() const override;
[[nodiscard]] const std::string& GetShortName() const override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
[[nodiscard]] const std::vector<Zone*>& GetZones() const override;
[[nodiscard]] const std::vector<GameLanguagePrefix>& GetLanguagePrefixes() const override;
private:
std::vector<Zone*> m_zones;
};
} // namespace T6