Mark some import_legacy methods as taking const &.

+ replace when possible boost::lexical_cast<std::string> by std::to_string
This commit is contained in:
C.W. Betts
2021-10-01 14:16:22 +02:00
committed by Celtic Minstrel
parent ceb90b9719
commit 976794e8b6
22 changed files with 75 additions and 92 deletions

View File

@@ -195,7 +195,7 @@ void cParty::swap(cParty& other) {
}
}
void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
void cParty::import_legacy(legacy::party_record_type const & old, cUniverse& univ){
scen_name = old.scen_name;
age = old.age;
gold = old.gold;
@@ -297,13 +297,13 @@ void cParty::import_legacy(legacy::party_record_type& old, cUniverse& univ){
total_dam_taken = old.total_dam_taken;
}
void cParty::import_legacy(legacy::stored_items_list_type& old,short which_list){
void cParty::import_legacy(legacy::stored_items_list_type const & old,short which_list){
stored_items[which_list].resize(115);
for(int i = 0; i < 115; i++)
stored_items[which_list][i].import_legacy(old.items[i]);
}
void cParty::import_legacy(legacy::setup_save_type& old){
void cParty::import_legacy(legacy::setup_save_type const & old){
for(int n = 0; n < 4; n++)
for(int i = 0; i < 64; i++)
for(int j = 0; j < 64; j++)
@@ -312,7 +312,7 @@ void cParty::import_legacy(legacy::setup_save_type& old){
setup[n][i][j] = (old.setup[n][i][j]<<8);
}
void cParty::cConvers::import_legacy(legacy::talk_save_type old, const cScenario& scenario){
void cParty::cConvers::import_legacy(legacy::talk_save_type const &old, const cScenario& scenario){
who_said = scenario.towns[old.personality / 10]->talking.people[old.personality % 10].title;
in_town = scenario.towns[old.town_num]->name;
int strnums[2] = {old.str1, old.str2};
@@ -345,7 +345,7 @@ void cParty::cConvers::import_legacy(legacy::talk_save_type old, const cScenario
}
}
void cParty::cEncNote::import_legacy(int16_t(& old)[2], const cScenario& scenario) {
void cParty::cEncNote::import_legacy(int16_t const (& old)[2], const cScenario& scenario) {
in_scen = scenario.scen_name;
// TODO: Need to verify that I have the correct offsets here.
switch(old[0] / 1000) {
@@ -367,7 +367,7 @@ void cParty::cEncNote::import_legacy(int16_t(& old)[2], const cScenario& scenari
}
}
void cParty::import_legacy(legacy::pc_record_type(& old)[6]) {
void cParty::import_legacy(legacy::pc_record_type const (& old)[6]) {
for(int i = 0; i < 6; i++) {
delete adven[i];
adven[i] = new cPlayer(*this);
@@ -599,7 +599,7 @@ location cParty::get_loc() const {
}
int cParty::calc_day() const {
return (age / 3700) + 1;
return int(age / 3700) + 1;
}
bool cParty::give_item(cItem item,int flags) {

View File

@@ -61,7 +61,7 @@ public:
public:
std::string who_said, in_town, the_str1, the_str2, in_scen;
void import_legacy(legacy::talk_save_type old, const cScenario& scenario);
void import_legacy(legacy::talk_save_type const &old, const cScenario& scenario);
};
class cJournal {
public:
@@ -73,7 +73,7 @@ public:
eEncNoteType type;
std::string the_str, where, in_scen;
void import_legacy(int16_t(& old)[2], const cScenario& scenario);
void import_legacy(int16_t const (& old)[2], const cScenario& scenario);
};
// formerly party_record_type
// TODO: Should we make age a long long?
@@ -142,11 +142,11 @@ public:
void clear_ptr(unsigned short p);
unsigned char get_ptr(unsigned short p);
void import_legacy(legacy::party_record_type& old, cUniverse& univ);
void import_legacy(legacy::big_tr_type& old);
void import_legacy(legacy::stored_items_list_type& old,short which_list);
void import_legacy(legacy::setup_save_type& old);
void import_legacy(legacy::pc_record_type(& old)[6]);
void import_legacy(legacy::party_record_type const & old, cUniverse& univ);
void import_legacy(legacy::big_tr_type const & old);
void import_legacy(legacy::stored_items_list_type const & old,short which_list);
void import_legacy(legacy::setup_save_type const & old);
void import_legacy(legacy::pc_record_type const (& old)[6]);
bool is_alive() const;
bool is_friendly() const;