Various code cleanup stuff

This commit is contained in:
2015-02-14 12:24:25 -05:00
parent dc7abb9502
commit 4fbc6cfa77
19 changed files with 79 additions and 57 deletions

View File

@@ -727,6 +727,11 @@ std::string uAbility::to_string(eMonstAbil key) const {
break;
case eMonstAbilCat::GENERAL:
switch(key) {
// These first few aren't general-category abilities; they're included here just to silence compiler warnings
case eMonstAbil::NO_ABIL: case eMonstAbil::MISSILE: case eMonstAbil::SPLITS: case eMonstAbil::MARTYRS_SHIELD:
case eMonstAbil::ABSORB_SPELLS: case eMonstAbil::MISSILE_WEB: case eMonstAbil::RAY_HEAT: case eMonstAbil::SPECIAL:
case eMonstAbil::HIT_TRIGGER: case eMonstAbil::DEATH_TRIGGER: case eMonstAbil::RADIATE: case eMonstAbil::SUMMON:
break;
case eMonstAbil::STUN: sout << "Stunning"; break;
case eMonstAbil::PETRIFY: sout << "Petrifying"; break;
case eMonstAbil::DRAIN_SP: sout << "Spell point drain"; break;

View File

@@ -123,11 +123,7 @@ public:
unsigned int fire_res;
unsigned int cold_res;
unsigned int poison_res;
bool mindless : 1;
bool invuln : 1;
bool invisible : 1;
bool guard : 1;
char : 4;
bool mindless, invuln, invisible, guard;
unsigned int x_width,y_width;
unsigned int default_attitude;
unsigned int summon_type;

View File

@@ -108,7 +108,7 @@ cScenario::cItemStorage::cItemStorage() : ter_type(-1), property(0) {
void cScenario::append(legacy::scenario_data_type& old){
is_legacy = true;
int i;//,j;
int i;
difficulty = old.difficulty;
intro_pic = old.intro_pic;
default_ground = old.default_ground * 2;
@@ -124,6 +124,7 @@ void cScenario::append(legacy::scenario_data_type& old){
town_mods[i].spec = old.town_to_add_to[i];
town_mods[i].x = old.flag_to_add_to_town[i][0];
town_mods[i].y = old.flag_to_add_to_town[i][1];
storage_shortcuts[i] = old.storage_shortcuts[i];
}
// TODO: Combine store_item_rects and store_item_towns into a structure
for(i = 0; i < 3; i++) {
@@ -131,25 +132,30 @@ void cScenario::append(legacy::scenario_data_type& old){
store_item_rects[i].left = old.store_item_rects[i].left;
store_item_rects[i].bottom = old.store_item_rects[i].bottom;
store_item_rects[i].right = old.store_item_rects[i].right;
store_item_towns[i] = old.store_item_towns[i];
}
for(i = 0; i < 50; i++) {
special_items[i].flags = old.special_items[i];
special_items[i].special = old.special_item_special[i];
}
for(i = 0; i < 3; i++) store_item_towns[i] = old.store_item_towns[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;
for(i = 0; i < 256; i++) scen_monsters[i].append(old.scen_monsters[i]);
for(i = 0; i < 30; i++) boats[i].append(old.scen_boats[i]);
for(i = 0; i < 30; i++) horses[i].append(old.scen_horses[i]);
for(i = 0; i < 30; i++) {
boats[i].append(old.scen_boats[i]);
horses[i].append(old.scen_horses[i]);
}
scen_specials.resize(256);
for(i = 0; i < 256; i++){
ter_types[i].i = i;
ter_types[i].append(old.ter_types[i]);
scen_monsters[i].append(old.scen_monsters[i]);
scen_specials[i].append(old.scen_specials[i]);
}
for(i = 0; i < 20; i++) {
scenario_timers[i].time = old.scenario_timer_times[i];
scenario_timers[i].node = old.scenario_timer_specs[i];
}
for(i = 0; i < 20; i++) scenario_timers[i].time = old.scenario_timer_times[i];
for(i = 0; i < 20; i++) scenario_timers[i].node = old.scenario_timer_specs[i];
scen_specials.resize(256);
for(i = 0; i < 256; i++) scen_specials[i].append(old.scen_specials[i]);
for(i = 0; i < 10; i++) storage_shortcuts[i] = old.storage_shortcuts[i];
last_out_edited.x = old.last_out_edited.x;
last_out_edited.y = old.last_out_edited.y;
last_town_edited = old.last_town_edited;

View File

@@ -93,8 +93,7 @@ public:
// This'll make the transition smoother once it becomes a vector.
std::array<std::string,50> journal_strs;
std::array<std::string,101> spec_strs;
bool adjust_diff : 1;
char : 7;
bool adjust_diff;
bool is_legacy;
fs::path scen_file; // transient
vector2d<cOutdoors*> outdoors;

View File

@@ -88,12 +88,8 @@ public:
short spec_on_hostile;
std::array<cTimer,8> timers;
std::vector<cSpecial> specials;
bool strong_barriers : 1;
bool defy_mapping : 1;
bool defy_scrying : 1;
bool is_hidden : 1;
bool has_tavern : 1;
char : 3;
bool strong_barriers, defy_mapping, defy_scrying;
bool is_hidden, has_tavern;
short difficulty;
std::string town_name;
// Using std::array here so we can have .size()