Mercurial > mm7
comparison Chest.cpp @ 1545:c4ab816fcc5e
assert, Abortf, AbortWithError -> Assert, Error
refactors here and there
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 20:05:20 +0200 |
parents | 7ef4b64f6329 |
children | 75fafd8ced59 |
comparison
equal
deleted
inserted
replaced
1544:499761153844 | 1545:c4ab816fcc5e |
---|---|
1 #ifdef _MSC_VER | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | 2 #define _CRT_SECURE_NO_WARNINGS |
3 #endif | 3 #endif |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <assert.h> | |
7 | 6 |
8 #include "BSPModel.h" | 7 #include "BSPModel.h" |
9 #include "Items.h" | 8 #include "Items.h" |
10 #include "Chest.h" | 9 #include "Chest.h" |
11 #include "FrameTableInc.h" | 10 #include "FrameTableInc.h" |
615 | 614 |
616 v1 = this; | 615 v1 = this; |
617 v2 = fopen("data\\dchest.bin", "wb"); | 616 v2 = fopen("data\\dchest.bin", "wb"); |
618 v3 = v2; | 617 v3 = v2; |
619 if ( !v2 ) | 618 if ( !v2 ) |
620 Abortf("Unable to save dchest.bin!"); | 619 Error("Unable to save dchest.bin!"); |
620 | |
621 fwrite(v1, 4u, 1u, v2); | 621 fwrite(v1, 4u, 1u, v2); |
622 fwrite(v1->pChests, 0x24u, v1->uNumChests, v3); | 622 fwrite(v1->pChests, 0x24u, v1->uNumChests, v3); |
623 fclose(v3); | 623 fclose(v3); |
624 } | 624 } |
625 | 625 |
669 v2->pChests = 0; | 669 v2->pChests = 0; |
670 v2->uNumChests = 0; | 670 v2->uNumChests = 0; |
671 v4 = fopen(Args, "r"); | 671 v4 = fopen(Args, "r"); |
672 File = v4; | 672 File = v4; |
673 if ( !v4 ) | 673 if ( !v4 ) |
674 Abortf("ChestDescriptionList::load - Unable to open file: %s."); | 674 Error("ChestDescriptionList::load - Unable to open file: %s."); |
675 | |
675 v5 = 0; | 676 v5 = 0; |
676 Argsa = 0; | 677 Argsa = 0; |
677 if ( fgets(&Buf, 490, v4) ) | 678 if ( fgets(&Buf, 490, v4) ) |
678 { | 679 { |
679 do | 680 do |
690 v6 = v2->pChests; | 691 v6 = v2->pChests; |
691 v2->uNumChests = v5; | 692 v2->uNumChests = v5; |
692 v7 = pAllocator->AllocNamedChunk(v6, 36 * v5, "Chest Descrip"); | 693 v7 = pAllocator->AllocNamedChunk(v6, 36 * v5, "Chest Descrip"); |
693 v2->pChests = (ChestDesc *)v7; | 694 v2->pChests = (ChestDesc *)v7; |
694 if ( v7 == (void *)v3 ) | 695 if ( v7 == (void *)v3 ) |
695 Abortf("ChestDescriptionList::load - Out of Memory!"); | 696 Error("ChestDescriptionList::load - Out of Memory!"); |
697 | |
696 memset(v7, v3, 36 * v2->uNumChests); | 698 memset(v7, v3, 36 * v2->uNumChests); |
697 v8 = File; | 699 v8 = File; |
698 v2->uNumChests = v3; | 700 v2->uNumChests = v3; |
699 fseek(v8, v3, v3); | 701 fseek(v8, v3, v3); |
700 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | 702 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) |