Refactor the various special item arrays into a single structure array

This commit is contained in:
2014-11-29 12:02:28 -05:00
parent c5b1416c33
commit 7aa3ba3794
7 changed files with 20 additions and 16 deletions

View File

@@ -84,6 +84,15 @@ std::istream& operator >> (std::istream& in, eWeapType& e);
std::istream& operator >> (std::istream& in, eItemType& e);
std::istream& operator >> (std::istream& in, eItemAbil& e);
class cSpecItem {
public:
short flags;
short special;
// TODO: Change to std::string
char name[256];
char descr[256];
};
/*
typedef struct {
short variety, item_level;

View File

@@ -70,9 +70,8 @@ cScenario& cScenario::operator = (legacy::scenario_data_type& old){
}
for(i = 0; i < 3; i++) store_item_towns[i] = old.store_item_towns[i];
flag_e = old.flag_e;
// TODO: Combine these two into a structure
for(i = 0; i < 50; i++) special_items[i] = old.special_items[i];
for(i = 0; i < 50; i++) special_item_special[i] = old.special_item_special[i];
for(i = 0; i < 50; i++) special_items[i].flags = old.special_items[i];
for(i = 0; i < 50; i++) special_items[i].special = old.special_item_special[i];
rating = old.rating;
// TODO: Is this used anywhere?
uses_custom_graphics = old.uses_custom_graphics;
@@ -126,8 +125,8 @@ char(& cScenario::scen_strs(short i))[256]{
if(i >= 4 && i < 10 ) return intro_strs[i - 4];
if(i >= 10 && i < 60 ) return journal_strs[i - 10];
if(i >= 60 && i < 160){
if(i % 2 == 0) return spec_item_names[(i - 60) / 2];
else return spec_item_strs[(i - 60) / 2];
if(i % 2 == 0) return special_items[(i - 60) / 2].name;
else return special_items[(i - 60) / 2].descr;
}
if(i >= 160 && i < 260) return spec_strs[i - 160];
return journal_strs[6]; // random unused slot

View File

@@ -62,8 +62,7 @@ public:
rectangle store_item_rects[3];
short store_item_towns[3];
short flag_e;
short special_items[50];
short special_item_special[50];
cSpecItem special_items[50];
short rating,uses_custom_graphics;
short flag_f;
cMonster scen_monsters[256];
@@ -93,9 +92,6 @@ public:
char contact_info[256];
char intro_strs[6][256];
char journal_strs[50][256];
//char spec_item_strs[100][256];
char spec_item_names[50][256];
char spec_item_strs[50][256];
char spec_strs[100][256];
char monst_strs[100][256];
bool adjust_diff : 1;