From 0629a70419c407f838d6ff58d9600ee5662073b2 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 6 Dec 2014 20:59:50 -0500 Subject: [PATCH] Strictiy terrain special enum --- osx/boe.actions.cpp | 23 +++++----- osx/boe.fileio.cpp | 2 +- osx/boe.graphics.cpp | 14 +++--- osx/boe.graphutil.cpp | 10 ++--- osx/boe.locutils.cpp | 4 +- osx/boe.main.cpp | 5 ++- osx/boe.monster.cpp | 16 +++---- osx/boe.party.cpp | 4 +- osx/boe.specials.cpp | 59 ++++++++++++------------- osx/boe.town.cpp | 10 ++--- osx/classes/simpletypes.h | 79 ++++++++++++---------------------- osx/classes/terrain.cpp | 62 +++++++++++++------------- osx/scenedit/scen.actions.cpp | 12 +++--- osx/scenedit/scen.core.cpp | 26 +++++------ osx/scenedit/scen.graphics.cpp | 38 ++++++++-------- 15 files changed, 171 insertions(+), 193 deletions(-) diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 843a572c..e8e5441f 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -487,7 +487,7 @@ bool handle_action(sf::Event event) add_string_to_buf("Rest: Not enough food. "); else if (nearest_monster() <= 3) add_string_to_buf("Rest: Monster too close. "); - else if ((scenario.ter_types[ter].special == TER_SPEC_DAMAGING) || (scenario.ter_types[ter].special == TER_SPEC_DANGEROUS)) + else if(scenario.ter_types[ter].special == eTerSpec::DAMAGING || scenario.ter_types[ter].special == eTerSpec::DANGEROUS) add_string_to_buf("Rest: It's dangerous here.");//// else if (flying() == true) add_string_to_buf("Rest: Not while flying. "); @@ -786,7 +786,7 @@ bool handle_action(sf::Event event) else need_redraw = true; storage = univ.out[univ.party.p_loc.x][univ.party.p_loc.y]; - if (scenario.ter_types[storage].special == TER_SPEC_TOWN_ENTRANCE) {//// town entry + if(scenario.ter_types[storage].special == eTerSpec::TOWN_ENTRANCE) { if (univ.party.direction == 0) find_direction_from = 2; else if (univ.party.direction == 4) find_direction_from = 0; @@ -2604,11 +2604,11 @@ static eDirection find_waterfall(short x, short y, short mode){ bool to_dir[8]; for(eDirection i = DIR_N; i < DIR_HERE; i++){ if(mode == 0){ - to_dir[i] = (scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].special == TER_SPEC_WATERFALL); + to_dir[i] = scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].special == eTerSpec::WATERFALL; //printf("%i\n",scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].flag1); if(scenario.ter_types[univ.town->terrain(x + dir_x_dif[i],y + dir_y_dif[i])].flag1.u != i) to_dir[i] = false; }else{ - to_dir[i] = (scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].special == TER_SPEC_WATERFALL); + to_dir[i] = scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].special == eTerSpec::WATERFALL; if(scenario.ter_types[univ.out[x + dir_x_dif[i]][y + dir_y_dif[i]]].flag1.u != i) to_dir[i] = false; } } @@ -2762,7 +2762,7 @@ bool outd_move_party(location destination,bool forced) // not in towns && ((scenario.ter_types[ter].boat_over == false) || ((real_dest.x != univ.party.p_loc.x) && (real_dest.y != univ.party.p_loc.y))) - && (scenario.ter_types[ter].special != TER_SPEC_TOWN_ENTRANCE)) { + && scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) { add_string_to_buf("You leave the boat."); univ.party.in_boat = -1; } @@ -2771,7 +2771,8 @@ bool outd_move_party(location destination,bool forced) return false; else if ((outd_is_blocked(real_dest) == false) && (scenario.ter_types[ter].boat_over == true) - && (scenario.ter_types[ter].special != TER_SPEC_TOWN_ENTRANCE)) { + && scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) { + // TODO: It kinda looks like there should be a check for eTerSpec::BRIDGE here? if(cChoiceDlog("boat-bridge.xml",{"under","land"}).show() == "under") forced = true; else { @@ -2832,14 +2833,14 @@ bool outd_move_party(location destination,bool forced) || ((flying() == true) && (scenario.ter_types[ter].fly_over == true)) ) { // TODO: This should only happen if you're actually on a horse - if (scenario.ter_types[ter].special == TER_SPEC_DAMAGING || scenario.ter_types[ter].special == TER_SPEC_DANGEROUS) { + if(scenario.ter_types[ter].special == eTerSpec::DAMAGING || scenario.ter_types[ter].special == eTerSpec::DANGEROUS) { ASB("Your horses quite sensibly refuse."); return false; } univ.party.direction = set_direction(univ.party.p_loc, destination); // TODO: But I though you automatically landed when entering? - if ((flying() == true) && (scenario.ter_types[ter].special == TER_SPEC_TOWN_ENTRANCE)) { + if(flying() && scenario.ter_types[ter].special == eTerSpec::TOWN_ENTRANCE) { add_string_to_buf("Moved: You have to land first. "); return false; } @@ -2924,7 +2925,7 @@ bool town_move_party(location destination,short forced)//// else if ((destination.x != univ.town.p_loc.x) && (destination.y != univ.town.p_loc.y)) return false; // Crossing bridge: land or go through - else if ((!is_blocked(destination)) && (scenario.ter_types[ter].boat_over) && (scenario.ter_types[ter].special == TER_SPEC_BRIDGE)) { + else if(!is_blocked(destination) && scenario.ter_types[ter].boat_over && scenario.ter_types[ter].special == eTerSpec::BRIDGE) { if(cChoiceDlog("boat-bridge.xml",{"under","land"}).show() == "under") forced = true; else if (is_blocked(destination) == false) { @@ -2975,7 +2976,7 @@ bool town_move_party(location destination,short forced)//// } else if ((is_blocked(destination) == false) || (forced == 1)) { if (univ.party.in_horse >= 0) { - if (scenario.ter_types[ter].special == TER_SPEC_DAMAGING) { + if(scenario.ter_types[ter].special == eTerSpec::DAMAGING) { ASB("Your horses quite sensibly refuse."); return false; } @@ -3076,7 +3077,7 @@ short count_walls(location loc) // TODO: Generalize this function bool is_sign(ter_num_t ter) { - if (scenario.ter_types[ter].special == TER_SPEC_IS_A_SIGN) + if(scenario.ter_types[ter].special == eTerSpec::IS_A_SIGN) return true; return false; } diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index 25c0c674..cc6ebd8c 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -189,7 +189,7 @@ void finish_load_party(){ force_barrier = true; if (univ.town.is_quickfire(j,k) == true) quickfire = true; - if(scenario.ter_types[univ.town->terrain(j,k)].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[univ.town->terrain(j,k)].special == eTerSpec::CONVEYOR) belt_present = true; } force_wall = true; diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index e8d9574f..79754814 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -1289,22 +1289,22 @@ bool extend_road_terrain(ter_num_t ter) ter_num_t flag = scenario.ter_types[ter].flag1.u; if(trim == eTrimType::ROAD || trim == eTrimType::CITY || trim == eTrimType::WALKWAY) return true; - if(spec == TER_SPEC_BRIDGE) + if(spec == eTerSpec::BRIDGE) return true; - if(spec == TER_SPEC_TOWN_ENTRANCE && trim != eTrimType::NONE) + if(spec == eTerSpec::TOWN_ENTRANCE && trim != eTrimType::NONE) return true; // cave entrance, most likely - if(spec == TER_SPEC_UNLOCKABLE || spec == TER_SPEC_CHANGE_WHEN_STEP_ON) + if(spec == eTerSpec::UNLOCKABLE || spec == eTerSpec::CHANGE_WHEN_STEP_ON) return true; // closed door, possibly locked; or closed portcullis - if(spec == TER_SPEC_CHANGE_WHEN_USED && scenario.ter_types[flag].special == TER_SPEC_CHANGE_WHEN_STEP_ON && scenario.ter_types[flag].flag1.u == ter) + if(spec == eTerSpec::CHANGE_WHEN_USED && scenario.ter_types[flag].special == eTerSpec::CHANGE_WHEN_STEP_ON && scenario.ter_types[flag].flag1.u == ter) return true; // open door (I think) TODO: Verify this works - if(spec == TER_SPEC_LOCKABLE) + if(spec == eTerSpec::LOCKABLE) return true; // open portcullis (most likely) return false; } static bool can_build_roads_on(ter_num_t ter) { if(impassable(ter)) return false; - if(scenario.ter_types[ter].special == TER_SPEC_BRIDGE) return false; + if(scenario.ter_types[ter].special == eTerSpec::BRIDGE) return false; return true; } @@ -1343,7 +1343,7 @@ static bool connect_roads(ter_num_t ter){ eTerSpec spec = scenario.ter_types[ter].special; if(trim == eTrimType::ROAD || trim == eTrimType::CITY) return true; - if(spec == TER_SPEC_TOWN_ENTRANCE && trim != eTrimType::NONE) + if(spec == eTerSpec::TOWN_ENTRANCE && trim != eTrimType::NONE) return true; // cave entrance, most likely return false; } diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index 347e6b8a..fea7676d 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -234,7 +234,7 @@ void draw_monsters() //// ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); // in bed? if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && + scenario.ter_types[ter].special == eTerSpec::BED && isHumanoid(univ.town.monst[i].m_type) && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && (width == 1) && (height == 1)) //// @@ -248,7 +248,7 @@ void draw_monsters() //// ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); // in bed? if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && + (scenario.ter_types[ter].special == eTerSpec::BED) && isHumanoid(univ.town.monst[i].m_type) && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && (width == 1) && (height == 1)) //// @@ -278,7 +278,7 @@ void draw_monsters() //// + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && + scenario.ter_types[ter].special == eTerSpec::BED && isHumanoid(univ.town.monst[i].m_type) && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && (width == 1) && (height == 1)) @@ -292,7 +292,7 @@ void draw_monsters() //// ,k); ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && + scenario.ter_types[ter].special == eTerSpec::BED && isHumanoid(univ.town.monst[i].m_type) && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && (width == 1) && (height == 1)) @@ -565,7 +565,7 @@ void draw_party_symbol(location center) { source_rect.offset(28,0); ter_num_t ter = is_out() ? univ.out[univ.party.p_loc.x][univ.party.p_loc.y] : univ.town->terrain(univ.town.p_loc.x,univ.town.p_loc.y); // now wedge in bed graphic - if ((is_town()) && (scenario.ter_types[ter].special == TER_SPEC_BED)) + if(is_town() && scenario.ter_types[ter].special == eTerSpec::BED) draw_one_terrain_spot((short) target.x,(short) target.y,10000 + scenario.ter_types[ter].flag1.u); else Draw_Some_Item(pc_gworld, source_rect, terrain_screen_gworld, target, 1, 0); } diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 8bff434a..4272c3c9 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -216,7 +216,7 @@ bool is_container(location loc) if ((univ.town.is_barrel(loc.x,loc.y)) || (univ.town.is_crate(loc.x,loc.y))) return true; ter = coord_to_ter(loc.x,loc.y); - if (scenario.ter_types[ter].special == TER_SPEC_IS_A_CONTAINER) + if(scenario.ter_types[ter].special == eTerSpec::IS_A_CONTAINER) return true; return false; } @@ -653,7 +653,7 @@ void alter_space(short i,short j,ter_num_t ter) else { univ.town->terrain(i,j) = ter; combat_terrain[i][j] = ter; - if (scenario.ter_types[univ.town->terrain(i,j)].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[univ.town->terrain(i,j)].special == eTerSpec::CONVEYOR) belt_present = true; } } diff --git a/osx/boe.main.cpp b/osx/boe.main.cpp index 125fed25..6f25da04 100644 --- a/osx/boe.main.cpp +++ b/osx/boe.main.cpp @@ -759,7 +759,8 @@ void change_cursor(location where_curs) void move_sound(ter_num_t ter,short step){ static bool on_swamp = false; - short pic,spec,snd; + short pic,snd; + eTerSpec spec; pic = scenario.ter_types[ter].picture; spec = scenario.ter_types[ter].special; @@ -772,7 +773,7 @@ void move_sound(ter_num_t ter,short step){ }else on_swamp = false; if ((monsters_going == false) && (overall_mode < MODE_COMBAT) && (univ.party.in_boat >= 0)) {// is on boat ? - if (spec == TER_SPEC_TOWN_ENTRANCE) //town entrance ? + if(spec == eTerSpec::TOWN_ENTRANCE) return; play_sound(48); //play boat sound } diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index cf71083a..cecc89a9 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -943,7 +943,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon location from_loc,to_loc; bool do_look = false; // If becomes true, terrain changed, so need to update what party sees cCreature *which_m; - short ter_abil; + eTerSpec ter_abil; unsigned short ter_flag; from_loc = univ.town.monst[which_monst].cur_loc; @@ -960,7 +960,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon ter_abil = scenario.ter_types[ter].special; ter_flag = scenario.ter_types[ter].flag3.u; - if ((mode > 0) && (ter_abil == TER_SPEC_CONVEYOR)) { + if(mode > 0 && ter_abil == eTerSpec::CONVEYOR) { if ( ((ter_flag == DIR_N) && (where_check.y > from_loc.y)) || ((ter_flag == DIR_E) && (where_check.x < from_loc.x)) || @@ -1061,7 +1061,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon } } if (monster_placid(which_monst) && // monsters don't hop into bed when things are calm - (scenario.ter_types[ter].special == TER_SPEC_BED)) + scenario.ter_types[ter].special == eTerSpec::BED) can_enter = false; if (mode == 1 && univ.town.is_spot(where_check.x, where_check.y)) can_enter = false; @@ -1075,7 +1075,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon switch (ter_abil) { // changing ter - case TER_SPEC_CHANGE_WHEN_STEP_ON: + case eTerSpec::CHANGE_WHEN_STEP_ON: can_enter = false; if (!(monster_placid(which_monst))) { univ.town->terrain(where_check.x,where_check.y) = scenario.ter_types[ter].flag1.u; @@ -1086,13 +1086,13 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon } break; - case TER_SPEC_BLOCKED_TO_MONSTERS: - case TER_SPEC_TOWN_ENTRANCE: - case TER_SPEC_WATERFALL: + case eTerSpec::BLOCKED_TO_MONSTERS: + case eTerSpec::TOWN_ENTRANCE: + case eTerSpec::WATERFALL: can_enter = false; break; - case TER_SPEC_DAMAGING: // TODO: Update this to check other cases + case eTerSpec::DAMAGING: // TODO: Update this to check other cases if (ter_flag == DAMAGE_FIRE && univ.town.monst[which_monst].immunities & 8) return true; else return false; diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 819fa136..b27da3a8 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -1759,7 +1759,7 @@ void cast_town_spell(location where) //// break; case 20: - if (scenario.ter_types[ter].special == TER_SPEC_UNLOCKABLE){ + if(scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE){ if (scenario.ter_types[ter].flag2.u == 10) r1 = 10000; else{ @@ -1826,7 +1826,7 @@ void crumble_wall(location where) // TODO: Add something like this to the spread if (loc_off_act_area(where) == true) return; ter = univ.town->terrain(where.x,where.y); - if (scenario.ter_types[ter].special == TER_SPEC_CRUMBLING && scenario.ter_types[ter].flag3.u < 2) { + if(scenario.ter_types[ter].special == eTerSpec::CRUMBLING && scenario.ter_types[ter].flag3.u < 2) { play_sound(60); univ.town->terrain(where.x,where.y) = scenario.ter_types[ter].flag1.u; add_string_to_buf(" Barrier crumbles."); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 57d22fda..265f97be 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -148,7 +148,8 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short // sets forced to true if definitely can enter { ter_num_t ter; - short r1,i,door_pc,ter_special,pic_type = 0,ter_pic = 0; + short r1,i,door_pc,pic_type = 0,ter_pic = 0; + eTerSpec ter_special; std::string choice; ter_flag_t ter_flag1,ter_flag2,ter_flag3; eDamageType dam_type = DAMAGE_WEAPON; @@ -179,7 +180,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short ter_flag3 = scenario.ter_types[ter].flag3; ter_pic = scenario.ter_types[ter].picture; - if ((mode > 0) && (ter_special == TER_SPEC_CONVEYOR)) { + if(mode > 0 && ter_special == eTerSpec::CONVEYOR) { if ( ((ter_flag3.u == DIR_N) && (where_check.y > from_loc.y)) || ((ter_flag3.u == DIR_E) && (where_check.x < from_loc.x)) || @@ -227,8 +228,8 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short *forced = true; } *spec_num = univ.town->spec_id[i]; - if ((is_blocked(where_check) == false) || (ter_special == TER_SPEC_CHANGE_WHEN_STEP_ON) - || (ter_special == TER_SPEC_CALL_SPECIAL)) { + if(!is_blocked(where_check) || ter_special == eTerSpec::CHANGE_WHEN_STEP_ON + || ter_special == eTerSpec::CALL_SPECIAL) { give_help(54,0); run_special(mode,2,univ.town->spec_id[i],where_check,&s1,&s2,&s3); if (s1 > 0) @@ -288,7 +289,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short } switch (ter_special) { - case TER_SPEC_CHANGE_WHEN_STEP_ON: + case eTerSpec::CHANGE_WHEN_STEP_ON: alter_space(where_check.x,where_check.y,ter_flag1.u); if (ter_flag2.u < 200) { play_sound(-1 * ter_flag2.u); @@ -297,7 +298,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short if(blocksMove(scenario.ter_types[ter].blockage)) can_enter = false; break; - case TER_SPEC_DAMAGING: + case eTerSpec::DAMAGING: //if the party is flying, in a boat, or entering a boat, they cannot be harmed by terrain if (flying() || univ.party.in_boat >= 0 || (mode?town_boat_there(where_check):out_boat_there(where_check)) < 30) break; @@ -349,7 +350,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short boom_space(univ.party.p_loc,overall_mode,pic_type,r1,12); fast_bang = 0; break; - case TER_SPEC_DANGEROUS: + case eTerSpec::DANGEROUS: //if party is flying, in a boat, or entering a boat, they cannot receive statuses from terrain if (flying() || univ.party.in_boat >= 0 || (mode?town_boat_there(where_check):out_boat_there(where_check)) < 30) break; @@ -418,7 +419,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short // } // } break; - case TER_SPEC_CALL_SPECIAL: + case eTerSpec::CALL_SPECIAL: { short spec_type = 0; if(ter_flag2.u == 3){ @@ -440,7 +441,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short // Locked doors - case TER_SPEC_UNLOCKABLE: + case eTerSpec::UNLOCKABLE: if (is_combat()) { // No lockpicking in combat add_string_to_buf(" Can't enter: It's locked."); break; @@ -1226,7 +1227,7 @@ bool use_space(location where) univ.town.set_block((short) to_loc.x,(short) to_loc.y,true); } - if (scenario.ter_types[ter].special == TER_SPEC_CHANGE_WHEN_USED) { + if(scenario.ter_types[ter].special == eTerSpec::CHANGE_WHEN_USED) { if (where == from_loc) { add_string_to_buf(" Not while on space."); return false; @@ -1235,7 +1236,7 @@ bool use_space(location where) alter_space(where.x,where.y,scenario.ter_types[ter].flag1.u); play_sound(scenario.ter_types[ter].flag2.u); return true; - }else if (scenario.ter_types[ter].special == TER_SPEC_CALL_SPECIAL_WHEN_USED){ // call special + } else if(scenario.ter_types[ter].special == eTerSpec::CALL_SPECIAL_WHEN_USED) { short spec_type = 0; if(scenario.ter_types[ter].flag2.u == 3){ if((is_town() || (is_combat() && which_combat_type == 1))) spec_type = 2; else spec_type = 1; @@ -1288,8 +1289,8 @@ bool adj_town_look(location where) } if (is_container(where) && item_there && can_open) { get_item(where,6,true); - }else if(scenario.ter_types[terrain].special == TER_SPEC_CHANGE_WHEN_USED || - scenario.ter_types[terrain].special == TER_SPEC_CALL_SPECIAL_WHEN_USED) { + }else if(scenario.ter_types[terrain].special == eTerSpec::CHANGE_WHEN_USED || + scenario.ter_types[terrain].special == eTerSpec::CALL_SPECIAL_WHEN_USED) { add_string_to_buf(" (Use this space to do something"); add_string_to_buf(" with it.)"); }else{ @@ -1765,7 +1766,7 @@ void push_things()//// } if (l != univ.town.p_loc) { ASB("You get pushed."); - if (scenario.ter_types[ter].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[ter].special == eTerSpec::CONVEYOR) draw_terrain(0); center = l; univ.town.p_loc = l; @@ -1805,7 +1806,7 @@ void push_things()//// if (l != pc_pos[i]) { ASB("Someone gets pushed."); ter = univ.town->terrain(l.x,l.y); - if (scenario.ter_types[ter].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[ter].special == eTerSpec::CONVEYOR) draw_terrain(0); pc_pos[i] = l; update_explored(l); @@ -2822,7 +2823,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case SPEC_TOWN_CHANGE_TER: set_terrain(l,spec.ex2a); - if(scenario.ter_types[spec.ex2a].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.ex2a].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); @@ -2830,12 +2831,12 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_TOWN_SWAP_TER: if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2a){ set_terrain(l,spec.ex2b); - if(scenario.ter_types[spec.ex2a].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.ex2a].special == eTerSpec::CONVEYOR) belt_present = true; } else if (coord_to_ter(spec.ex1a,spec.ex1b) == spec.ex2b){ set_terrain(l,spec.ex2a); - if(scenario.ter_types[spec.ex2a].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.ex2a].special == eTerSpec::CONVEYOR) belt_present = true; } *redraw = 1; @@ -2844,7 +2845,7 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_TOWN_TRANS_TER: ter = coord_to_ter(spec.ex1a,spec.ex1b); set_terrain(l,scenario.ter_types[ter].trans_to_what); - if(scenario.ter_types[spec.ex2a].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.ex2a].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = 1; draw_map(true); @@ -2879,13 +2880,13 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case SPEC_TOWN_LOCK_SPACE: ter = coord_to_ter(spec.ex1a,spec.ex1b); - if (scenario.ter_types[ter].special == TER_SPEC_LOCKABLE) + if(scenario.ter_types[ter].special == eTerSpec::LOCKABLE) set_terrain(l,scenario.ter_types[ter].flag1.u); *redraw = 1; break; case SPEC_TOWN_UNLOCK_SPACE: ter = coord_to_ter(spec.ex1a,spec.ex1b); - if (scenario.ter_types[ter].special == TER_SPEC_UNLOCKABLE) + if(scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE) set_terrain(l,scenario.ter_types[ter].flag1.u); *redraw = 1; break; @@ -3226,7 +3227,7 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_RECT_CHANGE_TER: if (get_ran(1,1,100) <= spec.sd2){ set_terrain(l,spec.sd1); - if(scenario.ter_types[spec.sd1].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.sd1].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); @@ -3235,14 +3236,14 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_RECT_SWAP_TER: if (coord_to_ter(i,j) == spec.sd1){ set_terrain(l,spec.sd2); - if(scenario.ter_types[spec.sd2].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.sd2].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); } else if (coord_to_ter(i,j) == spec.sd2){ set_terrain(l,spec.sd1); - if(scenario.ter_types[spec.sd1].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[spec.sd1].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); @@ -3251,16 +3252,16 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_RECT_TRANS_TER: ter = coord_to_ter(i,j); set_terrain(l,scenario.ter_types[ter].trans_to_what); - if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); break; case SPEC_RECT_LOCK: ter = coord_to_ter(i,j); - if (scenario.ter_types[ter].special == 8){ + if(scenario.ter_types[ter].special == eTerSpec::LOCKABLE){ set_terrain(l,scenario.ter_types[ter].flag1.u); - if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); @@ -3268,9 +3269,9 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case SPEC_RECT_UNLOCK: ter = coord_to_ter(i,j); - if (scenario.ter_types[ter].special == TER_SPEC_UNLOCKABLE){ + if (scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE){ set_terrain(l,scenario.ter_types[ter].flag1.u); - if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[scenario.ter_types[ter].trans_to_what].special == eTerSpec::CONVEYOR) belt_present = true; *redraw = true; draw_map(true); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 4e590beb..e8f4288f 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -204,7 +204,7 @@ void start_town_mode(short which_town, short entry_dir) current_ground = 0; else if (univ.town->terrain(i,j) == 2) current_ground = 2; - if (scenario.ter_types[univ.town->terrain(i,j)].special == TER_SPEC_CONVEYOR) + if(scenario.ter_types[univ.town->terrain(i,j)].special == eTerSpec::CONVEYOR) belt_present = true; } @@ -1178,7 +1178,7 @@ void pick_lock(location where,short pc_num) if (pc_has_abil_equip(pc_num,42) < 24) r1 = r1 - 12; - if (scenario.ter_types[terrain].special != TER_SPEC_UNLOCKABLE) { + if(scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) { add_string_to_buf(" Wrong terrain type. "); return; } @@ -1206,7 +1206,7 @@ void bash_door(location where,short pc_num) //// terrain = univ.town->terrain(where.x,where.y); r1 = get_ran(1,1,100) - 15 * stat_adj(pc_num,0) + univ.town.difficulty * 4; - if (scenario.ter_types[terrain].special != TER_SPEC_UNLOCKABLE) { + if(scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) { add_string_to_buf(" Wrong terrain type. "); return; } @@ -1634,8 +1634,8 @@ void draw_map(bool need_refresh) { bool is_door(location destination) { - if ((scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == TER_SPEC_UNLOCKABLE) || - (scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == TER_SPEC_CHANGE_WHEN_STEP_ON)) + if(scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == eTerSpec::UNLOCKABLE || + scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == eTerSpec::CHANGE_WHEN_STEP_ON) return true; return false; } diff --git a/osx/classes/simpletypes.h b/osx/classes/simpletypes.h index 48f07279..46081935 100644 --- a/osx/classes/simpletypes.h +++ b/osx/classes/simpletypes.h @@ -162,59 +162,35 @@ enum eMonstAbil { /* Terrains Special Properties : scenario.ter_types[i].special */ //complete -enum eTerSpec { -// TER_SPEC_NONE = 0, -// TER_SPEC_CHANGE_WHEN_STEP_ON = 1, -// TER_SPEC_DOES_FIRE_DAMAGE = 2, -// TER_SPEC_DOES_COLD_DAMAGE = 3, -// TER_SPEC_DOES_MAGIC_DAMAGE = 4, -// TER_SPEC_POISON_LAND = 5, -// TER_SPEC_DISEASED_LAND = 6, -// TER_SPEC_CRUMBLING_TERRAIN = 7, -// TER_SPEC_LOCKABLE_TERRAIN = 8, -// TER_SPEC_UNLOCKABLE_TERRAIN = 9, -// TER_SPEC_UNLOCKABLE_BASHABLE = 10, -// TER_SPEC_IS_A_SIGN = 11, -// TER_SPEC_CALL_LOCAL_SPECIAL = 12, -// TER_SPEC_CALL_SCENARIO_SPECIAL = 13, -// TER_SPEC_IS_A_CONTAINER = 14, -// TER_SPEC_WATERFALL = 15, -// TER_SPEC_CONVEYOR_NORTH = 16, -// TER_SPEC_CONVEYOR_EAST = 17, -// TER_SPEC_CONVEYOR_SOUTH = 18, -// TER_SPEC_CONVEYOR_WEST = 19, -// TER_SPEC_BLOCKED_TO_MONSTERS = 20, -// TER_SPEC_TOWN_ENTRANCE = 21, -// TER_SPEC_CHANGE_WHEN_USED = 22, -// TER_SPEC_CALL_SPECIAL_WHEN_USED = 23, - TER_SPEC_NONE = 0, - TER_SPEC_CHANGE_WHEN_STEP_ON = 1, - TER_SPEC_DAMAGING = 2, - TER_SPEC_BRIDGE = 3, // new - TER_SPEC_BED = 4, // new - TER_SPEC_DANGEROUS = 5, - TER_SPEC_UNUSED1 = 6, - TER_SPEC_CRUMBLING = 7, - TER_SPEC_LOCKABLE = 8, - TER_SPEC_UNLOCKABLE = 9, - TER_SPEC_UNUSED2 = 10, - TER_SPEC_IS_A_SIGN = 11, - TER_SPEC_CALL_SPECIAL = 12, - TER_SPEC_UNUSED3 = 13, - TER_SPEC_IS_A_CONTAINER = 14, - TER_SPEC_WATERFALL = 15, - TER_SPEC_CONVEYOR = 16, - TER_SPEC_UNUSED4 = 17, - TER_SPEC_UNUSED5 = 18, - TER_SPEC_UNUSED6 = 19, - TER_SPEC_BLOCKED_TO_MONSTERS = 20, - TER_SPEC_TOWN_ENTRANCE = 21, - TER_SPEC_CHANGE_WHEN_USED = 22, - TER_SPEC_CALL_SPECIAL_WHEN_USED = 23, +enum class eTerSpec { + NONE = 0, + CHANGE_WHEN_STEP_ON = 1, + DAMAGING = 2, // formerly "fire damage" + BRIDGE = 3, // new; formerly "cold damage" + BED = 4, // new; formerly "magic damage" + DANGEROUS = 5, // formerly "poison land" + UNUSED1 = 6, // formerly "disease land" + CRUMBLING = 7, + LOCKABLE = 8, + UNLOCKABLE = 9, + UNUSED2 = 10, // formerly "unlockable + bashable" + IS_A_SIGN = 11, + CALL_SPECIAL = 12, // formerly "call local special" + UNUSED3 = 13, // formerly "call scenario special" + IS_A_CONTAINER = 14, + WATERFALL = 15, + CONVEYOR = 16, // formerly "conveyor north" + UNUSED4 = 17, // formerly "conveyor east" + UNUSED5 = 18, // formerly "conveyor south" + UNUSED6 = 19, // formerly "conveyor west" + BLOCKED_TO_MONSTERS = 20, + TOWN_ENTRANCE = 21, + CHANGE_WHEN_USED = 22, + CALL_SPECIAL_WHEN_USED = 23, // 1. Change when step on (What to change to, number of sound, Unused) // 2. Damaging terrain; can't rest here (Amount of damage done, multiplier, damage type) - // 3. Reserved - // 4. Reserved + // 3. Bridge - if the party boats over it, they get the option to land. (Unused, Unused, Unused) + // 4. Bed - change party graphic when they stand on this space // 5. Dangerous land; can't rest here; percentage chance may be 0 (Strength, Percentage chance, status type) // 6. Reserved // 7. Crumbling terrain (Terrain to change to, strength?, destroyed by what - quickfire, shatter/move mountains, or both) @@ -234,7 +210,6 @@ enum eTerSpec { // 21. Town entrance (Terrain type if hidden, Unused, Unused) // 22. Change when Used (Terrain to change to when used, Number of sound, Unused) // 23. Call special when used (Special to call, local or scenario?, Unused) - // 24. Bridge - if the party boats over it, they get the option to land. (Unused, Unused, Unused) }; enum class eTrimType { diff --git a/osx/classes/terrain.cpp b/osx/classes/terrain.cpp index c5947e02..f615f674 100644 --- a/osx/classes/terrain.cpp +++ b/osx/classes/terrain.cpp @@ -118,132 +118,132 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ switch(old.special){ case 0: if(i == 7 || i == 10 || i == 13 || i == 16){ - special = TER_SPEC_NONE; + special = eTerSpec::NONE; flag1.s = 23; flag2.u = flag3.u = 0; }else if(picture == 215 || (picture >= 218 && picture <= 221)){ picture = 215; - special = TER_SPEC_NONE; + special = eTerSpec::NONE; flag1.s = 3; flag2.u = flag3.u = 0; }else if(picture == 216 || (picture >= 222 && picture <= 225)){ picture = 215; - special = TER_SPEC_NONE; + special = eTerSpec::NONE; flag1.s = 2; flag2.u = flag3.u = 0; }else if(picture == 143) { - special = TER_SPEC_BED; + special = eTerSpec::BED; flag1.s = 230; flag2.u = flag3.u = 0; }else if((picture >= 61 && picture <= 66) || picture == 401 || picture == 402){ - special = TER_SPEC_BRIDGE; + special = eTerSpec::BRIDGE; flag1.u = flag2.u = flag3.u = 0; break; }else{ - special = TER_SPEC_NONE; + special = eTerSpec::NONE; flag1.s = -1; flag2.u = flag3.u = 0; } break; case 1: - special = TER_SPEC_CHANGE_WHEN_STEP_ON; + special = eTerSpec::CHANGE_WHEN_STEP_ON; flag3.u = 0; break; case 2: - special = TER_SPEC_DAMAGING; + special = eTerSpec::DAMAGING; flag3.u = DAMAGE_FIRE; break; case 3: - special = TER_SPEC_DAMAGING; + special = eTerSpec::DAMAGING; flag3.u = DAMAGE_COLD; break; case 4: - special = TER_SPEC_DAMAGING; + special = eTerSpec::DAMAGING; flag3.u = DAMAGE_MAGIC; break; case 5: - special = TER_SPEC_DANGEROUS; + special = eTerSpec::DANGEROUS; flag3.u = (int)eStatus::POISON; break; case 6: - special = TER_SPEC_DANGEROUS; + special = eTerSpec::DANGEROUS; flag3.u = (int)eStatus::DISEASE; break; case 7: - special = TER_SPEC_CRUMBLING; + special = eTerSpec::CRUMBLING; flag2.u = 0; // ???: may change this flag3.u = 1; // destroyed by Move Mountains but not by quickfire; 0 = both, 2 = quickfire only break; case 8: - special = TER_SPEC_LOCKABLE; + special = eTerSpec::LOCKABLE; flag3.u = 0; break; case 9: - special = TER_SPEC_UNLOCKABLE; + special = eTerSpec::UNLOCKABLE; flag3.u = false; // can't bash break; case 10: - special = TER_SPEC_UNLOCKABLE; + special = eTerSpec::UNLOCKABLE; flag3.u = true; // can bash break; case 11: - special = TER_SPEC_IS_A_SIGN; + special = eTerSpec::IS_A_SIGN; flag3.u = 0; break; case 12: - special = TER_SPEC_CALL_SPECIAL; + special = eTerSpec::CALL_SPECIAL; flag2.u = 0; // local special, always (1 would be local if in town, global if outdoors) flag3.s = -1; break; case 13: - special = TER_SPEC_CALL_SPECIAL; + special = eTerSpec::CALL_SPECIAL; flag2.u = 3; // global special, always (2 would be local if outdoors, global if in town) flag3.s = -1; break; case 14: - special = TER_SPEC_IS_A_CONTAINER; + special = eTerSpec::IS_A_CONTAINER; flag3.u = 0; break; case 15: - special = TER_SPEC_WATERFALL; + special = eTerSpec::WATERFALL; flag1.u = DIR_S; flag3.u = 0; break; case 16: - special = TER_SPEC_CONVEYOR; + special = eTerSpec::CONVEYOR; flag1.u = DIR_N; flag3.u = 0; break; case 17: - special = TER_SPEC_CONVEYOR; + special = eTerSpec::CONVEYOR; flag1.u = DIR_E; flag3.u = 0; break; case 18: - special = TER_SPEC_CONVEYOR; + special = eTerSpec::CONVEYOR; flag1.u = DIR_S; flag3.u = 0; break; case 19: - special = TER_SPEC_CONVEYOR; + special = eTerSpec::CONVEYOR; flag1.u = DIR_W; flag3.u = 0; break; case 20: - special = TER_SPEC_BLOCKED_TO_MONSTERS; + special = eTerSpec::BLOCKED_TO_MONSTERS; flag3.u = 0; break; case 21: - special = TER_SPEC_TOWN_ENTRANCE; + special = eTerSpec::TOWN_ENTRANCE; flag3.u = 0; break; case 22: - special = TER_SPEC_CHANGE_WHEN_USED; + special = eTerSpec::CHANGE_WHEN_USED; flag2.u = 3; flag3.u = 0; break; case 23: - special = TER_SPEC_CALL_SPECIAL_WHEN_USED; + special = eTerSpec::CALL_SPECIAL_WHEN_USED; flag2.u = 3; // global special, always (2 would be local if outdoors, global if in town) flag3.s = -1; break; @@ -251,7 +251,7 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ trans_to_what = old.trans_to_what; fly_over = old.fly_over; boat_over = old.boat_over; - if(special == TER_SPEC_DANGEROUS) block_horse = false; // because it's now redundant and unhelpful + if(special == eTerSpec::DANGEROUS) block_horse = false; // because it's now redundant and unhelpful else block_horse = old.block_horse; light_radius = old.light_radius; step_sound = old.step_sound; @@ -362,7 +362,7 @@ std::istream& operator >> (std::istream& in, eTerSpec& e){ in >> i; if(i > 0 && i < 24) e = (eTerSpec) i; - else e = TER_SPEC_NONE; + else e = eTerSpec::NONE; return in; } diff --git a/osx/scenedit/scen.actions.cpp b/osx/scenedit/scen.actions.cpp index ea942f9f..326c0ea9 100644 --- a/osx/scenedit/scen.actions.cpp +++ b/osx/scenedit/scen.actions.cpp @@ -1911,7 +1911,7 @@ void set_terrain(location l,ter_num_t terrain_type) { adjust_space(l); l.y--; - if ((scenario.ter_types[terrain_type].special == TER_SPEC_IS_A_SIGN) && (editing_town == true)) { /// it's a sign + if(scenario.ter_types[terrain_type].special == eTerSpec::IS_A_SIGN && editing_town) { for (i = 0; i < 15; i++) if (which_sign < 0) { if ((town->sign_locs[i].x == l.x) && (town->sign_locs[i].y == l.y)) @@ -1923,7 +1923,7 @@ void set_terrain(location l,ter_num_t terrain_type) { which_sign = i; else { ter = town->terrain(town->sign_locs[i].x,town->sign_locs[i].y); - if (scenario.ter_types[ter].special != TER_SPEC_IS_A_SIGN) + if(scenario.ter_types[ter].special != eTerSpec::IS_A_SIGN) which_sign = i; } } @@ -1941,7 +1941,7 @@ void set_terrain(location l,ter_num_t terrain_type) { } mouse_button_held = false; } - if ((scenario.ter_types[terrain_type].special == TER_SPEC_IS_A_SIGN) && (editing_town == false)) { /// it's a sign + if(scenario.ter_types[terrain_type].special == eTerSpec::IS_A_SIGN && !editing_town) { if ((l.x == 0) || (l.x == 47) || (l.y == 0) || (l.y == 47)) { cChoiceDlog("not-at-edge.xml").show(); mouse_button_held = false; @@ -1958,7 +1958,7 @@ void set_terrain(location l,ter_num_t terrain_type) { which_sign = i; else { ter = current_terrain.terrain[current_terrain.sign_locs[i].x][current_terrain.sign_locs[i].y]; - if (scenario.ter_types[ter].special != TER_SPEC_IS_A_SIGN) + if(scenario.ter_types[ter].special != eTerSpec::IS_A_SIGN) which_sign = i; } } @@ -3034,7 +3034,7 @@ void town_entry(location spot_hit) { ter_num_t ter; ter = current_terrain.terrain[spot_hit.x][spot_hit.y]; - if (scenario.ter_types[ter].special != TER_SPEC_TOWN_ENTRANCE) { + if(scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) { giveError("This space isn't a town entrance. Town entrances are marked by a small brown castle icon."); return; } @@ -3042,7 +3042,7 @@ void town_entry(location spot_hit) { for (x = 0; x < 8; x++) if (current_terrain.exit_locs[x].x < 100) { ter = current_terrain.terrain[current_terrain.exit_locs[x].x][current_terrain.exit_locs[x].y]; - if (scenario.ter_types[ter].special != TER_SPEC_TOWN_ENTRANCE) + if(scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) current_terrain.exit_locs[x].x = 100; } y = -2; diff --git a/osx/scenedit/scen.core.cpp b/osx/scenedit/scen.core.cpp index 13f73567..ddbf7063 100644 --- a/osx/scenedit/scen.core.cpp +++ b/osx/scenedit/scen.core.cpp @@ -140,28 +140,28 @@ static bool save_ter_info(cDialog& me, cTerrain& store_ter) { if ((store_ter.special < 2) || (store_ter.special > 6)) { if (cre(i,0,256,"First special flag must be from 0 to 255.","",813) == true) return false; } - else if (store_ter.special == TER_SPEC_DAMAGING) { + else if(store_ter.special == eTerSpec::DAMAGING) { if (cre(i,0,256,"First special flag must be from 0 to 100.","",813) == true) return false; } - else if (store_ter.special == TER_SPEC_DANGEROUS) { + else if(store_ter.special == eTerSpec::DANGEROUS) { if (cre(i,0,256,"First special flag must be from 0 to 8.","",813) == true) return false; } */ - if(store_ter.special == TER_SPEC_NONE) + if(store_ter.special == eTerSpec::NONE) store_ter.flag1.s = me["flag1"].getTextAsNum(); else store_ter.flag1.u = me["flag1"].getTextAsNum(); if(false) // flag2 is never signed, apparently; but that could change? store_ter.flag2.s = me["flag2"].getTextAsNum(); else store_ter.flag2.u = me["flag2"].getTextAsNum(); - if(store_ter.special == TER_SPEC_CALL_SPECIAL || store_ter.special == TER_SPEC_CALL_SPECIAL_WHEN_USED) + if(store_ter.special == eTerSpec::CALL_SPECIAL || store_ter.special == eTerSpec::CALL_SPECIAL_WHEN_USED) store_ter.flag3.s = me["flag3"].getTextAsNum(); else store_ter.flag3.u = me["flag3"].getTextAsNum(); /* - if (store_ter.special == TER_SPEC_TOWN_ENTRANCE) { + if(store_ter.special == eTerSpec::TOWN_ENTRANCE) { if (cre(i,0,256,"Second special flag must be from 0 to 200.","",813) == true) return false; } - else if ((store_ter.special == TER_SPEC_DAMAGING) || (store_ter.special == TER_SPEC_DANGEROUS)) { + else if(store_ter.special == eTerSpec::DAMAGING || store_ter.special == eTerSpec::DANGEROUS) { if (cre(i,0,256,"Second special flag must be from 0 to 100.","",813) == true) return false; } */ @@ -280,14 +280,14 @@ static bool fill_ter_flag_info(cDialog& me, std::string id, bool){ cLedGroup& led_ctrl = dynamic_cast(me[id]); std::istringstream sel(led_ctrl.getSelected().substr(4)); sel >> prop; - me["flag1text"].setText(get_str("ter-flag1",prop + 1)); - me["flag2text"].setText(get_str("ter-flag2",prop + 1)); - me["flag3text"].setText(get_str("ter-flag3",prop + 1)); + me["flag1text"].setText(get_str("ter-flag1",int(prop) + 1)); + me["flag2text"].setText(get_str("ter-flag2",int(prop) + 1)); + me["flag3text"].setText(get_str("ter-flag3",int(prop) + 1)); me["pickflag1"].hide(); me["pickflag2"].hide(); me["pickflag3"].hide(); switch(prop) { - case TER_SPEC_NONE: + case eTerSpec::NONE: me["pickflag1"].hide(); // TODO: Could have a pick graphic dialog for the editor icon, but that requires adding a new graphic type break; } @@ -326,7 +326,7 @@ static void fill_ter_info(cDialog& me, short ter){ me["trimter"].setTextToNum(ter_type.trim_ter); // TODO: Replace edit text box for trim with a framed name and Select button me["trim"].setTextToNum((int)ter_type.trim_type); - std::string propid = "prop" + std::to_string(ter_type.special); + std::string propid = "prop" + std::to_string((int)ter_type.special); dynamic_cast(me["prop"]).setSelected(propid); fill_ter_flag_info(me, "prop", false); { @@ -383,13 +383,13 @@ static void fill_ter_info(cDialog& me, short ter){ cLed& led_ctrl = dynamic_cast(me["horse"]); led_ctrl.setState(led_red); } - if(ter_type.special == TER_SPEC_NONE) + if(ter_type.special == eTerSpec::NONE) me["flag1"].setTextToNum(ter_type.flag1.s); else me["flag1"].setTextToNum(ter_type.flag1.u); if(false) // flag2 is never signed, apparently; but that could change? me["flag2"].setTextToNum(ter_type.flag2.s); else me["flag2"].setTextToNum(ter_type.flag2.u); - if(ter_type.special == TER_SPEC_CALL_SPECIAL || ter_type.special == TER_SPEC_CALL_SPECIAL_WHEN_USED) + if(ter_type.special == eTerSpec::CALL_SPECIAL || ter_type.special == eTerSpec::CALL_SPECIAL_WHEN_USED) me["flag3"].setTextToNum(ter_type.flag3.s); else me["flag3"].setTextToNum(ter_type.flag3.u); me["arena"].setTextToNum(ter_type.combat_arena); diff --git a/osx/scenedit/scen.graphics.cpp b/osx/scenedit/scen.graphics.cpp index e9f7f028..cac2c34d 100644 --- a/osx/scenedit/scen.graphics.cpp +++ b/osx/scenedit/scen.graphics.cpp @@ -140,13 +140,13 @@ extern bool small_any_drawn; static short get_small_icon(ter_num_t ter){ short icon = -1; switch(scenario.ter_types[ter].special){ - case TER_SPEC_NONE: + case eTerSpec::NONE: icon = scenario.ter_types[ter].flag1.s; break; - case TER_SPEC_CHANGE_WHEN_STEP_ON: + case eTerSpec::CHANGE_WHEN_STEP_ON: icon = 23; break; - case TER_SPEC_DAMAGING: + case eTerSpec::DAMAGING: switch(scenario.ter_types[ter].flag3.u){ case DAMAGE_WEAPON: icon = 40; @@ -174,13 +174,13 @@ static short get_small_icon(ter_num_t ter){ break; } break; - case TER_SPEC_BRIDGE: + case eTerSpec::BRIDGE: icon = 42; break; - case TER_SPEC_BED: + case eTerSpec::BED: icon = -1; break; - case TER_SPEC_DANGEROUS: + case eTerSpec::DANGEROUS: switch((eStatus)scenario.ter_types[ter].flag3.u){ case eStatus::POISONED_WEAPON: // TODO: Do something here break; @@ -218,30 +218,30 @@ static short get_small_icon(ter_num_t ter){ break; // Nothing to do here; these values are "magic" and should not be used } break; - case TER_SPEC_CRUMBLING: + case eTerSpec::CRUMBLING: icon = 34; break; - case TER_SPEC_LOCKABLE: + case eTerSpec::LOCKABLE: icon = 30; break; - case TER_SPEC_UNLOCKABLE: + case eTerSpec::UNLOCKABLE: if (scenario.ter_types[ter].flag2.u >= 5) icon = (scenario.ter_types[ter].flag2.u == 10) ? 32 : 31; else icon = 30; break; - case TER_SPEC_IS_A_SIGN: + case eTerSpec::IS_A_SIGN: icon = 26; break; - case TER_SPEC_CALL_SPECIAL: + case eTerSpec::CALL_SPECIAL: icon = scenario.ter_types[ter].flag3.s; break; - case TER_SPEC_IS_A_CONTAINER: + case eTerSpec::IS_A_CONTAINER: icon = 36; break; - case TER_SPEC_WATERFALL: + case eTerSpec::WATERFALL: icon = -1; break; - case TER_SPEC_CONVEYOR: + case eTerSpec::CONVEYOR: switch(scenario.ter_types[ter].flag1.u){ // TODO: Consider the other four possible directions case DIR_N: icon = 27; @@ -257,16 +257,16 @@ static short get_small_icon(ter_num_t ter){ break; } break; - case TER_SPEC_BLOCKED_TO_MONSTERS: + case eTerSpec::BLOCKED_TO_MONSTERS: icon = 21; break; - case TER_SPEC_TOWN_ENTRANCE: + case eTerSpec::TOWN_ENTRANCE: icon = 22; break; - case TER_SPEC_CHANGE_WHEN_USED: + case eTerSpec::CHANGE_WHEN_USED: icon = -1; break; - case TER_SPEC_CALL_SPECIAL_WHEN_USED: + case eTerSpec::CALL_SPECIAL_WHEN_USED: icon = scenario.ter_types[ter].flag3.s; break; default: @@ -1422,7 +1422,7 @@ void take_quickfire(short i,short j) { bool container_there(location l) { if (editing_town == false) return false; - if (scenario.ter_types[town->terrain(l.x,l.y)].special == TER_SPEC_IS_A_CONTAINER) + if(scenario.ter_types[town->terrain(l.x,l.y)].special == eTerSpec::IS_A_CONTAINER) return true; if (is_barrel(l.x,l.y) == true) return true;