changeset 2258:01d7e9ec51e6

sub_410D99_get_map_index cleaned up
author Grumpy7
date Mon, 03 Mar 2014 23:49:23 +0100
parents 8878fba164fd
children 43a508455445
files mm7_5.cpp mm7_unsorted_subs.h
diffstat 2 files changed, 7 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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();