# HG changeset patch # User Grumpy7 # Date 1393886963 -3600 # Node ID 01d7e9ec51e67e2cdaa20125d93e0b52671d90f4 # Parent 8878fba164fde9eec9d4c65a3231e1c9422a37e9 sub_410D99_get_map_index cleaned up diff -r 8878fba164fd -r 01d7e9ec51e6 mm7_5.cpp --- a/mm7_5.cpp Thu Feb 27 00:36:31 2014 +0100 +++ b/mm7_5.cpp Mon Mar 03 23:49:23 2014 +0100 @@ -1061,31 +1061,15 @@ } //----- (00410D99) -------------------------------------------------------- -int __fastcall sub_410D99_get_map_index(int a1) +int sub_410D99_get_map_index(int a1) { - int v1; // edi@1 - signed int v2; // ebp@1 - const char **v3; // esi@2 - char *v4; // ebx@2 - - __debugbreak();//Ritor1 - v1 = a1; - v2 = 1; - if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) + for (int i = 1; i <= pMapStats->uNumMaps; i++) { - v3 = (const char **)&pMapStats->pInfos[1].pFilename; - v4 = (char *)&pMapStats->pInfos[1].pFilename; - do - { - if ( !*(int *)v4 ) - break; - v3 += 17; - ++v2; - v4 = (char *)v3; - } - while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); + if (_stricmp(pMapStats->pInfos[i].pFilename, pGames_LOD->pSubIndices[a1].pFilename) ) + return i; } - return v2; + Error("Map not found"); + return -1; } // 4E28F8: using guessed type int pCurrentScreen; diff -r 8878fba164fd -r 01d7e9ec51e6 mm7_unsorted_subs.h --- a/mm7_unsorted_subs.h Thu Feb 27 00:36:31 2014 +0100 +++ b/mm7_unsorted_subs.h Mon Mar 03 23:49:23 2014 +0100 @@ -37,7 +37,7 @@ void __fastcall ZBuffer_DoFill(int *pZBuffer, struct Texture *pTex, int uZValue); void __fastcall ZBuffer_DoFill2(int *pZBuffer, struct Texture *a2, int a3); // idb void SetMoonPhaseNames(); -int __fastcall sub_410D99_get_map_index(int a1); +int sub_410D99_get_map_index(int a1); void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer); void SetAttributeNames(); void uGameUIFontMain_initialize();