Add three more map features to the map parser
This commit is contained in:
@@ -371,7 +371,7 @@ bool load_town(fs::path town_base, short which_town, cTown*& the_town) {
|
||||
fname = base_fname + ".xml";
|
||||
// Next, load in the town map.
|
||||
fname = base_fname + ".map";
|
||||
map_data map = load_map(town_base/fname);
|
||||
map_data map = load_map(town_base/fname, true);
|
||||
// Then load the town's special nodes.
|
||||
fname = base_fname + ".spec";
|
||||
// Load the town's special encounter strings
|
||||
@@ -468,7 +468,7 @@ bool load_outdoors(fs::path out_base, location which_out,cOutdoors& the_out) {
|
||||
fname = base_fname + ".xml";
|
||||
// Next, load in the sector map.
|
||||
fname = base_fname + ".map";
|
||||
map_data map = load_map(out_base/fname);
|
||||
map_data map = load_map(out_base/fname, false);
|
||||
// Then load the sector's special nodes.
|
||||
fname = base_fname + ".spec";
|
||||
// Load the sector's special encounter strings
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
map_data load_map(fs::path path) {
|
||||
map_data load_map(fs::path path, bool isTown) {
|
||||
map_data data;
|
||||
ifstream fin(path.string());
|
||||
int row = 0;
|
||||
@@ -53,8 +53,14 @@ map_data load_map(fs::path path) {
|
||||
curFeature = eMapFeature::SPECIAL_NODE;
|
||||
} else if(c == '!') {
|
||||
curFeature = eMapFeature::SIGN;
|
||||
} else if(c == '@') {
|
||||
} else if(c == '@' && !isTown) {
|
||||
curFeature = eMapFeature::TOWN;
|
||||
} else if(c == '@' && isTown) {
|
||||
curFeature = eMapFeature::ITEM;
|
||||
} else if(c == '&' && isTown) {
|
||||
curFeature = eMapFeature::FIELD;
|
||||
} else if(c == '$') {
|
||||
curFeature = eMapFeature::CREATURE;
|
||||
} else if(c == '~') {
|
||||
curFeature = eMapFeature::VEHICLE;
|
||||
} else if(c == 'h' && curFeature == eMapFeature::VEHICLE) {
|
||||
|
@@ -29,6 +29,9 @@ enum class eMapFeature {
|
||||
ENTRANCE_WEST,
|
||||
ENTRANCE_SOUTH,
|
||||
ENTRANCE_EAST,
|
||||
ITEM,
|
||||
CREATURE,
|
||||
FIELD,
|
||||
};
|
||||
|
||||
struct loc_compare {
|
||||
@@ -43,6 +46,6 @@ struct map_data {
|
||||
void addFeature(unsigned int x, unsigned int y, eMapFeature feature, int val = 0);
|
||||
};
|
||||
|
||||
map_data load_map(fs::path path);
|
||||
map_data load_map(fs::path path, bool isTown);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user