Dependencies in basemaps

This commit is contained in:
momo5502 2016-11-01 18:06:51 +01:00
parent 1f4e59949f
commit 61b2b0c920
4 changed files with 37 additions and 4 deletions

2
deps/fmt vendored

@ -1 +1 @@
Subproject commit 8c63ea432c7985eb056f1457d7edc8574d4fa2f8
Subproject commit 8f455c10b0f1aee898f71313b21c43b098dadb34

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit b39e30fb0cbed1b91a205903fc6f8956a9e58c32
Subproject commit 78454da3b311892e7426794760525cbb2f729c0b

View File

@ -31,6 +31,7 @@ namespace Components
Utils::Memory::Allocator allocator;
auto teams = Maps::GetTeamsForMap(Maps::CurrentMainZone);
auto dependencies = Maps::GetDependenciesForMap(Maps::CurrentMainZone);
std::vector<Game::XZoneInfo> data;
Utils::Merge(&data, zoneInfo, zoneCount);
@ -45,6 +46,17 @@ namespace Components
team.name = allocator.DuplicateString(fmt::sprintf("iw4x_team_%s", teams.second.data()));
data.push_back(team);
for (auto& depdendency : dependencies)
{
Game::XZoneInfo info;
info.name = depdendency.data();
info.allocFlags = zoneInfo->allocFlags;
info.freeFlags = zoneInfo->freeFlags;
data.push_back(info);
}
for (unsigned int i = 0; i < Maps::CurrentDependencies.size(); ++i)
{
Game::XZoneInfo info;
@ -205,6 +217,26 @@ namespace Components
return (Utils::String::StartsWith(entity, "dyn_") || Utils::String::StartsWith(entity, "node_") || Utils::String::StartsWith(entity, "actor_"));
}
std::vector<std::string> Maps::GetDependenciesForMap(std::string map)
{
for (int i = 0; i < *Game::arenaCount; ++i)
{
Game::newMapArena_t* arena = &ArenaLength::NewArenas[i];
if (arena->mapName == map)
{
for (int j = 0; j < ARRAY_SIZE(arena->keys); ++j)
{
if (arena->keys[j] == "dependency"s)
{
return Utils::String::Explode(arena->values[j], ' ');
}
}
}
}
return {};
}
std::pair<std::string, std::string> Maps::GetTeamsForMap(std::string map)
{
std::string team_axis = "opforce_composite";
@ -525,8 +557,8 @@ namespace Components
//Maps::AddDependency("oilrig", "mp_subbase");
//Maps::AddDependency("gulag", "mp_subbase");
//Maps::AddDependency("invasion", "mp_rust");
Maps::AddDependency("co_hunted", "mp_storm");
Maps::AddDependency("mp_shipment", "mp_shipment_long");
//Maps::AddDependency("co_hunted", "mp_storm");
//Maps::AddDependency("mp_shipment", "mp_shipment_long");
#if defined(DEBUG) && defined(ENABLE_DXSDK)
Command::Add("dumpmap", [] (Command::Params)

View File

@ -14,6 +14,7 @@ namespace Components
static void AddDependency(std::string expression, std::string zone);
static std::pair<std::string, std::string> GetTeamsForMap(std::string map);
static std::vector<std::string> GetDependenciesForMap(std::string map);
static std::string CurrentMainZone;