More migration to const & in legacy importing methods.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "spell.hpp"
|
||||
#include "gfxsheets.hpp" // for NO_PIC
|
||||
|
||||
void cMonster::import_legacy(legacy::monster_record_type& old){
|
||||
void cMonster::import_legacy(legacy::monster_record_type const &old){
|
||||
level = old.level;
|
||||
m_name = std::string((char*) old.m_name, 26);
|
||||
m_name.erase(m_name.begin() + m_name.find_first_of('\0'), m_name.end());
|
||||
@@ -437,7 +437,7 @@ cTownperson::cTownperson(location loc, mon_num_t num, const cMonster& monst) : c
|
||||
facial_pic = monst.default_facial_pic;
|
||||
}
|
||||
|
||||
void cTownperson::import_legacy(legacy::creature_start_type old){
|
||||
void cTownperson::import_legacy(legacy::creature_start_type const &old){
|
||||
number = old.number;
|
||||
start_attitude = eAttitude(old.start_attitude);
|
||||
start_loc.x = old.start_loc.x;
|
||||
|
@@ -73,7 +73,7 @@ public:
|
||||
std::map<eMonstAbil,uAbility>::iterator addAbil(eMonstAbilTemplate what, int param = 0);
|
||||
int addAttack(unsigned short dice, unsigned short sides, eMonstMelee type = eMonstMelee::SWING);
|
||||
|
||||
void import_legacy(legacy::monster_record_type& old);
|
||||
void import_legacy(legacy::monster_record_type const &old);
|
||||
cMonster();
|
||||
void writeTo(std::ostream& file) const;
|
||||
void readFrom(std::istream& file);
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
short special_on_kill, special_on_talk;
|
||||
pic_num_t facial_pic;
|
||||
|
||||
void import_legacy(legacy::creature_start_type old);
|
||||
void import_legacy(legacy::creature_start_type const &old);
|
||||
cTownperson();
|
||||
cTownperson(location loc, mon_num_t num, const cMonster& monst);
|
||||
};
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "oldstructs.hpp"
|
||||
#include "scenario.hpp"
|
||||
|
||||
void cOutdoors::import_legacy(legacy::outdoor_record_type& old){
|
||||
void cOutdoors::import_legacy(legacy::outdoor_record_type const &old){
|
||||
ambient_sound = AMBIENT_NONE;
|
||||
// Collect a list of unused special nodes, to be used for fixing specials that could be triggered in a boat.
|
||||
std::vector<int> unused_special_slots;
|
||||
@@ -126,7 +126,7 @@ cOutdoors::cOutdoors(cScenario& scenario) : cArea(AREA_MEDIUM), scenario(&scenar
|
||||
comment = "Comment";
|
||||
}
|
||||
|
||||
void cOutdoors::cWandering::import_legacy(legacy::out_wandering_type old){
|
||||
void cOutdoors::cWandering::import_legacy(legacy::out_wandering_type const &old){
|
||||
for(int i = 0; i < 7; i++)
|
||||
monst[i] = old.monst[i];
|
||||
for(int j = 0; j < 3; j++)
|
||||
@@ -140,7 +140,7 @@ void cOutdoors::cWandering::import_legacy(legacy::out_wandering_type old){
|
||||
end_spec2 = old.end_spec2;
|
||||
}
|
||||
|
||||
void cOutdoors::cCreature::import_legacy(legacy::outdoor_creature_type old){
|
||||
void cOutdoors::cCreature::import_legacy(legacy::outdoor_creature_type const &old){
|
||||
exists = old.exists;
|
||||
direction = old.direction;
|
||||
what_monst.import_legacy(old.what_monst);
|
||||
|
@@ -45,7 +45,7 @@ public:
|
||||
bool cant_flee, forced;
|
||||
|
||||
bool isNull();
|
||||
void import_legacy(legacy::out_wandering_type old);
|
||||
void import_legacy(legacy::out_wandering_type const &old);
|
||||
void writeTo(std::ostream& file, std::string prefix = "") const;
|
||||
void readFrom(std::istream& sin);
|
||||
cWandering();
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
cWandering what_monst;
|
||||
location which_sector,m_loc,home_sector; // home_sector is the sector it was spawned in
|
||||
|
||||
void import_legacy(legacy::outdoor_creature_type old);
|
||||
void import_legacy(legacy::outdoor_creature_type const &old);
|
||||
};
|
||||
short x,y; // Used while loading legacy scenarios.
|
||||
std::vector<spec_loc_t> city_locs;
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
int bg_out, bg_fight, bg_town, bg_dungeon;
|
||||
|
||||
explicit cOutdoors(cScenario& scenario);
|
||||
void import_legacy(legacy::outdoor_record_type& old);
|
||||
void import_legacy(legacy::outdoor_record_type const &old);
|
||||
void reattach(cScenario& to);
|
||||
};
|
||||
|
||||
|
@@ -210,7 +210,7 @@ cScenario::cItemStorage::cItemStorage() : ter_type(-1), property(0) {
|
||||
item_odds[i] = 0;
|
||||
}
|
||||
|
||||
void cScenario::import_legacy(legacy::scenario_data_type& old){
|
||||
void cScenario::import_legacy(legacy::scenario_data_type const &old){
|
||||
is_legacy = true;
|
||||
difficulty = old.difficulty;
|
||||
intro_pic = old.intro_pic;
|
||||
@@ -277,7 +277,7 @@ void cScenario::import_legacy(legacy::scenario_data_type& old){
|
||||
adjust_diff = true;
|
||||
}
|
||||
|
||||
cScenario::cItemStorage& cScenario::cItemStorage::operator = (legacy::item_storage_shortcut_type& old){
|
||||
cScenario::cItemStorage& cScenario::cItemStorage::operator = (legacy::item_storage_shortcut_type const &old){
|
||||
ter_type = old.ter_type;
|
||||
for(int i = 0; i < 10; i++) item_num[i] = old.item_num[i];
|
||||
for(int i = 0; i < 10; i++) item_odds[i] = old.item_odds[i];
|
||||
@@ -285,7 +285,7 @@ cScenario::cItemStorage& cScenario::cItemStorage::operator = (legacy::item_stora
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cScenario::import_legacy(legacy::scen_item_data_type& old){
|
||||
void cScenario::import_legacy(legacy::scen_item_data_type const &old){
|
||||
scen_items.resize(400);
|
||||
for(short i = 0; i < 400; i++)
|
||||
scen_items[i].import_legacy(old.scen_items[i]);
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
short item_odds[10];
|
||||
short property;
|
||||
cItemStorage();
|
||||
cItemStorage& operator = (legacy::item_storage_shortcut_type& old);
|
||||
cItemStorage& operator = (legacy::item_storage_shortcut_type const &old);
|
||||
};
|
||||
void destroy_terrain();
|
||||
public:
|
||||
@@ -94,8 +94,8 @@ public:
|
||||
towns.push_back(new cTown(*this, dim));
|
||||
}
|
||||
|
||||
void import_legacy(legacy::scenario_data_type& old);
|
||||
void import_legacy(legacy::scen_item_data_type& old);
|
||||
void import_legacy(legacy::scenario_data_type const &old);
|
||||
void import_legacy(legacy::scen_item_data_type const &old);
|
||||
void writeTo(std::ostream& file) const;
|
||||
void readFrom(std::istream& file);
|
||||
std::string format_scen_version();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#include "gfxsheets.hpp" // for NO_PIC
|
||||
#include "damage.hpp"
|
||||
|
||||
void cTerrain::import_legacy(legacy::terrain_type_type& old){
|
||||
void cTerrain::import_legacy(legacy::terrain_type_type const &old){
|
||||
static const std::set<int> archetypes = {
|
||||
// This lists graphics that represent the archetypal terrains for each ground type
|
||||
// One line per graphics sheet; last line is the animated sheet
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
unsigned short i; // for temporary use in porting
|
||||
|
||||
bool blocksMove() const;
|
||||
void import_legacy(legacy::terrain_type_type& old);
|
||||
void import_legacy(legacy::terrain_type_type const &old);
|
||||
void writeTo(std::ostream& file) const;
|
||||
};
|
||||
|
||||
|
@@ -20,13 +20,13 @@
|
||||
#include "fileio.hpp"
|
||||
#include "gfxsheets.hpp"
|
||||
|
||||
void cCurOut::import_legacy(legacy::out_info_type& old){
|
||||
void cCurOut::import_legacy(legacy::out_info_type const &old){
|
||||
for(int i = 0; i < 96; i++)
|
||||
for(int j = 0; j < 96; j++)
|
||||
out_e[i][j] = old.expl[i][j];
|
||||
}
|
||||
|
||||
void cCurTown::import_legacy(legacy::current_town_type& old){
|
||||
void cCurTown::import_legacy(legacy::current_town_type const &old){
|
||||
univ.party.town_num = old.town_num;
|
||||
difficulty = old.difficulty;
|
||||
record()->import_legacy(old.town);
|
||||
@@ -39,7 +39,7 @@ void cCurTown::import_legacy(legacy::current_town_type& old){
|
||||
cur_talk_loaded = old.town_num;
|
||||
}
|
||||
|
||||
void cCurTown::import_legacy(legacy::big_tr_type& old){
|
||||
void cCurTown::import_legacy(legacy::big_tr_type const &old){
|
||||
for(short i = 0; i < record()->max_dim; i++)
|
||||
for(short j = 0; j < record()->max_dim; j++)
|
||||
record()->terrain(i,j) = old.terrain[i][j];
|
||||
@@ -59,13 +59,13 @@ void cCurTown::import_legacy(legacy::big_tr_type& old){
|
||||
}
|
||||
}
|
||||
|
||||
void cCurTown::import_legacy(legacy::town_item_list& old){
|
||||
void cCurTown::import_legacy(legacy::town_item_list const &old){
|
||||
items.resize(115);
|
||||
for(int i = 0; i < 115; i++)
|
||||
items[i].import_legacy(old.items[i]);
|
||||
}
|
||||
|
||||
void cUniverse::import_legacy(legacy::stored_town_maps_type& old){
|
||||
void cUniverse::import_legacy(legacy::stored_town_maps_type const &old){
|
||||
for(int n = 0; n < scenario.towns.size(); n++)
|
||||
for(size_t j = 0; j < scenario.towns[n]->maps.size(); j++)
|
||||
for(int i = 0; i < scenario.towns[n]->maps[j].size(); i++)
|
||||
@@ -76,7 +76,7 @@ static short onm(char x_sector,char y_sector, char w) {
|
||||
return y_sector * w + x_sector;
|
||||
}
|
||||
|
||||
void cUniverse::import_legacy(legacy::stored_outdoor_maps_type& old){
|
||||
void cUniverse::import_legacy(legacy::stored_outdoor_maps_type const &old){
|
||||
for(int x = 0; x < scenario.outdoors.width(); x++)
|
||||
for(int y = 0; y < scenario.outdoors.height(); y++)
|
||||
for(int i = 0; i < 48; i++)
|
||||
|
@@ -47,10 +47,10 @@ public:
|
||||
|
||||
unsigned long fields[64][64];
|
||||
|
||||
void import_legacy(legacy::current_town_type& old);
|
||||
void import_legacy(legacy::town_item_list& old);
|
||||
void import_legacy(legacy::current_town_type const &old);
|
||||
void import_legacy(legacy::town_item_list const &old);
|
||||
void import_reset_fields_legacy();
|
||||
void import_legacy(legacy::big_tr_type& old);
|
||||
void import_legacy(legacy::big_tr_type const &old);
|
||||
|
||||
cTown* operator -> ();
|
||||
cTown& operator * ();
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
bool is_spot(int x, int y);
|
||||
bool is_road(int x, int y);
|
||||
|
||||
void import_legacy(legacy::out_info_type& old);
|
||||
void import_legacy(legacy::out_info_type const &old);
|
||||
|
||||
typedef ter_num_t arr_96[96];
|
||||
arr_96& operator [] (size_t i);
|
||||
@@ -206,8 +206,8 @@ public:
|
||||
bool node_step_through { false };
|
||||
|
||||
void clear_stored_pcs();
|
||||
void import_legacy(legacy::stored_town_maps_type& old);
|
||||
void import_legacy(legacy::stored_outdoor_maps_type& old);
|
||||
void import_legacy(legacy::stored_town_maps_type const &old);
|
||||
void import_legacy(legacy::stored_outdoor_maps_type const &old);
|
||||
void enter_scenario(const std::string& name);
|
||||
void refresh_store_items();
|
||||
void generate_job_bank(int which, job_bank_t& bank);
|
||||
|
Reference in New Issue
Block a user