Strictiy terrain special enum
This commit is contained in:
@@ -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;
|
||||
|
@@ -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<cLedGroup&>(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<cLedGroup&>(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<cLed&>(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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user