diff TileTable.cpp @ 1477:7ef4b64f6329

* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load Added support for most of mm6 resources, placeholders for mm8 resources. Fixed few C4258
author Nomad
date Wed, 28 Aug 2013 18:43:07 +0200
parents 29a8defbad9e
children c4ab816fcc5e
line wrap: on
line diff
--- a/TileTable.cpp	Wed Aug 28 14:39:01 2013 +0600
+++ b/TileTable.cpp	Wed Aug 28 18:43:07 2013 +0200
@@ -119,11 +119,19 @@
 }
 
 //----- (00488000) --------------------------------------------------------
-void TileTable::FromFile(void *pSerialized)
+void TileTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
 {
-  sNumTiles = *(int *)pSerialized;
-  pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sizeof(TileDesc) * sNumTiles, "Tile Descrip");
-  memcpy(pTiles, (char *)pSerialized + 4, sizeof(TileDesc) * sNumTiles);
+  uint num_mm6_tiles = data_mm6 ? *(int *)data_mm6 : 0,
+       num_mm7_tiles = data_mm7 ? *(int *)data_mm7 : 0,
+       num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0;
+  sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles;
+  assert(sNumTiles);
+  assert(!num_mm8_tiles);
+
+  pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip");
+  memcpy(pTiles,                                 (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc));
+  memcpy(pTiles + num_mm7_tiles,                 (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc));
+  memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc));
 }
 
 //----- (00488047) --------------------------------------------------------