Refactored erase_out_specials();

This commit is contained in:
Mark Clark
2018-02-17 17:10:34 -05:00
parent 05b6a9689f
commit a2dc641f31
6 changed files with 82 additions and 47 deletions

View File

@@ -16,6 +16,7 @@
#include "vector2d.hpp"
#include "location.hpp"
#include "special.hpp"
#include "mathutil.hpp"
enum {
AREA_TINY = 24,
@@ -41,6 +42,11 @@ public:
, terrain(dim, dim)
, maps(dim, boost::dynamic_bitset<>(dim))
{}
bool is_on_map(location loc) const
{
return loc.x < max_dim && loc.y < max_dim && loc.x >= 0 && loc.y >= 0;
}
};
#endif

View File

@@ -528,3 +528,14 @@ cItem cScenario::return_treasure(int loot, bool allow_junk) {
treas.value = 0;
return treas;
}
cOutdoors& cScenario::get_sector(int x, int y)
{
return *outdoors[x][y];
}
bool cScenario::is_town_entrance_valid(spec_loc_t loc) const
{
auto towns_in_scenario = towns.size();
return loc.spec >= 0 && loc.spec < towns_in_scenario;
}

View File

@@ -103,6 +103,8 @@ public:
ter_num_t get_ground_from_ter(ter_num_t ter);
ter_num_t get_ter_from_ground(unsigned short ground);
ter_num_t get_trim_terrain(unsigned short ground, unsigned short trim_g, eTrimType trim);
cOutdoors& get_sector(int x, int y);
bool is_town_entrance_valid(spec_loc_t loc) const;
bool is_ter_used(ter_num_t ter);
bool is_monst_used(mon_num_t monst);

View File

@@ -16,6 +16,8 @@
namespace legacy { struct special_node_type; };
static const short SDF_COMPLETE = 250;
// TODO: Add win/lose option to END_SCENARIO
// TODO: Allow OUT_MOVE_PARTY to change the current sector
enum class eSpecType {