comparison Chest.cpp @ 1583:75fafd8ced59

Allocator (CMemory) bye-bye
author Nomad
date Tue, 10 Sep 2013 21:07:07 +0200
parents c4ab816fcc5e
children 4da5644df18f
comparison
equal deleted inserted replaced
1577:1b6217e07b26 1583:75fafd8ced59
6 6
7 #include "BSPModel.h" 7 #include "BSPModel.h"
8 #include "Items.h" 8 #include "Items.h"
9 #include "Chest.h" 9 #include "Chest.h"
10 #include "FrameTableInc.h" 10 #include "FrameTableInc.h"
11 #include "Allocator.h"
12 #include "LOD.h" 11 #include "LOD.h"
13 #include "MapInfo.h" 12 #include "MapInfo.h"
14 #include "Actor.h" 13 #include "Actor.h"
15 #include "Outdoor.h" 14 #include "Outdoor.h"
16 #include "DecorationList.h" 15 #include "DecorationList.h"
633 632
634 uNumChests = num_mm6_chests + num_mm7_chests + num_mm8_chests; 633 uNumChests = num_mm6_chests + num_mm7_chests + num_mm8_chests;
635 assert(uNumChests); 634 assert(uNumChests);
636 assert(!num_mm8_chests); 635 assert(!num_mm8_chests);
637 636
638 pChests = (ChestDesc *)pAllocator->AllocNamedChunk(pChests, uNumChests * sizeof(ChestDesc), "Chest Descrip"); 637 pChests = (ChestDesc *)malloc(uNumChests * sizeof(ChestDesc));
639 memcpy(pChests, (char *)data_mm7 + 4, num_mm7_chests * sizeof(ChestDesc)); 638 memcpy(pChests, (char *)data_mm7 + 4, num_mm7_chests * sizeof(ChestDesc));
640 memcpy(pChests + num_mm7_chests, (char *)data_mm6 + 4, num_mm6_chests * sizeof(ChestDesc)); 639 memcpy(pChests + num_mm7_chests, (char *)data_mm6 + 4, num_mm6_chests * sizeof(ChestDesc));
641 memcpy(pChests + num_mm6_chests + num_mm7_chests, (char *)data_mm8 + 4, num_mm8_chests * sizeof(ChestDesc)); 640 memcpy(pChests + num_mm6_chests + num_mm7_chests, (char *)data_mm8 + 4, num_mm8_chests * sizeof(ChestDesc));
642 } 641 }
643 642
662 FrameTableTxtLine v17; // [sp+278h] [bp-80h]@4 661 FrameTableTxtLine v17; // [sp+278h] [bp-80h]@4
663 FILE *File; // [sp+2F4h] [bp-4h]@1 662 FILE *File; // [sp+2F4h] [bp-4h]@1
664 unsigned int Argsa; // [sp+300h] [bp+8h]@3 663 unsigned int Argsa; // [sp+300h] [bp+8h]@3
665 664
666 v2 = this; 665 v2 = this;
667 pAllocator->FreeChunk(this->pChests); 666 free(this->pChests);
668 v3 = 0; 667 v3 = 0;
669 v2->pChests = 0; 668 v2->pChests = 0;
670 v2->uNumChests = 0; 669 v2->uNumChests = 0;
671 v4 = fopen(Args, "r"); 670 v4 = fopen(Args, "r");
672 File = v4; 671 File = v4;
688 v5 = Argsa; 687 v5 = Argsa;
689 v3 = 0; 688 v3 = 0;
690 } 689 }
691 v6 = v2->pChests; 690 v6 = v2->pChests;
692 v2->uNumChests = v5; 691 v2->uNumChests = v5;
693 v7 = pAllocator->AllocNamedChunk(v6, 36 * v5, "Chest Descrip"); 692 v7 = malloc(36 * v5);
694 v2->pChests = (ChestDesc *)v7; 693 v2->pChests = (ChestDesc *)v7;
695 if ( v7 == (void *)v3 ) 694 if ( v7 == (void *)v3 )
696 Error("ChestDescriptionList::load - Out of Memory!"); 695 Error("ChestDescriptionList::load - Out of Memory!");
697 696
698 memset(v7, v3, 36 * v2->uNumChests); 697 memset(v7, v3, 36 * v2->uNumChests);