diff --git a/CREDITS.md b/CREDITS.md index 599ca1b29a..99c88d4b7f 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -630,7 +630,7 @@ This page lists all the individual contributions to the project by their author. - **E1 Elite** - TileSet 255 and above bridge repair fix - **AutoGavy** - interceptor logic, Warhead critical hit logic - **Chasheen (Chasheenburg)** - CN docs help for Build#24 -- **Noble Fish** - some minor fixes, established Community Chinese docs, took over and completely rewrite the Official Chinese docs during Build#46 +- **Noble Fish** - some minor improvements and fixes, established Community Chinese docs, took over and completely rewrite the Official Chinese docs during Build#46 - **tomsons26** - all-around help, assistance and guidance in reverse-engineering, YR binary mappings - **CCHyper** - all-around help, current project logo, assistance and guidance in reverse-engineering, YR binary mappings, custom locomotors example implementation - **AlexB** - Original FlyingStrings implementation diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 432a86fe92..20d05e53c9 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -854,6 +854,7 @@ Phobos fixes: - Fixed `AltNextScenario` not taking effect (by FlyStar) - Fixed `DefaultDisguise` showing wrong house colors for different players (by NetsuNegi & Ollerus) - `600 The shield of the attached object is broken` bug fix for the triggered event (by FlyStar) +- Fixed a read bug when setting the SHP file name in INI (By Noble_Fish) Fixes / interactions with other extensions: - Weapons fired by EMPulse superweapons *(Ares feature)* now fully respect the firing building's FLH (by Starkku) diff --git a/src/Utilities/Constructs.cpp b/src/Utilities/Constructs.cpp index 7efa8f76e7..bb0e7a7889 100644 --- a/src/Utilities/Constructs.cpp +++ b/src/Utilities/Constructs.cpp @@ -261,7 +261,7 @@ bool TheaterSpecificSHP::Read(INI_EX& parser, const char* pSection, const char* GeneralUtils::ApplyTheaterSuffixToString(pValue); std::string Result = pValue; - if (!strstr(pValue, ".shp")) + if (Result.size() < 4 || !std::equal(Result.end() - 4, Result.end(), ".shp", [](char input, char expected) { return std::tolower(input) == expected; })) Result += ".shp"; if (auto const pImage = FileSystem::LoadSHPFile(Result.c_str())) diff --git a/src/Utilities/TemplateDef.h b/src/Utilities/TemplateDef.h index 6bdf3db00e..89602c26e8 100644 --- a/src/Utilities/TemplateDef.h +++ b/src/Utilities/TemplateDef.h @@ -335,7 +335,7 @@ namespace detail auto const pValue = parser.value(); std::string Result = pValue; - if (!strstr(pValue, ".shp")) + if (Result.size() < 4 || !std::equal(Result.end() - 4, Result.end(), ".shp", [](char input, char expected) { return std::tolower(input) == expected; })) Result += ".shp"; if (auto const pImage = FileSystem::LoadSHPFile(Result.c_str()))