Fix ent string

This commit is contained in:
FutureRave 2022-01-30 14:03:13 +00:00
parent 18dca4506f
commit 43696dd6fb
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955

View File

@ -206,8 +206,16 @@ namespace Components
if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end() if (std::find(Maps::CurrentDependencies.begin(), Maps::CurrentDependencies.end(), FastFiles::Current()) != Maps::CurrentDependencies.end()
&& (FastFiles::Current() != "mp_shipment_long" || Maps::CurrentMainZone != "mp_shipment")) // Shipment is a special case && (FastFiles::Current() != "mp_shipment_long" || Maps::CurrentMainZone != "mp_shipment")) // Shipment is a special case
{ {
if (type == Game::XAssetType::ASSET_TYPE_CLIPMAP_MP || type == Game::XAssetType::ASSET_TYPE_CLIPMAP_SP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP || type == Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP || type == Game::XAssetType::ASSET_TYPE_GFXWORLD || type == Game::XAssetType::ASSET_TYPE_MAP_ENTS || type == Game::XAssetType::ASSET_TYPE_COMWORLD || type == Game::XAssetType::ASSET_TYPE_FXWORLD) switch (type)
{ {
case Game::XAssetType::ASSET_TYPE_CLIPMAP_MP:
case Game::XAssetType::ASSET_TYPE_CLIPMAP_SP:
case Game::XAssetType::ASSET_TYPE_GAMEWORLD_SP:
case Game::XAssetType::ASSET_TYPE_GAMEWORLD_MP:
case Game::XAssetType::ASSET_TYPE_GFXWORLD:
case Game::XAssetType::ASSET_TYPE_MAP_ENTS:
case Game::XAssetType::ASSET_TYPE_COMWORLD:
case Game::XAssetType::ASSET_TYPE_FXWORLD:
*restrict = true; *restrict = true;
return; return;
} }
@ -247,7 +255,7 @@ namespace Components
FileSystem::File ents(name + ".ents"); FileSystem::File ents(name + ".ents");
if (ents.exists()) if (ents.exists())
{ {
const auto& mapEntities = ents.getBuffer(); static auto mapEntities = ents.getBuffer();
asset.mapEnts->entityString = const_cast<char*>(mapEntities.data()); asset.mapEnts->entityString = const_cast<char*>(mapEntities.data());
asset.mapEnts->numEntityChars = mapEntities.size() + 1; asset.mapEnts->numEntityChars = mapEntities.size() + 1;
} }
@ -317,7 +325,7 @@ namespace Components
mapname = "mp_shipment_long"; mapname = "mp_shipment_long";
} }
_snprintf_s(buffer, size, size, format, mapname); _snprintf_s(buffer, size, _TRUNCATE, format, mapname);
} }
void Maps::HandleAsSPMap() void Maps::HandleAsSPMap()
@ -327,12 +335,12 @@ namespace Components
void Maps::AddDependency(const std::string& expression, const std::string& zone) void Maps::AddDependency(const std::string& expression, const std::string& zone)
{ {
// Test expression before adding it // Test expression before adding it, throws implementation defined exceptions
try try
{ {
std::regex _(expression); std::regex _(expression);
} }
catch (const std::exception e) catch (const std::exception ex)
{ {
MessageBoxA(nullptr, Utils::String::VA("Invalid regular expression: %s", expression.data()), "Warning", MB_ICONEXCLAMATION); MessageBoxA(nullptr, Utils::String::VA("Invalid regular expression: %s", expression.data()), "Warning", MB_ICONEXCLAMATION);
return; return;
@ -438,7 +446,7 @@ namespace Components
void Maps::LoadNewMapCommand(char* buffer, size_t size, const char* /*format*/, const char* mapname, const char* gametype) void Maps::LoadNewMapCommand(char* buffer, size_t size, const char* /*format*/, const char* mapname, const char* gametype)
{ {
unsigned int hash = Maps::GetUsermapHash(mapname); unsigned int hash = Maps::GetUsermapHash(mapname);
_snprintf_s(buffer, size, size, "loadingnewmap\n%s\n%s\n%d", mapname, gametype, hash); _snprintf_s(buffer, size, _TRUNCATE, "loadingnewmap\n%s\n%s\n%d", mapname, gametype, hash);
} }
int Maps::TriggerReconnectForMap(Game::msg_t* msg, const char* mapname) int Maps::TriggerReconnectForMap(Game::msg_t* msg, const char* mapname)