diff --git a/src/Common/Game/T6/T6_Assets.h b/src/Common/Game/T6/T6_Assets.h index e2332161..ba366b11 100644 --- a/src/Common/Game/T6/T6_Assets.h +++ b/src/Common/Game/T6/T6_Assets.h @@ -1942,7 +1942,7 @@ namespace T6 int columnCount; int rowCount; StringTableCell* values; - int16_t* cellIndex; + uint16_t* cellIndex; }; enum LbUpdateType diff --git a/src/ObjLoading/StringTable/StringTableLoader.h b/src/ObjLoading/StringTable/StringTableLoader.h index 991f98ec..f5fd0b3e 100644 --- a/src/ObjLoading/StringTable/StringTableLoader.h +++ b/src/ObjLoading/StringTable/StringTableLoader.h @@ -112,7 +112,8 @@ namespace string_table template class StringTableLoaderV3 final : public AbstractStringTableLoader> { - using CellType_t = decltype(*StringTableType::values); + using CellType_t = std::remove_pointer_t; + using CellIndexType_t = std::remove_pointer_t; protected: void SetCellContent(CellType_t& cell, const char* content) override @@ -129,13 +130,13 @@ namespace string_table return; } - stringTable->cellIndex = memory.Alloc(cellCount); + stringTable->cellIndex = memory.Alloc(cellCount); for (auto i = 0u; i < cellCount; i++) - stringTable->cellIndex[i] = i; + stringTable->cellIndex[i] = static_cast(i); std::sort(&stringTable->cellIndex[0], - &stringTable->cellIndex[cellCount - 1], - [stringTable](const int16_t a, const int16_t b) + &stringTable->cellIndex[cellCount], + [stringTable](const CellIndexType_t a, const CellIndexType_t b) { auto compareResult = stringTable->values[a].hash - stringTable->values[b].hash; if (compareResult == 0) diff --git a/test/ObjLoadingTests/Game/T5/AssetLoaders/LoaderStringTableT5Test.cpp b/test/ObjLoadingTests/Game/T5/AssetLoaders/LoaderStringTableT5Test.cpp index b86f889a..8dca092f 100644 --- a/test/ObjLoadingTests/Game/T5/AssetLoaders/LoaderStringTableT5Test.cpp +++ b/test/ObjLoadingTests/Game/T5/AssetLoaders/LoaderStringTableT5Test.cpp @@ -51,10 +51,11 @@ namespace CHECK(stringTable->values[5].hash == 0x1505); REQUIRE(stringTable->cellIndex != nullptr); - CHECK(stringTable->cellIndex[0] == 2); - CHECK(stringTable->cellIndex[1] == 4); - CHECK(stringTable->cellIndex[2] == 3); - CHECK(stringTable->cellIndex[3] == 1); - CHECK(stringTable->cellIndex[4] == 0); + CHECK(stringTable->cellIndex[0] == 5); + CHECK(stringTable->cellIndex[1] == 2); + CHECK(stringTable->cellIndex[2] == 4); + CHECK(stringTable->cellIndex[3] == 3); + CHECK(stringTable->cellIndex[4] == 1); + CHECK(stringTable->cellIndex[5] == 0); } } // namespace diff --git a/test/ObjLoadingTests/Game/T6/AssetLoaders/LoaderStringTableT6Test.cpp b/test/ObjLoadingTests/Game/T6/AssetLoaders/LoaderStringTableT6Test.cpp index c6a9186f..87004412 100644 --- a/test/ObjLoadingTests/Game/T6/AssetLoaders/LoaderStringTableT6Test.cpp +++ b/test/ObjLoadingTests/Game/T6/AssetLoaders/LoaderStringTableT6Test.cpp @@ -51,10 +51,11 @@ namespace CHECK(stringTable->values[5].hash == 0x1505); REQUIRE(stringTable->cellIndex != nullptr); - CHECK(stringTable->cellIndex[0] == 2); - CHECK(stringTable->cellIndex[1] == 4); - CHECK(stringTable->cellIndex[2] == 3); - CHECK(stringTable->cellIndex[3] == 1); - CHECK(stringTable->cellIndex[4] == 0); + CHECK(stringTable->cellIndex[0] == 5); + CHECK(stringTable->cellIndex[1] == 2); + CHECK(stringTable->cellIndex[2] == 4); + CHECK(stringTable->cellIndex[3] == 3); + CHECK(stringTable->cellIndex[4] == 1); + CHECK(stringTable->cellIndex[5] == 0); } } // namespace