WIP: SDF Finder WIP #715
@@ -609,4 +609,34 @@ std::string cScenario::get_sdf_name(int row, int col) {
|
|||||||
if(sdf_names[row].find(col) == sdf_names[row].end())
|
if(sdf_names[row].find(col) == sdf_names[row].end())
|
||||||
return "";
|
return "";
|
||||||
return sdf_names[row][col];
|
return sdf_names[row][col];
|
||||||
|
}
|
||||||
|
|
||||||
|
void cScenario::for_each_special(std::function<void(const cSpecial&)> callback) {
|
||||||
|
for_each_scen_special(callback);
|
||||||
|
for(int town = 0; town < towns.size(); ++town){
|
||||||
|
for_each_town_special(town, callback);
|
||||||
|
}
|
||||||
|
for(int x = 0; x < outdoors.width(); ++x){
|
||||||
|
for(int y = 0; y < outdoors.height(); ++y){
|
||||||
|
for_each_out_special(x, y, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cScenario::for_each_scen_special(std::function<void(const cSpecial&)> callback) {
|
||||||
|
for(cSpecial special : scen_specials){
|
||||||
|
callback(special);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cScenario::for_each_town_special(int town, std::function<void(const cSpecial&)> callback) {
|
||||||
|
for(cSpecial special : towns[town]->specials){
|
||||||
|
callback(special);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cScenario::for_each_out_special(int sector_x, int sector_y, std::function<void(const cSpecial&)> callback) {
|
||||||
|
for(cSpecial special : outdoors[sector_x][sector_y]->specials){
|
||||||
|
callback(special);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,12 @@ public:
|
|||||||
cItemStorage& operator = (legacy::item_storage_shortcut_type& old);
|
cItemStorage& operator = (legacy::item_storage_shortcut_type& old);
|
||||||
};
|
};
|
||||||
void destroy_terrain();
|
void destroy_terrain();
|
||||||
|
// Iterate through EVERY special node with a callback.
|
||||||
|
void for_each_special(std::function<void(const cSpecial&)> callback);
|
||||||
|
// Factored into 3 separate functions in case there's ever a reason to be more selective:
|
||||||
|
void for_each_scen_special(std::function<void(const cSpecial&)> callback);
|
||||||
|
void for_each_town_special(int town, std::function<void(const cSpecial&)> callback);
|
||||||
|
void for_each_out_special(int sector_x, int sector_y, std::function<void(const cSpecial&)> callback);
|
||||||
public:
|
public:
|
||||||
unsigned short difficulty,intro_pic,default_ground;
|
unsigned short difficulty,intro_pic,default_ground;
|
||||||
int bg_out, bg_fight, bg_town, bg_dungeon;
|
int bg_out, bg_fight, bg_town, bg_dungeon;
|
||||||
|
|||||||
Reference in New Issue
Block a user