game: begin to use the get_terrain method, ...

This commit is contained in:
ALONSO Laurent
2021-10-19 10:01:25 +02:00
committed by Celtic Minstrel
parent 1b7dcaab1f
commit 8951d0efc1
19 changed files with 171 additions and 206 deletions

View File

@@ -278,7 +278,7 @@ bool load_scenario_v1(fs::path file_to_load, cScenario& scenario, bool only_head
fclose(file_id);
scenario.ter_types[23].fly_over = false;
scenario.get_terrain(23).fly_over = false;
scenario.scen_file = file_to_load;
if(only_header) return true;

View File

@@ -5328,11 +5328,11 @@ void process_fields() {
for(short i = r.left + 1; i < r.right ; i++)
for(short j = r.top + 1; j < r.bottom ; j++)
if(qf[i][j] > 0) {
ter_num_t ter = univ.town->terrain(i,j);
if(univ.scenario.ter_types[ter].special == eTerSpec::CRUMBLING && univ.scenario.ter_types[ter].flag2 > 0) {
cTerrain const &terrain=univ.get_terrain(univ.town->terrain(i,j));
if(terrain.special == eTerSpec::CRUMBLING && terrain.flag2 > 0) {
// TODO: This seems like the wrong sound
play_sound(60);
univ.town->terrain(i,j) = univ.scenario.ter_types[ter].flag1;
univ.town->terrain(i,j) = terrain.flag1;
add_string_to_buf(" Quickfire burns through barrier.");
}
univ.town.set_quickfire(i,j,true);

View File

@@ -1148,7 +1148,7 @@ void do_sign(short town_num, short which_sign, short sign_type) {
cPict& pict = dynamic_cast<cPict&>(sign->getControl("ter"));
store_sign_mode = sign_type;
pict.setPict(univ.scenario.ter_types[sign_type].picture);
pict.setPict(univ.get_terrain(sign_type).get_picture_num());
if(town_num >= 200)
sign_text = univ.out->sign_locs[which_sign].text;

View File

@@ -109,7 +109,7 @@ void finish_load_party(){
for(int k = 0; k < univ.town->max_dim; k++) {
if(univ.town.is_quickfire(j,k))
univ.town.quickfire_present = true;
if(univ.scenario.ter_types[univ.town->terrain(j,k)].special == eTerSpec::CONVEYOR)
if(univ.get_terrain(univ.town->terrain(j,k)).special == eTerSpec::CONVEYOR)
univ.town.belt_present = true;
}
center = univ.party.town_loc;

View File

@@ -170,12 +170,8 @@ location get_cur_loc() {
// TODO: Don't hardcode this!
bool is_lava(short x,short y) {
ter_num_t ter;
ter = coord_to_ter(x,y);
if(univ.scenario.ter_types[ter].picture == 964)
return true;
else return false;
cPictNum pic=univ.get_terrain(coord_to_ter(x,y)).get_picture_num();
return pic.num==4 && pic.type==ePicType::PIC_TER_ANIM;
}
short can_see_light(location p1, location p2, std::function<short(short,short)> get_obscurity) {
@@ -215,7 +211,7 @@ short sight_obscurity(short x,short y) {
}
short combat_obscurity(short x, short y) {
if(univ.scenario.ter_types[coord_to_ter(x,y)].blocksMove()) return 5;
if(univ.get_terrain(coord_to_ter(x,y)).blocksMove()) return 5;
if(is_lava(x,y)) return 5;
return sight_obscurity(x,y);
}
@@ -231,14 +227,9 @@ ter_num_t coord_to_ter(short x,short y) {
////
bool is_container(location loc) {
ter_num_t ter;
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(univ.scenario.ter_types[ter].special == eTerSpec::IS_A_CONTAINER)
return true;
return false;
return univ.get_terrain(coord_to_ter(loc.x,loc.y)).special == eTerSpec::IS_A_CONTAINER;
}
void update_explored(location dest) {
@@ -308,12 +299,12 @@ bool is_blocked(location to_check) {
if (univ.scenario.is_legacy) {
// checkme in combat.c this is only called when is_combat() && ter_pic==406
// (ie. ter_anim+6) due to a logical error
cPictNum pict=univ.scenario.ter_types[coord_to_ter(to_check.x,to_check.y)].get_picture_num();
cPictNum pict=univ.get_terrain(coord_to_ter(to_check.x,to_check.y)).get_picture_num();
if (pict.num==6 && pict.type==ePicType::PIC_TER_ANIM)
return true;
}
else {
if(univ.town.is_spot(to_check.x, to_check.y) || univ.scenario.ter_types[coord_to_ter(to_check.x,to_check.y)].trim_type == eTrimType::CITY)
if(univ.town.is_spot(to_check.x, to_check.y) || univ.get_terrain(coord_to_ter(to_check.x,to_check.y)).trim_type == eTrimType::CITY)
return true; // TODO: Maybe replace eTrimType::CITY with a blockage == clear/special && is_special() check
// Note: The purpose of the above check is to avoid portals.
}
@@ -434,28 +425,17 @@ bool outd_is_blocked(location to_check) {
// Checks if space is a special that prevents movement into or placement of a PC on
bool is_special(location to_check) {
ter_num_t which_ter;
which_ter = coord_to_ter(to_check.x,to_check.y);
if(univ.scenario.ter_types[which_ter].blockage == eTerObstruct::BLOCK_MONSTERS)
return true;
else return false;
return univ.get_terrain(coord_to_ter(to_check.x,to_check.y)).blockage == eTerObstruct::BLOCK_MONSTERS;
}
bool outd_is_special(location to_check) {
if(overall_mode == MODE_OUTDOORS) {
if(univ.scenario.ter_types[univ.out[to_check.x][to_check.y]].blockage == eTerObstruct::BLOCK_MONSTERS) {
return true;
}
else return false;
}
if(overall_mode == MODE_OUTDOORS)
return univ.get_terrain(univ.out[to_check.x][to_check.y]).blockage == eTerObstruct::BLOCK_MONSTERS;
return false;
}
bool impassable(ter_num_t terrain_to_check) {
if(univ.scenario.ter_types[terrain_to_check].blocksMove())
return true;
else return false;
return univ.get_terrain(terrain_to_check).blocksMove();
}
// TODO: What on earth is this and why does it mangle the blockage?
@@ -465,10 +445,10 @@ short get_blockage(ter_num_t terrain_type) {
// little kludgy in here for pits
if((terrain_type == 90) && (is_combat()) && (which_combat_type == 0))
return 5;
if(univ.scenario.ter_types[terrain_type].blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT ||
univ.scenario.ter_types[terrain_type].blockage == eTerObstruct::BLOCK_SIGHT)
cTerrain const &terrain=univ.get_terrain(terrain_type);
if(terrain.blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT || terrain.blockage == eTerObstruct::BLOCK_SIGHT)
return 5;
else if(univ.scenario.ter_types[terrain_type].blockage == eTerObstruct::BLOCK_MOVE_AND_SHOOT)
else if(terrain.blockage == eTerObstruct::BLOCK_MOVE_AND_SHOOT)
return 1;
else {
return 0;
@@ -584,7 +564,7 @@ location push_loc(location from_where,location to_where) {
return loc_to_try;
}
if(sight_obscurity(loc_to_try.x,loc_to_try.y) > 0 ||
univ.scenario.ter_types[univ.town->terrain(loc_to_try.x,loc_to_try.y)].blockage != eTerObstruct::CLEAR ||
univ.get_terrain(univ.town->terrain(loc_to_try.x,loc_to_try.y)).blockage != eTerObstruct::CLEAR ||
(loc_off_act_area(loc_to_try)) ||
univ.target_there(loc_to_try))
return from_where;
@@ -594,12 +574,7 @@ location push_loc(location from_where,location to_where) {
// TODO: This seems to be wrong; impassable implies "blocks movement", which two other blockages also do
bool spot_impassable(short i,short j) {
ter_num_t ter;
ter = coord_to_ter(i,j);
if(univ.scenario.ter_types[ter].blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
return true;
else return false;
return univ.get_terrain(coord_to_ter(i,j)).blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT;
}
void swap_ter(short i,short j,ter_num_t ter1,ter_num_t ter2) {
@@ -624,9 +599,9 @@ void alter_space(short i,short j,ter_num_t ter) {
univ.town->terrain(i,j) = ter;
minimap::draw(true);
}
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
if(univ.get_terrain(ter).special == eTerSpec::CONVEYOR)
univ.town.belt_present = true;
if(univ.scenario.ter_types[former].light_radius != univ.scenario.ter_types[ter].light_radius)
if(univ.get_terrain(former).light_radius != univ.get_terrain(ter).light_radius)
univ.town->set_up_lights();
}
}

View File

@@ -746,8 +746,9 @@ void move_sound(ter_num_t ter,short step){
static bool on_swamp = false;
eTerSpec spec;
spec = univ.scenario.ter_types[ter].special;
eStepSnd snd = univ.scenario.ter_types[ter].step_sound;
auto const &terrain=univ.get_terrain(ter);
spec = terrain.special;
eStepSnd snd = terrain.step_sound;
// if on swamp don't play squish sound : BoE legacy behavior, can be removed safely
if(snd == eStepSnd::SPLASH && !flying() && univ.party.in_boat < 0){
@@ -761,7 +762,7 @@ void move_sound(ter_num_t ter,short step){
play_sound(48); //play boat sound
} else if(!monsters_going && !is_combat() && (univ.party.in_horse >= 0)) {
play_sound(85); //so play horse sound
} else switch(univ.scenario.ter_types[ter].step_sound){
} else switch(terrain.step_sound){
case eStepSnd::SQUISH:
play_sound(55);
break;

View File

@@ -877,7 +877,6 @@ void monst_inflict_fields(short which_monst) {
//mode; // 1 - town 2 - combat
bool monst_check_special_terrain(location where_check,short mode,short which_monst) {
ter_num_t ter = 0;
short r1,guts = 0;
bool can_enter = true,mage = false;
location from_loc,to_loc;
@@ -887,11 +886,12 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
unsigned short ter_dir;
from_loc = univ.town.monst[which_monst].cur_loc;
ter = univ.town->terrain(where_check.x,where_check.y);
////
which_m = &univ.town.monst[which_monst];
ter_abil = univ.scenario.ter_types[ter].special;
ter_dir = univ.scenario.ter_types[ter].flag1;
ter_num_t const ter_id=univ.town->terrain(where_check.x,where_check.y);
cTerrain const &terrain=univ.get_terrain(ter_id);
ter_abil = terrain.special;
ter_dir = terrain.flag1;
if(mode > 0 && ter_abil == eTerSpec::CONVEYOR) {
if(
@@ -999,11 +999,11 @@ 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
univ.scenario.ter_types[ter].special == eTerSpec::BED)
terrain.special == eTerSpec::BED)
can_enter = false;
if(mode == 1 && univ.town.is_spot(where_check.x, where_check.y))
can_enter = false;
if(ter == 90) {
if(ter_id == 90) {
if((is_combat()) && (which_combat_type == 0)) {
univ.town.monst[which_monst].active = 0;
add_string_to_buf("Monster escaped! ");
@@ -1017,10 +1017,10 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
case eTerSpec::CHANGE_WHEN_STEP_ON:
can_enter = false;
if(!(monster_placid(which_monst))) {
univ.town->terrain(where_check.x,where_check.y) = univ.scenario.ter_types[ter].flag1;
univ.town->terrain(where_check.x,where_check.y) = terrain.flag1;
do_look = true;
if(point_onscreen(center,where_check))
play_sound(univ.scenario.ter_types[ter].flag2);
play_sound(terrain.flag2);
}
break;
@@ -1032,7 +1032,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
break;
case eTerSpec::DAMAGING:
if(univ.town.monst[which_monst].resist[eDamageType(univ.scenario.ter_types[ter].flag3)] == 0)
if(univ.town.monst[which_monst].resist[eDamageType(terrain.flag3)] == 0)
return true;
else return univ.town.monst[which_monst].invuln;
// TODO: Should it check any other terrain specials?

View File

@@ -1221,7 +1221,7 @@ void cast_town_spell(location where) {
}
bool failed = town_spell == eSpell::NONE && adjust > 4;
cTerrain const &terrain = univ.get_terrain(ter);
if(adjust > 4)
add_string_to_buf(" Can't see target.");
else switch(town_spell) {
@@ -1294,17 +1294,17 @@ void cast_town_spell(location where) {
case eSpell::UNLOCK:
// TODO: Is the unlock spell supposed to have a max range?
if(univ.scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE){
if(univ.scenario.ter_types[ter].flag2 == 10)
if(terrain.special == eTerSpec::UNLOCKABLE){
if(terrain.flag2 == 10)
r1 = 10000;
else{
r1 = get_ran(1,1,100) - 5 * adj + 5 * univ.town.difficulty;
r1 += univ.scenario.ter_types[ter].flag2 * 7;
r1 += terrain.flag2 * 7;
}
if(r1 < (135 - combat_percent[min(19,level)])) {
add_string_to_buf(" Door unlocked.");
play_sound(9);
univ.town->terrain(where.x,where.y) = univ.scenario.ter_types[ter].flag1;
univ.town->terrain(where.x,where.y) = terrain.flag1;
}
else {
play_sound(41);
@@ -1367,15 +1367,13 @@ bool cast_spell_on_space(location where, eSpell spell) {
}
void crumble_wall(location where) {
ter_num_t ter;
if(loc_off_act_area(where))
return;
ter = univ.town->terrain(where.x,where.y);
if(univ.scenario.ter_types[ter].special == eTerSpec::CRUMBLING && univ.scenario.ter_types[ter].flag2 < 2) {
auto const &terrain =univ.get_terrain(univ.town->terrain(where.x,where.y));
if(terrain.special == eTerSpec::CRUMBLING && terrain.flag2 < 2) {
// TODO: This seems like the wrong sound
play_sound(60);
univ.town->terrain(where.x,where.y) = univ.scenario.ter_types[ter].flag1;
univ.town->terrain(where.x,where.y) = terrain.flag1;
add_string_to_buf(" Barrier crumbles.");
}
@@ -2595,7 +2593,7 @@ short race_present(eRace which_race) {
}
short wilderness_lore_present(ter_num_t ter_type) {
cTerrain& ter = univ.scenario.ter_types[ter_type];
cTerrain const & ter = univ.get_terrain(ter_type);
if(ter.special == eTerSpec::WILDERNESS_CAVE || ter.special == eTerSpec::WATERFALL_CAVE)
return trait_present(eTrait::CAVE_LORE);
else if(ter.special == eTerSpec::WILDERNESS_SURFACE || ter.special == eTerSpec::WATERFALL_SURFACE)

View File

@@ -175,7 +175,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
std::cout << "Note: Improper mode passed to check_special_terrain: " << int(mode) << std::endl;
return false;
}
cTerrain const &terrain=univ.scenario.ter_types[ter];
cTerrain const &terrain=univ.get_terrain(ter);
ter_special = terrain.special;
ter_flag1 = terrain.flag1;
ter_flag2 = terrain.flag2;
@@ -215,14 +215,14 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
if (univ.scenario.is_legacy) {
// checkme in combat.c this is only called when is_combat() && ter_pic==406
// (ie. ter_anim+6) due to a logical error
cPictNum pict=univ.scenario.ter_types[coord_to_ter(where_check.x,where_check.y)].get_picture_num();
cPictNum pict=univ.get_terrain(coord_to_ter(where_check.x,where_check.y)).get_picture_num();
if (pict.num==6 && pict.type==ePicType::PIC_TER_ANIM) {
ASB("Move: Can't trigger this special in combat.");
return true;
}
}
else {
if(univ.town.is_spot(where_check.x, where_check.y) || univ.scenario.ter_types[coord_to_ter(where_check.x,where_check.y)].trim_type == eTrimType::CITY) {
if(univ.town.is_spot(where_check.x, where_check.y) || univ.get_terrain(coord_to_ter(where_check.x,where_check.y)).trim_type == eTrimType::CITY) {
ASB("Move: Can't trigger this special in combat.");
return true; // TODO: Maybe replace eTrimType::CITY with a blockage == clear/special && is_special() check
// Note: The purpose of the above check is to avoid portals.
@@ -335,7 +335,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
play_sound(-1 * ter_flag2);
}
give_help(47,65);
if(univ.scenario.ter_types[ter].blocksMove())
if(terrain.blocksMove())
can_enter = false;
break;
case eTerSpec::DAMAGING:
@@ -1024,7 +1024,7 @@ void use_item(short pc,short item) {
case ePartyStatus::DETECT_LIFE: ASB(" Your vision of life becomes blurry."); break;
case ePartyStatus::FLIGHT:
if(i <= str) {
if(univ.scenario.ter_types[univ.out[univ.party.out_loc.x][univ.party.out_loc.y]].blocksMove()) {
if(univ.get_terrain(univ.out[univ.party.out_loc.x][univ.party.out_loc.y]).blocksMove()) {
add_string_to_buf(" You plummet to your deaths.");
slay_party(eMainStatus::DEAD);
print_buf();
@@ -1206,10 +1206,9 @@ void use_item(short pc,short item) {
// Returns true if an action is actually carried out. This can only be reached in town.
bool use_space(location where) {
ter_num_t ter;
location from_loc,to_loc;
ter = univ.town->terrain(where.x,where.y);
cTerrain const terrain = univ.get_terrain(univ.town->terrain(where.x,where.y));
from_loc = univ.party.town_loc;
add_string_to_buf("Use...");
@@ -1258,23 +1257,23 @@ bool use_space(location where) {
univ.town.set_block(to_loc.x,to_loc.y,true);
}
if(univ.scenario.ter_types[ter].special == eTerSpec::CHANGE_WHEN_USED) {
if(terrain.special == eTerSpec::CHANGE_WHEN_USED) {
if(where == from_loc) {
add_string_to_buf(" Not while on space.");
return false;
}
add_string_to_buf(" OK.");
alter_space(where.x,where.y,univ.scenario.ter_types[ter].flag1);
if(univ.scenario.ter_types[ter].flag2 >= 0)
play_sound(univ.scenario.ter_types[ter].flag2);
alter_space(where.x,where.y,terrain.flag1);
if(terrain.flag2 >= 0)
play_sound(terrain.flag2);
return true;
} else if(univ.scenario.ter_types[ter].special == eTerSpec::CALL_SPECIAL_WHEN_USED) {
} else if(terrain.special == eTerSpec::CALL_SPECIAL_WHEN_USED) {
eSpecCtxType spec_type = eSpecCtxType::SCEN;
if(univ.scenario.ter_types[ter].flag2 == 1){
if(terrain.flag2 == 1){
if(is_town() || (is_combat() && which_combat_type == 1)) spec_type = eSpecCtxType::TOWN;
else spec_type = eSpecCtxType::OUTDOOR;
}
run_special(eSpecCtx::USE_SPACE, spec_type, univ.scenario.ter_types[ter].flag1, where);
run_special(eSpecCtx::USE_SPACE, spec_type, terrain.flag1, where);
return true;
}
add_string_to_buf(" Nothing to use.");
@@ -1286,7 +1285,6 @@ bool use_space(location where) {
// specials return false, can't get items inside. If true, can get items inside.
// Can't get items out in combat.
bool adj_town_look(location where) {
ter_num_t terrain;
bool can_open = true,item_there = false,got_special = false;
short s1 = 0;
@@ -1295,7 +1293,6 @@ bool adj_town_look(location where) {
(where == univ.town.items[i].item_loc))
item_there = true;
terrain = univ.town->terrain(where.x,where.y);
if(univ.town.is_special(where.x,where.y)) {// && (get_blockage(terrain) > 0)) {
if(!adjacent(univ.party.town_loc,where))
add_string_to_buf(" Not close enough to search.");
@@ -1315,10 +1312,11 @@ bool adj_town_look(location where) {
put_item_screen(stat_window);
}
}
ter_num_t const terrain = univ.town->terrain(where.x,where.y);
if(is_container(where) && item_there && can_open) {
get_item(where,6,true);
}else if(univ.scenario.ter_types[terrain].special == eTerSpec::CHANGE_WHEN_USED ||
univ.scenario.ter_types[terrain].special == eTerSpec::CALL_SPECIAL_WHEN_USED) {
}else if(univ.get_terrain(terrain).special == eTerSpec::CHANGE_WHEN_USED ||
univ.get_terrain(terrain).special == eTerSpec::CALL_SPECIAL_WHEN_USED) {
add_string_to_buf(" (Use this space to do something with it.)", 2);
}else{
if(!got_special)
@@ -1682,8 +1680,8 @@ void push_things() {
if(univ.town.monst[i].active > 0) {
l = univ.town.monst[i].cur_loc;
ter = univ.town->terrain(l.x,l.y);
if (univ.scenario.ter_types[ter].special==eTerSpec::CONVEYOR) {
switch(univ.scenario.ter_types[ter].flag1) { // TODO: Implement the other 4 possible directions
if (univ.get_terrain(ter).special==eTerSpec::CONVEYOR) {
switch(univ.get_terrain(ter).flag1) { // TODO: Implement the other 4 possible directions
case DIR_N: l.y--; break;
case DIR_E: l.x++; break;
case DIR_S: l.y++; break;
@@ -1701,8 +1699,8 @@ void push_things() {
if(univ.town.items[i].variety != eItemType::NO_ITEM) {
l = univ.town.items[i].item_loc;
ter = univ.town->terrain(l.x,l.y);
if (univ.scenario.ter_types[ter].special==eTerSpec::CONVEYOR) {
switch(univ.scenario.ter_types[ter].flag1) { // TODO: Implement the other 4 possible directions
if (univ.get_terrain(ter).special==eTerSpec::CONVEYOR) {
switch(univ.get_terrain(ter).flag1) { // TODO: Implement the other 4 possible directions
case DIR_N: l.y--; break;
case DIR_E: l.x++; break;
case DIR_S: l.y++; break;
@@ -1720,8 +1718,8 @@ void push_things() {
if(is_town()) {
ter = univ.town->terrain(univ.party.town_loc.x,univ.party.town_loc.y);
l = univ.party.town_loc;
if (univ.scenario.ter_types[ter].special==eTerSpec::CONVEYOR) {
switch(univ.scenario.ter_types[ter].flag1) { // TODO: Implement the other 4 possible directions
if (univ.get_terrain(ter).special==eTerSpec::CONVEYOR) {
switch(univ.get_terrain(ter).flag1) { // TODO: Implement the other 4 possible directions
case DIR_N: l.y--; break;
case DIR_E: l.x++; break;
case DIR_S: l.y++; break;
@@ -1731,7 +1729,7 @@ void push_things() {
if(l != univ.party.town_loc) {
// TODO: Will this push you into a placed forcecage or barrier? Should it?
ASB("You get pushed.");
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
if(univ.get_terrain(ter).special == eTerSpec::CONVEYOR)
draw_terrain(0);
center = l;
univ.party.town_loc = l;
@@ -1761,8 +1759,8 @@ void push_things() {
if(univ.party[i].main_status == eMainStatus::ALIVE) {
ter = univ.town->terrain(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y);
l = univ.party[i].combat_pos;
if (univ.scenario.ter_types[ter].special==eTerSpec::CONVEYOR) {
switch(univ.scenario.ter_types[ter].flag1) { // TODO: Implement the other 4 possible directions
if (univ.get_terrain(ter).special==eTerSpec::CONVEYOR) {
switch(univ.get_terrain(ter).flag1) { // TODO: Implement the other 4 possible directions
case DIR_N: l.y--; break;
case DIR_E: l.x++; break;
case DIR_S: l.y++; break;
@@ -1772,7 +1770,7 @@ void push_things() {
if(l != univ.party[i].combat_pos) {
ASB("Someone gets pushed.");
ter = univ.town->terrain(l.x,l.y);
if(univ.scenario.ter_types[ter].special == eTerSpec::CONVEYOR)
if(univ.get_terrain(ter).special == eTerSpec::CONVEYOR)
draw_terrain(0);
univ.party[i].combat_pos = l;
update_explored(l);
@@ -1904,6 +1902,7 @@ void special_increase_age(long length, bool queue) {
for(short i = 0; i < party_timers.size(); i++) {
if(party_timers[i].time <= length) {
univ.party.age = age_before + party_timers[i].time;
univ.party.age = long(age_before) + party_timers[i].time;
auto which_type = party_timers[i].node_type;
bool need_redraw = false;
if(queue)
@@ -2360,7 +2359,7 @@ void general_spec(const runtime_state& ctx) {
check_mess = true;
break;
case eSpecType::TRANS_TER:
alter_space(spec.ex1a,spec.ex1b,univ.scenario.ter_types[coord_to_ter(spec.ex1a,spec.ex1b)].trans_to_what);
alter_space(spec.ex1a,spec.ex1b,univ.get_terrain(coord_to_ter(spec.ex1a,spec.ex1b)).trans_to_what);
*ctx.redraw = true;
minimap::draw(true);
check_mess = true;
@@ -2409,7 +2408,7 @@ void general_spec(const runtime_state& ctx) {
break;
case eSpecType::APPEND_TER:
if(spec.pic) univ.get_buf() += ' ';
univ.get_buf() += univ.scenario.ter_types[spec.ex1a].name;
univ.get_buf() += univ.get_terrain(spec.ex1a).name;
break;
case eSpecType::SWAP_STR_BUF:
univ.swap_buf(spec.ex1a);
@@ -3791,14 +3790,14 @@ void townmode_spec(const runtime_state& ctx) {
break;
case eSpecType::TOWN_LOCK_SPACE:
ter = coord_to_ter(spec.ex1a,spec.ex1b);
if(univ.scenario.ter_types[ter].special == eTerSpec::LOCKABLE)
alter_space(l.x,l.y,univ.scenario.ter_types[ter].flag1);
if(univ.get_terrain(ter).special == eTerSpec::LOCKABLE)
alter_space(l.x,l.y,univ.get_terrain(ter).flag1);
*ctx.redraw = true;
break;
case eSpecType::TOWN_UNLOCK_SPACE:
ter = coord_to_ter(spec.ex1a,spec.ex1b);
if(univ.scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE)
alter_space(l.x,l.y,univ.scenario.ter_types[ter].flag1);
if(univ.get_terrain(ter).special == eTerSpec::UNLOCKABLE)
alter_space(l.x,l.y,univ.get_terrain(ter).flag1);
*ctx.redraw = true;
break;
case eSpecType::TOWN_SFX_BURST:
@@ -3938,7 +3937,7 @@ void townmode_spec(const runtime_state& ctx) {
else {
int x = univ.party.get_ptr(10), y = univ.party.get_ptr(11);
ter = coord_to_ter(x, y);
alter_space(x,y,univ.scenario.ter_types[ter].trans_to_what);
alter_space(x,y,univ.get_terrain(ter).trans_to_what);
ctx.next_spec = spec.ex1b;
}
}
@@ -4432,20 +4431,20 @@ void rect_spec(const runtime_state& ctx){
break;
case eSpecType::RECT_TRANS_TER:
ter = coord_to_ter(i,j);
alter_space(l.x,l.y,univ.scenario.ter_types[ter].trans_to_what);
alter_space(l.x,l.y,univ.get_terrain(ter).trans_to_what);
*ctx.redraw = minimap_changed = true;
break;
case eSpecType::RECT_LOCK:
ter = coord_to_ter(i,j);
if(univ.scenario.ter_types[ter].special == eTerSpec::LOCKABLE){
alter_space(l.x,l.y,univ.scenario.ter_types[ter].flag1);
if(univ.get_terrain(ter).special == eTerSpec::LOCKABLE){
alter_space(l.x,l.y,univ.get_terrain(ter).flag1);
*ctx.redraw = minimap_changed = true;
}
break;
case eSpecType::RECT_UNLOCK:
ter = coord_to_ter(i,j);
if(univ.scenario.ter_types[ter].special == eTerSpec::UNLOCKABLE){
alter_space(l.x,l.y,univ.scenario.ter_types[ter].flag1);
if(univ.get_terrain(ter).special == eTerSpec::UNLOCKABLE){
alter_space(l.x,l.y,univ.get_terrain(ter).flag1);
*ctx.redraw = minimap_changed = true;
break;
}

View File

@@ -876,13 +876,9 @@ std::string get_m_name(mon_num_t num) {
return univ.scenario.scen_monsters[num].m_name;
}
std::string get_ter_name(ter_num_t num) {
std::string store_name = "Pit";
if((num == 90) && ((is_out()) || (is_town()) || ((is_combat()) && (which_combat_type == 1))));
else {
store_name = univ.scenario.ter_types[num].name;
}
return store_name;
if(num == 90 && (is_out() || is_town() || (is_combat() && which_combat_type == 1)))
return "Pit";
return univ.get_terrain(num).name;
}
void print_monst_name(mon_num_t m_type) {

View File

@@ -129,7 +129,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(univ.scenario.ter_types[univ.town->terrain(i,j)].special == eTerSpec::CONVEYOR)
if(univ.get_terrain(univ.town->terrain(i,j)).special == eTerSpec::CONVEYOR)
univ.town.belt_present = true;
}
@@ -803,7 +803,7 @@ void create_out_combat_terrain(short ter_type,short num_walls,bool is_road) {
static const std::set<int> surface_arenas = {0,2,9,10,11,12};
location stuff_ul;
arena = univ.scenario.ter_types[ter_type].combat_arena;
arena = univ.get_terrain(ter_type).combat_arena;
if(arena >= 1000) {
arena -= 1000;
// We take the terrain from the specified town, and nothing else.
@@ -1075,11 +1075,12 @@ 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) {
auto const &terrain_type=univ.get_terrain(terrain);
if(terrain_type.special != eTerSpec::UNLOCKABLE) {
add_string_to_buf(" Wrong terrain type.");
return;
}
unlock_adjust = univ.scenario.ter_types[terrain].flag2;
unlock_adjust = terrain_type.flag2;
if((unlock_adjust >= 5) || (r1 > (unlock_adjust * 15 + 30))) {
add_string_to_buf(" Didn't work.");
if(will_break) {
@@ -1093,7 +1094,7 @@ void pick_lock(location where,short pc_num) {
else {
add_string_to_buf(" Door unlocked.");
play_sound(9);
univ.town->terrain(where.x,where.y) = univ.scenario.ter_types[terrain].flag1;
univ.town->terrain(where.x,where.y) = terrain_type.flag1;
}
}
@@ -1104,20 +1105,21 @@ void bash_door(location where,short pc_num) {
terrain = univ.town->terrain(where.x,where.y);
r1 = get_ran(1,1,100) - 15 * univ.party[pc_num].stat_adj(eSkill::STRENGTH) + univ.town.difficulty * 4;
if(univ.scenario.ter_types[terrain].special != eTerSpec::UNLOCKABLE) {
auto const &terrain_type=univ.get_terrain(terrain);
if(terrain_type.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 + 40) || univ.scenario.ter_types[terrain].flag3 != 1) {
unlock_adjust = terrain_type.flag2;
if(unlock_adjust >= 5 || r1 > (unlock_adjust * 15 + 40) || terrain_type.flag3 != 1) {
add_string_to_buf(" Didn't work.");
damage_pc(univ.party[pc_num],get_ran(1,1,4),eDamageType::SPECIAL,eRace::UNKNOWN,0);
}
else {
add_string_to_buf(" Lock breaks.");
play_sound(9);
univ.town->terrain(where.x,where.y) = univ.scenario.ter_types[terrain].flag1;
univ.town->terrain(where.x,where.y) = terrain_type.flag1;
}
}
@@ -1162,7 +1164,7 @@ void erase_hidden_towns(cOutdoors& sector, int quadrant_x, int quadrant_y) {
auto spec_pos_y = sector.city_locs[tile_index].y;
auto area_index = sector.terrain[spec_pos_x][spec_pos_y];
if(!univ.scenario.towns[sector.city_locs[tile_index].spec]->can_find) {
univ.out[town_pos_x][town_pos_y] = univ.scenario.ter_types[area_index].flag1;
univ.out[town_pos_x][town_pos_y] = univ.get_terrain(area_index).flag1;
} else {
univ.out[town_pos_x][town_pos_y] = area_index;
}
@@ -1192,13 +1194,13 @@ void erase_completed_specials(cArea& sector, std::function<void(location)> clear
bool does_location_have_special(cOutdoors& sector, location loc, eTerSpec special) {
auto terrain_index = sector.terrain[loc.x][loc.y];
return univ.scenario.ter_types[terrain_index].special == special;
return univ.get_terrain(terrain_index).special == special;
}
bool is_door(location destination) {
if(univ.scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == eTerSpec::UNLOCKABLE ||
univ.scenario.ter_types[univ.town->terrain(destination.x,destination.y)].special == eTerSpec::CHANGE_WHEN_STEP_ON)
auto terrain_index=univ.town->terrain(destination.x,destination.y);
if(univ.get_terrain(terrain_index).special == eTerSpec::UNLOCKABLE ||
univ.get_terrain(terrain_index).special == eTerSpec::CHANGE_WHEN_STEP_ON)
return true;
return false;
}

View File

@@ -172,7 +172,7 @@ bool handle_lever(location w) {
if(cChoiceDlog("basic-lever",{"pull", "leave"}).show() == "leave")
return false;
play_sound(94);
alter_space(w.x,w.y,univ.scenario.ter_types[univ.town->terrain(w.x,w.y)].trans_to_what);
alter_space(w.x,w.y,univ.get_terrain(univ.town->terrain(w.x,w.y)).trans_to_what);
return true;
}

View File

@@ -170,49 +170,45 @@ void port_scenario(legacy::scenario_data_type* temp_scenario) {
flip_short(&temp_scenario->out_data_size[i][j]);
for(short i = 0; i < 3; i++)
flip_short(&temp_scenario->store_item_towns[i]);
for(short i = 0; i < 50; i++)
flip_short(&temp_scenario->special_items[i]);
for(short i = 0; i < 50; i++)
flip_short(&temp_scenario->special_item_special[i]);
for(auto &item : temp_scenario->special_items)
flip_short(&item);
for(auto &item : temp_scenario->special_item_special)
flip_short(&item);
flip_short(&temp_scenario->rating);
flip_short(&temp_scenario->uses_custom_graphics);
for(short i = 0; i < 256; i++) {
flip_short(&temp_scenario->scen_monsters[i].health);
flip_short(&temp_scenario->scen_monsters[i].m_health);
flip_short(&temp_scenario->scen_monsters[i].max_mp);
flip_short(&temp_scenario->scen_monsters[i].mp);
flip_short(&temp_scenario->scen_monsters[i].a[1]);
flip_short(&temp_scenario->scen_monsters[i].a[0]);
flip_short(&temp_scenario->scen_monsters[i].a[2]);
flip_short(&temp_scenario->scen_monsters[i].morale);
flip_short(&temp_scenario->scen_monsters[i].m_morale);
flip_short(&temp_scenario->scen_monsters[i].corpse_item);
flip_short(&temp_scenario->scen_monsters[i].corpse_item_chance);
flip_short(&temp_scenario->scen_monsters[i].picture_num);
for(auto &monster : temp_scenario->scen_monsters) {
flip_short(&monster.health);
flip_short(&monster.m_health);
flip_short(&monster.max_mp);
flip_short(&monster.mp);
flip_short(&monster.a[0]);
flip_short(&monster.a[1]);
flip_short(&monster.a[2]);
flip_short(&monster.morale);
flip_short(&monster.m_morale);
flip_short(&monster.corpse_item);
flip_short(&monster.corpse_item_chance);
flip_short(&monster.picture_num);
}
for(short i = 0; i < 256; i++) {
flip_short(&temp_scenario->ter_types[i].picture);
}
for(short i = 0; i < 30; i++) {
flip_short(&temp_scenario->scen_boats[i].which_town);
}
for(short i = 0; i < 30; i++) {
flip_short(&temp_scenario->scen_horses[i].which_town);
}
for(short i = 0; i < 20; i++)
flip_short(&temp_scenario->scenario_timer_times[i]);
for(short i = 0; i < 20; i++)
flip_short(&temp_scenario->scenario_timer_specs[i]);
for(short i = 0; i < 256; i++) {
flip_spec_node(&temp_scenario->scen_specials[i]);
}
for(short i = 0; i < 10; i++) {
flip_short(&temp_scenario->storage_shortcuts[i].ter_type);
flip_short(&temp_scenario->storage_shortcuts[i].property);
for (auto &terrain : temp_scenario->ter_types)
flip_short(&terrain.picture);
for(auto &boat : temp_scenario->scen_boats)
flip_short(&boat.which_town);
for(auto &horse : temp_scenario->scen_horses)
flip_short(&horse.which_town);
for(auto &timer : temp_scenario->scenario_timer_times)
flip_short(&timer);
for(auto &timer : temp_scenario->scenario_timer_specs)
flip_short(&timer);
for(auto &special : temp_scenario->scen_specials)
flip_spec_node(&special);
for(auto &shortcut : temp_scenario->storage_shortcuts) {
flip_short(&shortcut.ter_type);
flip_short(&shortcut.property);
for(short j = 0; j < 10; j++) {
flip_short(&temp_scenario->storage_shortcuts[i].item_num[j]);
flip_short(&temp_scenario->storage_shortcuts[i].item_odds[j]);
flip_short(&shortcut.item_num[j]);
flip_short(&shortcut.item_odds[j]);
}
}
flip_short(&temp_scenario->last_town_edited);

View File

@@ -34,10 +34,10 @@ void cOutdoors::import_legacy(legacy::outdoor_record_type const &old){
for(short i = 0; i < 48; i++)
for(short j = 0; j < 48; j++){
terrain[i][j] = old.terrain[i][j];
if(scenario->ter_types[terrain[i][j]].i == 3000) // marker to indicate it used to be a special spot
if(scenario->get_terrain(terrain[i][j]).i == 3000) // marker to indicate it used to be a special spot
special_spot[i][j] = true;
else special_spot[i][j] = false;
if(scenario->ter_types[terrain[i][j]].i == 3001) // marker to indicate it used to be a road
if(scenario->get_terrain(terrain[i][j]).i == 3001) // marker to indicate it used to be a road
roads[i][j] = true;
else roads[i][j] = false;
// Convert roads that crossed grass/hill boundaries
@@ -50,19 +50,19 @@ void cOutdoors::import_legacy(legacy::outdoor_record_type const &old){
if(old.terrain[i][j] == 81 && i > 0 && i < 47 && j > 0 && j < 47) {
if(old.terrain[i+1][j] == 81) {
ter_num_t connect = old.terrain[i-1][j];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 44;
} else if(old.terrain[i-1][j] == 81) {
ter_num_t connect = old.terrain[i+1][j];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 40;
} else if(old.terrain[i][j+1] == 81) {
ter_num_t connect = old.terrain[i][j-1];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 42;
} else if(old.terrain[i][j-1] == 81) {
ter_num_t connect = old.terrain[i][j+1];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 38;
}
}

View File

@@ -8,6 +8,7 @@
#include "scenario.hpp"
#include <cmath>
#include <string>
#include <vector>
#include <map>
@@ -326,7 +327,7 @@ void cScenario::import_legacy(legacy::scen_item_data_type const &old){
if(scen_monsters[i].m_type == eRace::HUMANOID && scen_monsters[i].m_name.find("Goblin") != std::string::npos)
scen_monsters[i].m_type = eRace::GOBLIN;
}
for(short i = 0; i < 256; i++)
for(short i = 0; i < std::min<short>(256, ter_types.size()); i++)
ter_types[i].name = old.ter_names[i];
// Some default shops - the five magic shops and the healing shop.
cShop magic_shop(SHOP_JUNK);
@@ -350,7 +351,7 @@ std::string cScenario::format_scen_version() {
}
ter_num_t cScenario::get_ground_from_ter(ter_num_t ter){
return get_ter_from_ground(ter_types[ter].ground_type);
return get_ter_from_ground(get_terrain(ter).ground_type);
}
ter_num_t cScenario::get_ter_from_ground(unsigned short ground){

View File

@@ -195,7 +195,7 @@ void cTown::set_up_lights() {
l.y = j;
unsigned short terrain=this->terrain(i,j);
rad = terrain<scenario->ter_types.size() ?
scenario->ter_types[terrain].light_radius : 0;
scenario->get_terrain(terrain).light_radius : 0;
if(rad > 0) {
for(where.x = std::max(0,i - rad); where.x < min(this->max_dim,short(i + rad + 1)); where.x++)
for(where.y = std::max(0,j - rad); where.y < min(this->max_dim,short(j + rad + 1)); where.y++)
@@ -211,7 +211,7 @@ short cTown::light_obscurity(short x,short y) {
what_terrain = this->terrain(x,y);
store = scenario->ter_types[what_terrain].blockage;
store = scenario->get_terrain(what_terrain).blockage;
if(store == eTerObstruct::BLOCK_SIGHT || store == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
return 5;
if(store == eTerObstruct::BLOCK_MOVE_AND_SHOOT)

View File

@@ -45,12 +45,12 @@ void cTown::import_legacy(T const & old, int){
for(short j = 0; j < sizes::dim; j++) {
terrain[i][j] = old.terrain[i][j];
lighting[i][j] = old.lighting[i / 8][j] & (1 << (i % 8));
if(scenario->ter_types[terrain[i][j]].i == 3000) { // marker to indicate it used to be a special spot
if(scenario->get_terrain(terrain[i][j]).i == 3000) { // marker to indicate it used to be a special spot
the_field.loc.x = i;
the_field.loc.y = j;
preset_fields.push_back(the_field);
}
if(scenario->ter_types[terrain[i][j]].i == 3001) { // marker to indicate it used to be a road
if(scenario->get_terrain(terrain[i][j]).i == 3001) { // marker to indicate it used to be a road
the_road.loc.x = i;
the_road.loc.y = j;
preset_fields.push_back(the_road);
@@ -65,23 +65,23 @@ void cTown::import_legacy(T const & old, int){
if(old.terrain[i][j] == 81 && i > 0 && i < 47 && j > 0 && j < 47) {
if(old.terrain[i+1][j] == 81) {
ter_num_t connect = old.terrain[i-1][j];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 44;
} else if(old.terrain[i-1][j] == 81) {
ter_num_t connect = old.terrain[i+1][j];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 40;
} else if(old.terrain[i][j+1] == 81) {
ter_num_t connect = old.terrain[i][j-1];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 42;
} else if(old.terrain[i][j-1] == 81) {
ter_num_t connect = old.terrain[i][j+1];
if(connect == 80 || scenario->ter_types[connect].trim_type == eTrimType::CITY)
if(connect == 80 || scenario->get_terrain(connect).trim_type == eTrimType::CITY)
terrain[i][j] = 38;
}
}
if(scenario->ter_types[terrain[i][j]].boat_over) {
if(scenario->get_terrain(terrain[i][j]).boat_over) {
// Try to fix specials that could be triggered while in a boat
// (Boats never triggered specials in the old BoE, so we probably don't want them to trigger.)
int found_spec = -1;

View File

@@ -94,12 +94,10 @@ void cCurTown::import_reset_fields_legacy(){
fields[f.loc.x][f.loc.y]|=f.type;
}
auto const &terrain=record()->terrain;
auto const &maxTerrain=univ.scenario.ter_types.max_size();
for (auto const &spec : record()->special_locs) {
if (spec.spec<0 || spec.x<0 || spec.x>=terrain.width() ||
spec.y<0 || spec.y>=terrain.height()) continue;
ter_num_t id=terrain[spec.x][spec.y];
if (id>=0 && id<maxTerrain && univ.scenario.ter_types[id].i==3000)
if (univ.get_terrain(terrain[spec.x][spec.y]).i==3000)
fields[spec.x][spec.y]|=SPECIAL_SPOT;
}
}
@@ -580,11 +578,11 @@ bool cCurTown::set_force_barr(short x, short y, bool b){
bool cCurTown::set_quickfire(short x, short y, bool b){
if(x > record()->max_dim || y > record()->max_dim) return false;
if(b){ // If certain things are on space, there's no room for quickfire.
ter_num_t ter = record()->terrain(x,y);
if(univ.scenario.ter_types[ter].blockage == eTerObstruct::BLOCK_SIGHT)
cTerrain const &terrain=univ.get_terrain(record()->terrain(x,y));
if(terrain.blockage == eTerObstruct::BLOCK_SIGHT)
return false;
// TODO: Isn't it a little odd that BLOCK_MOVE_AND_SHOOT isn't included here?
if(univ.scenario.ter_types[ter].blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
if(terrain.blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
return false;
if(is_antimagic(x,y) && get_ran(1,0,1) == 0)
return false;
@@ -610,11 +608,8 @@ bool cCurTown::set_quickfire(short x, short y, bool b){
}
bool cCurTown::free_for_sfx(short x, short y) {
ter_num_t ter;
ter = record()->terrain(x,y);
if(univ.scenario.ter_types[ter].blockage != eTerObstruct::CLEAR)
return false;
return true;
cTerrain const &terrain= univ.get_terrain(record()->terrain(x,y));
return terrain.blockage == eTerObstruct::CLEAR;
}
bool cCurTown::set_sm_blood(short x, short y, bool b){
@@ -765,10 +760,8 @@ bool cCurTown::set_force_cage(short x, short y, bool b){
// TODO: This seems to be wrong; impassable implies "blocks movement", which two other blockages also do
bool cCurTown::is_impassable(short i,short j) {
ter_num_t ter;
ter = record()->terrain(i,j);
if(univ.scenario.ter_types[ter].blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
cTerrain const &terrain=univ.get_terrain(record()->terrain(i,j));
if(terrain.blockage == eTerObstruct::BLOCK_MOVE_AND_SIGHT)
return true;
else return false;
}
@@ -841,7 +834,7 @@ void cCurTown::readFrom(std::istream& file){
sin >> cur;
if(cur == "TOWN") {
sin >> univ.party.town_num;
monst.which_town=univ.party.town_num; // OSNOLA, checkme: to fix the creature save
monst.which_town=univ.party.town_num; // OSNOLA
}
else if(cur == "DIFFICULTY")
sin >> difficulty;

View File

@@ -17,9 +17,9 @@
#include "party.hpp"
#include "population.hpp"
#include "item.hpp"
#include "town.hpp"
#include "talking.hpp"
#include "scenario.hpp"
#include "talking.hpp"
#include "town.hpp"
#include "pictypes.hpp"
namespace legacy {
@@ -214,6 +214,10 @@ public:
short difficulty_adjust() const;
explicit cUniverse(ePartyPreset party_type = PARTY_DEFAULT);
~cUniverse();
cTerrain const &get_terrain(ter_num_t ter) const { return scenario.get_terrain(ter); }
cTerrain &get_terrain(ter_num_t ter) { return scenario.get_terrain(ter); }
// Copy-and-swap
void swap(cUniverse& other);
cUniverse(const cUniverse& other);