Check if terrain is unlockable before other lockpick/bash checks
This commit is contained in:
@@ -860,6 +860,8 @@ void handle_bash_pick(location destination, bool& did_something, bool& need_redr
|
||||
}
|
||||
if(!adjacent(destination,univ.party.town_loc))
|
||||
add_string_to_buf(" Must be adjacent.");
|
||||
else if(!is_unlockable(destination))
|
||||
add_string_to_buf(" Wrong terrain type.");
|
||||
else {
|
||||
short pc = select_pc(0, isBash ? "Who will bash?" : "Who will pick the lock?");
|
||||
if(pc == 6) {
|
||||
|
@@ -1128,7 +1128,14 @@ void dump_gold(short print_mes) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_unlockable(location where) {
|
||||
ter_num_t terrain = univ.town->terrain(where.x,where.y);
|
||||
|
||||
if(univ.scenario.ter_types[terrain].special == eTerSpec::UNLOCKABLE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void pick_lock(location where,short pc_num) {
|
||||
ter_num_t terrain;
|
||||
@@ -1157,11 +1164,6 @@ void pick_lock(location where,short pc_num) {
|
||||
|
||||
if(univ.party[pc_num].has_abil_equip(eItemAbil::THIEVING))
|
||||
r1 = r1 - 12;
|
||||
|
||||
if(univ.scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) {
|
||||
add_string_to_buf(" Wrong terrain type.");
|
||||
return;
|
||||
}
|
||||
unlock_adjust = univ.scenario.ter_types[terrain].flag2;
|
||||
if((unlock_adjust >= 5) || (r1 > (unlock_adjust * 15 + 30))) {
|
||||
add_string_to_buf(" Didn't work.");
|
||||
|
@@ -19,6 +19,7 @@ void buy_food(short cost,short per,const char* food_name);
|
||||
void healing_shop();
|
||||
void do_sell(short which);
|
||||
void dump_gold(short print_mes);
|
||||
bool is_unlockable(location where);
|
||||
void pick_lock(location where,short pc_num);
|
||||
void bash_door(location where,short pc_num);
|
||||
void erase_town_specials();
|
||||
|
Reference in New Issue
Block a user