Show an error if a town or outdoor node is called in the wrong context

This commit is contained in:
2023-01-18 20:28:37 -05:00
parent b422cdf429
commit dbdb7b8caf

View File

@@ -2084,12 +2084,20 @@ cSpecial get_node(spec_num_t cur_spec, eSpecCtxType cur_spec_type) {
}
return univ.scenario.scen_specials[cur_spec];
case eSpecCtxType::OUTDOOR:
if(!is_out()) {
showError("The scenario called an outdoors special node while not outdoors.");
return dummy_node;
}
if(cur_spec != minmax(0,univ.out->specials.size() - 1,cur_spec)) {
showError("The scenario called an outdoor special node out of range.");
return dummy_node;
}
return univ.out->specials[cur_spec];
case eSpecCtxType::TOWN:
if(is_out()) {
showError("The scenario called a town special node while outdoors.");
return dummy_node;
}
if(cur_spec != minmax(0,univ.town->specials.size() - 1,cur_spec)) {
showError("The scenario called a town special node out of range.");
return dummy_node;