Fix gametype stuff
This commit is contained in:
parent
b606983835
commit
b53f5bdf53
@ -28,7 +28,7 @@ namespace Components
|
|||||||
Dvar::Var("g_gametype").Set(gametype);
|
Dvar::Var("g_gametype").Set(gametype);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Gametypes::BuildGametypeList(const char*, void* buffer, size_t size)
|
void* Gametypes::BuildGametypeList(const char*, void* buffer, size_t size)
|
||||||
{
|
{
|
||||||
std::vector<std::string> gametypes;
|
std::vector<std::string> gametypes;
|
||||||
|
|
||||||
@ -77,15 +77,18 @@ namespace Components
|
|||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
for (auto& gametype : gametypes)
|
for (auto& gametype : gametypes)
|
||||||
|
{
|
||||||
|
if (Game::LoadModdableRawfile(0, Utils::String::VA("maps/mp/gametypes/%s.txt", gametype.data())))
|
||||||
{
|
{
|
||||||
data.append(gametype);
|
data.append(gametype);
|
||||||
data.append("\n");
|
data.append("\r\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy to the actual buffer
|
// Copy to the actual buffer
|
||||||
std::memcpy(buffer, data.data(), std::min(size, data.size()));
|
std::memcpy(buffer, data.data(), std::min(size, data.size() + 1));
|
||||||
|
|
||||||
return (!gametypes.empty());
|
return (data.empty() ? nullptr : buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gametypes::Gametypes()
|
Gametypes::Gametypes()
|
||||||
|
@ -14,6 +14,6 @@ namespace Components
|
|||||||
static const char* GetGametypeText(unsigned int index, int column);
|
static const char* GetGametypeText(unsigned int index, int column);
|
||||||
static void SelectGametype(unsigned int index);
|
static void SelectGametype(unsigned int index);
|
||||||
|
|
||||||
static bool BuildGametypeList(const char* file, void* buffer, size_t size);
|
static void* BuildGametypeList(const char* file, void* buffer, size_t size);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -399,11 +399,11 @@ namespace Components
|
|||||||
|
|
||||||
Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp");
|
Maps::AddDependency("mp_bloc_sh", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp");
|
Maps::AddDependency("mp_cargoship_sh", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
|
//Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp");
|
//Maps::AddDependency("mp_shipment_long", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
|
//Maps::AddDependency("mp_firingrange", "iw4x_dependencies_mp");
|
||||||
Maps::AddDependency("mp_firingrange", "mp_underpass");
|
//Maps::AddDependency("mp_firingrange", "mp_underpass");
|
||||||
Maps::AddDependency("mp_underpass", "mp_firingrange");
|
//Maps::AddDependency("mp_underpass", "mp_firingrange");
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||||
Command::Add("dumpmap", [] (Command::Params)
|
Command::Add("dumpmap", [] (Command::Params)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user