Mercurial > mm7
comparison Items.cpp @ 1583:75fafd8ced59
Allocator (CMemory) bye-bye
author | Nomad |
---|---|
date | Tue, 10 Sep 2013 21:07:07 +0200 |
parents | 9f8b3e904e14 |
children | c58916c53d8e |
comparison
equal
deleted
inserted
replaced
1577:1b6217e07b26 | 1583:75fafd8ced59 |
---|---|
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "Items.h" | 7 #include "Items.h" |
8 #include "MapInfo.h" | 8 #include "MapInfo.h" |
9 #include "Allocator.h" | |
10 #include "GUIWindow.h" | 9 #include "GUIWindow.h" |
11 #include "Events2D.h" | 10 #include "Events2D.h" |
12 #include "Chest.h" | 11 #include "Chest.h" |
13 #include "LOD.h" | 12 #include "LOD.h" |
14 #include "Monsters.h" | 13 #include "Monsters.h" |
279 | 278 |
280 //----- (0045814E) -------------------------------------------------------- | 279 //----- (0045814E) -------------------------------------------------------- |
281 void ItemsTable::Release() | 280 void ItemsTable::Release() |
282 { | 281 { |
283 if ( pMonstersTXT_Raw ) | 282 if ( pMonstersTXT_Raw ) |
284 pAllocator->FreeChunk(pMonstersTXT_Raw); | 283 free(pMonstersTXT_Raw); |
285 if ( pMonsterPlacementTXT_Raw ) | 284 if ( pMonsterPlacementTXT_Raw ) |
286 pAllocator->FreeChunk(pMonsterPlacementTXT_Raw); | 285 free(pMonsterPlacementTXT_Raw); |
287 if ( pSkillDescTXT_Raw ) | 286 if ( pSkillDescTXT_Raw ) |
288 pAllocator->FreeChunk(pSkillDescTXT_Raw); | 287 free(pSkillDescTXT_Raw); |
289 if (pSpcItemsTXT_Raw ) | 288 if (pSpcItemsTXT_Raw ) |
290 pAllocator->FreeChunk(pSpcItemsTXT_Raw); | 289 free(pSpcItemsTXT_Raw); |
291 if ( pStdItemsTXT_Raw ) | 290 if ( pStdItemsTXT_Raw ) |
292 pAllocator->FreeChunk(pStdItemsTXT_Raw); | 291 free(pStdItemsTXT_Raw); |
293 if ( pRndItemsTXT_Raw ) | 292 if ( pRndItemsTXT_Raw ) |
294 pAllocator->FreeChunk(pRndItemsTXT_Raw); | 293 free(pRndItemsTXT_Raw); |
295 if ( pItemsTXT_Raw ) | 294 if ( pItemsTXT_Raw ) |
296 pAllocator->FreeChunk(pItemsTXT_Raw); | 295 free(pItemsTXT_Raw); |
297 if ( pHostileTXT_Raw ) | 296 if ( pHostileTXT_Raw ) |
298 pAllocator->FreeChunk(pHostileTXT_Raw); | 297 free(pHostileTXT_Raw); |
299 if ( pHistoryTXT_Raw ) | 298 if ( pHistoryTXT_Raw ) |
300 pAllocator->FreeChunk(pHistoryTXT_Raw); | 299 free(pHistoryTXT_Raw); |
301 if ( pPotionsTXT_Raw ) | 300 if ( pPotionsTXT_Raw ) |
302 pAllocator->FreeChunk(pPotionsTXT_Raw); | 301 free(pPotionsTXT_Raw); |
303 if ( pPotionNotesTXT_Raw ) | 302 if ( pPotionNotesTXT_Raw ) |
304 pAllocator->FreeChunk(pPotionNotesTXT_Raw); | 303 free(pPotionNotesTXT_Raw); |
305 pSpcItemsTXT_Raw = NULL; | 304 pSpcItemsTXT_Raw = NULL; |
306 pSkillDescTXT_Raw = NULL; | 305 pSkillDescTXT_Raw = NULL; |
307 pStdItemsTXT_Raw = NULL; | 306 pStdItemsTXT_Raw = NULL; |
308 pRndItemsTXT_Raw = NULL; | 307 pRndItemsTXT_Raw = NULL; |
309 pItemsTXT_Raw = NULL; | 308 pItemsTXT_Raw = NULL; |
1048 } while ((decode_step<8)&&!break_loop); | 1047 } while ((decode_step<8)&&!break_loop); |
1049 } | 1048 } |
1050 | 1049 |
1051 if ( pRndItemsTXT_Raw ) | 1050 if ( pRndItemsTXT_Raw ) |
1052 { | 1051 { |
1053 pAllocator->FreeChunk(pRndItemsTXT_Raw); | 1052 free(pRndItemsTXT_Raw); |
1054 pRndItemsTXT_Raw = NULL; | 1053 pRndItemsTXT_Raw = NULL; |
1055 } | 1054 } |
1056 | 1055 |
1057 pSkillDescTXT_Raw = NULL; | 1056 pSkillDescTXT_Raw = NULL; |
1058 pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); | 1057 pSkillDescTXT_Raw = (char *)pEvents_LOD->LoadRaw("skilldes.txt", 0); |
1283 unsigned int uRow; | 1282 unsigned int uRow; |
1284 unsigned int uColumn; | 1283 unsigned int uColumn; |
1285 unsigned __int8 potion_value; | 1284 unsigned __int8 potion_value; |
1286 | 1285 |
1287 if ( pPotionsTXT_Raw ) | 1286 if ( pPotionsTXT_Raw ) |
1288 pAllocator->FreeChunk(pPotionsTXT_Raw); | 1287 free(pPotionsTXT_Raw); |
1289 pPotionsTXT_Raw = NULL; | 1288 pPotionsTXT_Raw = NULL; |
1290 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); | 1289 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); |
1291 test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); | 1290 test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); |
1292 while ( 1 ) | 1291 while ( 1 ) |
1293 { | 1292 { |
1350 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); | 1349 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); |
1351 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); | 1350 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); |
1352 } | 1351 } |
1353 if ( pPotionsTXT_Raw ) | 1352 if ( pPotionsTXT_Raw ) |
1354 { | 1353 { |
1355 pAllocator->FreeChunk(pPotionsTXT_Raw); | 1354 free(pPotionsTXT_Raw); |
1356 pPotionsTXT_Raw = 0; | 1355 pPotionsTXT_Raw = 0; |
1357 } | 1356 } |
1358 } | 1357 } |
1359 | 1358 |
1360 //----- (00453CE5) -------------------------------------------------------- | 1359 //----- (00453CE5) -------------------------------------------------------- |
1366 unsigned int uRow; | 1365 unsigned int uRow; |
1367 unsigned int uColumn; | 1366 unsigned int uColumn; |
1368 unsigned __int8 potion_note; | 1367 unsigned __int8 potion_note; |
1369 | 1368 |
1370 if ( pPotionNotesTXT_Raw ) | 1369 if ( pPotionNotesTXT_Raw ) |
1371 pAllocator->FreeChunk(pPotionNotesTXT_Raw); | 1370 free(pPotionNotesTXT_Raw); |
1372 pPotionNotesTXT_Raw = NULL; | 1371 pPotionNotesTXT_Raw = NULL; |
1373 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); | 1372 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); |
1374 test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); | 1373 test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); |
1375 while ( 1 ) | 1374 while ( 1 ) |
1376 { | 1375 { |
1597 int a2b; // [sp+CA4h] [bp+10h]@101 | 1596 int a2b; // [sp+CA4h] [bp+10h]@101 |
1598 int a2c; // [sp+CA4h] [bp+10h]@120 | 1597 int a2c; // [sp+CA4h] [bp+10h]@120 |
1599 | 1598 |
1600 v5 = this; | 1599 v5 = this; |
1601 if (!out_item) | 1600 if (!out_item) |
1602 out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); | 1601 out_item = (ItemGen *)malloc(sizeof(ItemGen)); |
1603 memset(out_item, 0, sizeof(*out_item)); | 1602 memset(out_item, 0, sizeof(*out_item)); |
1604 | 1603 |
1605 | 1604 |
1606 v6 = treasure_level - 1; | 1605 v6 = treasure_level - 1; |
1607 v54 = treasure_level - 1; | 1606 v54 = treasure_level - 1; |