comparison 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
comparison
equal deleted inserted replaced
1475:d7720c1f1d3b 1477:7ef4b64f6329
117 fwrite(v1->pTiles, 0x1Au, v1->sNumTiles, v3); 117 fwrite(v1->pTiles, 0x1Au, v1->sNumTiles, v3);
118 fclose(v3); 118 fclose(v3);
119 } 119 }
120 120
121 //----- (00488000) -------------------------------------------------------- 121 //----- (00488000) --------------------------------------------------------
122 void TileTable::FromFile(void *pSerialized) 122 void TileTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
123 { 123 {
124 sNumTiles = *(int *)pSerialized; 124 uint num_mm6_tiles = data_mm6 ? *(int *)data_mm6 : 0,
125 pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sizeof(TileDesc) * sNumTiles, "Tile Descrip"); 125 num_mm7_tiles = data_mm7 ? *(int *)data_mm7 : 0,
126 memcpy(pTiles, (char *)pSerialized + 4, sizeof(TileDesc) * sNumTiles); 126 num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0;
127 sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles;
128 assert(sNumTiles);
129 assert(!num_mm8_tiles);
130
131 pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip");
132 memcpy(pTiles, (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc));
133 memcpy(pTiles + num_mm7_tiles, (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc));
134 memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc));
127 } 135 }
128 136
129 //----- (00488047) -------------------------------------------------------- 137 //----- (00488047) --------------------------------------------------------
130 int TileTable::FromFileTxt(const char *pFilename) 138 int TileTable::FromFileTxt(const char *pFilename)
131 { 139 {