diff --git a/src/game/boe.combat.cpp b/src/game/boe.combat.cpp index bf33785b..6d1f73cd 100644 --- a/src/game/boe.combat.cpp +++ b/src/game/boe.combat.cpp @@ -375,7 +375,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,location where,short nu bool pc_combat_move(location destination) { std::string create_line; - short s1,s2,monst_exist; + short s1,monst_exist; bool keep_going = true,forced = false,check_f = false; location monst_loc,store_loc; eDirection dir; @@ -420,6 +420,7 @@ bool pc_combat_move(location destination) { return true; } else if(monst_hit != nullptr) { + int s2=0; // s2 = 2 here appears to mean "go ahead and attack", while s2 = 1 means "cancel attack". if(!monst_hit->is_friendly()) s2 = 2; else { diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index 5399080a..4b8b5d55 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -34,7 +34,6 @@ #include "pict.hpp" #include "render_shapes.hpp" #include "stack.hpp" -#include #include "prefs.hpp" #include "shop.hpp" #include "cursors.hpp" @@ -1311,7 +1310,7 @@ void pick_preferences() { static void put_party_stats(cDialog& me) { for(short i = 0; i < 6; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(univ.party[i].main_status != eMainStatus::ABSENT) { me["name" + n].setText(univ.party[i].name); me["trait" + n].show(); @@ -1383,7 +1382,7 @@ void edit_party() { cDialog pcDialog("edit-party"); std::vector buttons = {"done", "help"}; for(int i = 1; i <= 6; i++) { - std::string n = boost::lexical_cast(i); + std::string n = std::to_string(i); buttons.push_back("name" + n); buttons.push_back("delete" + n); buttons.push_back("trait" + n); diff --git a/src/game/boe.infodlg.cpp b/src/game/boe.infodlg.cpp index ebe40420..4810423d 100644 --- a/src/game/boe.infodlg.cpp +++ b/src/game/boe.infodlg.cpp @@ -450,7 +450,7 @@ void give_pc_info(short pc_num) { pcInfo.attachClickHandlers(std::bind(give_pc_extra_info, _1, _2, std::ref(pc_num)), {"seemage", "seepriest", "trait", "seealch"}); for(short i = 0; i < 19; i++) { - std::string lbl= "lbl" + boost::lexical_cast(i + 1); + std::string lbl= "lbl" + std::to_string(i + 1); str = get_str("skills",1 + i * 2); pcInfo[lbl].setText(str); } @@ -477,7 +477,7 @@ static bool adventure_notes_event_filter(cDialog& me, std::string item_hit, eKey univ.party.special_notes.erase(iter); } for(short i = 0; i < 3; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(univ.party.special_notes.size() > store_page_on * 3+i) { me["str" + n].setText(univ.party.special_notes[store_page_on * 3+i].the_str); me["del" + n].show(); @@ -506,7 +506,7 @@ void adventure_notes() { encNotes.attachClickHandlers(adventure_notes_event_filter, {"done", "left", "right", "del1", "del2", "del3"}); for(short i = 0; i < 3; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(univ.party.special_notes.size() > i) { encNotes["str" + n].setText(univ.party.special_notes[i].the_str); encNotes["del" + n].show(); @@ -590,7 +590,7 @@ static bool journal_event_filter(cDialog& me, std::string item_hit, eKeyMod) { static void fill_journal(cDialog& me) { for(int i = 0; i < 3; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if((long)univ.party.journal.size() > i + (store_page_on * 3)) { me["str" + n].setText(univ.party.journal[i].the_str); me["day" + n].setText("Day: " + std::to_string(univ.party.journal[i].day)); diff --git a/src/game/boe.items.cpp b/src/game/boe.items.cpp index 7504ac63..676f472d 100644 --- a/src/game/boe.items.cpp +++ b/src/game/boe.items.cpp @@ -23,7 +23,6 @@ #include "message.hpp" #include "prefs.hpp" #include -#include #include "winutil.hpp" #include "cursors.hpp" @@ -921,7 +920,7 @@ short char_select_pc(short mode,const char *title) { selectPc["title"].setText(title); for(short i = 0; i < 6; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); bool can_pick = true; if(univ.party[i].main_status == eMainStatus::ABSENT || univ.party[i].main_status == eMainStatus::FLED) can_pick = false; diff --git a/src/game/boe.party.cpp b/src/game/boe.party.cpp index 527ca6ce..26062266 100644 --- a/src/game/boe.party.cpp +++ b/src/game/boe.party.cpp @@ -1552,7 +1552,7 @@ bool pc_can_cast_spell(const cPlayer& pc,eSpell spell_num) { static void draw_caster_buttons(cDialog& me, const eSkill store_situation) { for(short i = 0; i < 6; i++) { - std::string id = "caster" + boost::lexical_cast(i + 1); + std::string id = "caster" + std::to_string(i + 1); if(!can_choose_caster) { if(i == pc_casting) { me[id].show(); @@ -1577,7 +1577,7 @@ static void draw_spell_info(cDialog& me, const eSkill store_situation, const sho if(store_spell == 70) { // No spell selected for(int i = 0; i < 6; i++) { - std::string id = "target" + boost::lexical_cast(i + 1); + std::string id = "target" + std::to_string(i + 1); me[id].hide(); } @@ -1585,7 +1585,7 @@ static void draw_spell_info(cDialog& me, const eSkill store_situation, const sho else { // Spell selected for(int i = 0; i < 6; i++) { - std::string id = "target" + boost::lexical_cast(i + 1); + std::string id = "target" + std::to_string(i + 1); switch((*cSpell::fromNum(store_situation,store_spell)).need_select) { case SELECT_NO: me[id].hide(); @@ -1644,7 +1644,7 @@ static void put_target_status_graphics(cDialog& me, short for_pc) { static void draw_spell_pc_info(cDialog& me) { for(short i = 0; i < 6; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(univ.party[i].main_status != eMainStatus::ABSENT) { me["pc" + n].setText(univ.party[i].name); @@ -1660,7 +1660,7 @@ static void draw_spell_pc_info(cDialog& me) { static void put_pc_caster_buttons(cDialog& me) { for(short i = 0; i < 6; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(me["caster" + n].isVisible()) { if(i == pc_casting) me["pc" + n].setColour(Colours::RED); @@ -1672,12 +1672,12 @@ static void put_pc_caster_buttons(cDialog& me) { static void put_pc_target_buttons(cDialog& me, short& store_last_target_darkened) { if(store_spell_target < 6) { - std::string n = boost::lexical_cast(store_spell_target + 1); + std::string n = std::to_string(store_spell_target + 1); me["hp" + n].setColour(Colours::RED); me["sp" + n].setColour(Colours::RED); } if((store_last_target_darkened < 6) && (store_last_target_darkened != store_spell_target)) { - std::string n = boost::lexical_cast(store_last_target_darkened + 1); + std::string n = std::to_string(store_last_target_darkened + 1); me["hp" + n].setColour(me.getDefTextClr()); me["sp" + n].setColour(me.getDefTextClr()); } @@ -1690,7 +1690,7 @@ static void put_spell_led_buttons(cDialog& me, const eSkill store_situation,cons for(short i = 0; i < 38; i++) { spell_for_this_button = (on_which_spell_page == 0) ? i : spell_index[i]; - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); cLed& led = dynamic_cast(me[id]); if(spell_for_this_button < 90) { @@ -1716,7 +1716,7 @@ static void put_spell_list(cDialog& me, const eSkill store_situation) { me["col4"].setText("Level 4:"); for(short i = 0; i < 38; i++) { std::ostringstream name; - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); name << get_str("magic-names", i + (store_situation == eSkill::MAGE_SPELLS ? 1 : 101)); name << " ("; if((*cSpell::fromNum(store_situation,i)).cost < 0) { // Simulacrum, which has a variable cost @@ -1735,7 +1735,7 @@ static void put_spell_list(cDialog& me, const eSkill store_situation) { me["col4"].setText(""); for(short i = 0; i < 38; i++) { std::ostringstream name; - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); if(spell_index[i] < 90) { name << get_str("magic-names", spell_index[i] + (store_situation == eSkill::MAGE_SPELLS ? 1 : 101)); name << " ("; @@ -1820,7 +1820,7 @@ static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods, con put_spell_led_buttons(me, store_situation, store_spell); if(store_spell_target < 6) { - std::string targ = "target" + boost::lexical_cast(store_spell_target + 1); + std::string targ = "target" + std::to_string(store_spell_target + 1); if(!me[targ].isVisible()) { store_spell_target = 6; draw_spell_info(me, store_situation, store_spell); @@ -1828,7 +1828,7 @@ static bool pick_spell_select_led(cDialog& me, std::string id, eKeyMod mods, con } } // Cute trick now... if a target is needed, caster can always be picked - std::string targ = "target" + boost::lexical_cast(pc_casting + 1); + std::string targ = "target" + std::to_string(pc_casting + 1); if((store_spell_target == 6) && me[targ].isVisible()) { me["feedback"].setText(choose_target); draw_spell_info(me, store_situation, store_spell); @@ -1985,7 +1985,7 @@ eSpell pick_spell(short pc_num,eSkill type) { // 70 - no spell OW spell num dynamic_cast(castSpell["pic"]).setPict(14 + (type == eSkill::PRIEST_SPELLS),PIC_DLOG); for(int i = 0; i < 38; i++) { - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); cKey key; if(i > 25) key = {false, static_cast('a' + i - 26), mod_shift}; @@ -2139,7 +2139,7 @@ eAlchemy alch_choice(short pc_num) { cDialog chooseAlchemy("pick-potion"); chooseAlchemy.attachClickHandlers(alch_choice_event_filter, {"cancel", "help"}); for(short i = 0; i < 20; i++) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); chooseAlchemy["label" + n].setText(get_str("magic-names", i + 200)); chooseAlchemy["potion" + n].attachClickHandler(alch_choice_event_filter); if(univ.party[pc_num].skill(eSkill::ALCHEMY) < difficulty[i] || !univ.party.alchemy[i]) @@ -2215,7 +2215,7 @@ mon_num_t pick_trapped_monst() { cChoiceDlog soulCrystal("soul-crystal",{"cancel","pick1","pick2","pick3","pick4"}); for(mon_num_t which : univ.party.imprisoned_monst) { - std::string n = boost::lexical_cast(i + 1); + std::string n = std::to_string(i + 1); if(which == 0) { soulCrystal->getControl("pick" + n).hide(); } diff --git a/src/game/boe.specials.cpp b/src/game/boe.specials.cpp index 6d2845d1..7cdc2f8f 100644 --- a/src/game/boe.specials.cpp +++ b/src/game/boe.specials.cpp @@ -2655,34 +2655,21 @@ void affect_spec(const runtime_state& ctx) { // TODO: I think this is for compatibility with old scenarios? If so, remove it and just convert data on load. // (Actually, I think the only compatibility thing is that it's <= instead of ==) if(spec.ex2a <= 0) { - int i; - if(spec.ex1a == 2) { - i = -1; // CHECKME + int i=-1; + if(spec.ex1a == 2) ctx.cur_target = &univ.party; - } - else if(spec.ex1a == 1) { + else if(spec.ex1a == 1) i = select_pc(0); - if(i != 6) - ctx.cur_target = &univ.party[i]; - } - else if(spec.ex1a == 0) { + else if(spec.ex1a == 0) i = select_pc(1); - if(i != 6) - ctx.cur_target = &univ.party[i]; - } - else if(spec.ex1a == 3) { + else if(spec.ex1a == 3) i = select_pc(2); - if(i != 6) - ctx.cur_target = &univ.party[i]; - } - else if(spec.ex1a == 4) { + else if(spec.ex1a == 4) i = select_pc(3); - if(i != 6) - ctx.cur_target = &univ.party[i]; - } if(i == 6)// && (spec.ex1b >= 0)) ctx.next_spec = spec.ex1b; - + else if (i>=0 && i<6) + ctx.cur_target = &univ.party[i]; } else if(spec.ex2a == 2) { // Select a specific PC diff --git a/src/pcedit/pc.action.cpp b/src/pcedit/pc.action.cpp index 0a5cdb1a..359b1ff8 100644 --- a/src/pcedit/pc.action.cpp +++ b/src/pcedit/pc.action.cpp @@ -11,7 +11,6 @@ #include "dialog.hpp" #include "control.hpp" #include "cursors.hpp" -#include extern cUniverse univ; extern sf::RenderWindow mainPtr; diff --git a/src/pcedit/pc.editors.cpp b/src/pcedit/pc.editors.cpp index 589e1f52..48ac7acc 100644 --- a/src/pcedit/pc.editors.cpp +++ b/src/pcedit/pc.editors.cpp @@ -57,7 +57,7 @@ static void put_pc_spells(cDialog& me, short store_trait_mode) { store_trait_mode %= 10; for(short i = 0; i < 62; i++) { - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); cLed& cur = dynamic_cast(me[id]); if(((store_trait_mode == 0) && univ.party[which_pc_displayed].mage_spells[i]) || ((store_trait_mode == 1) && univ.party[which_pc_displayed].priest_spells[i])) @@ -107,7 +107,7 @@ void display_pc(short pc_num,short mode, cDialog* parent) { pcInfo.attachClickHandlers(std::bind(display_pc_event_filter, _1, _2, mode),{"done","left","right"}); for(short i = 0; i < 62; i++) { - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); label_str = get_str("magic-names", i + (mode % 10 == 0 ? 1 : 101)); pcInfo[id].setText(label_str); if(mode < 10) @@ -122,7 +122,7 @@ void display_pc(short pc_num,short mode, cDialog* parent) { if(mode >= 10) { mode %= 10; for(short i = 0; i < 62; i++) { - std::string id = "spell" + boost::lexical_cast(i + 1); + std::string id = "spell" + std::to_string(i + 1); bool set = dynamic_cast(pcInfo[id]).getState() != led_off; if(mode == 0) univ.party[pc_num].mage_spells[i] = set; else if(mode == 1) univ.party[pc_num].priest_spells[i] = set; @@ -134,16 +134,16 @@ static void display_traits_graphics(cDialog& me) { short store; if(store_pc->race <= eRace::VAHNATAI) { - std::string race = "race" + boost::lexical_cast(int(store_pc->race) + 1); + std::string race = "race" + std::to_string(int(store_pc->race) + 1); dynamic_cast(me["race"]).setSelected(race); } for(short i = 0; i < 10; i++) { - std::string id = "good" + boost::lexical_cast(i + 1); + std::string id = "good" + std::to_string(i + 1); eTrait trait = eTrait(i); dynamic_cast(me[id]).setState(store_pc->traits[trait] ? led_red : led_off); } for(short i = 0; i < 7; i++) { - std::string id = "bad" + boost::lexical_cast(i + 1); + std::string id = "bad" + std::to_string(i + 1); eTrait trait = eTrait(i + 10); dynamic_cast(me[id]).setState(store_pc->traits[trait] ? led_red : led_off); } @@ -239,7 +239,7 @@ void display_alchemy(bool allowEdit,cDialog* parent) { cChoiceDlog showAlch("pc-alchemy-info", {"done"}, parent); for(short i = 0; i < 20; i++) { - std::string id = "potion" + boost::lexical_cast(i + 1); + std::string id = "potion" + std::to_string(i + 1); std::string name = get_str("magic-names", i + 200) + " ("; name += std::to_string(alch_difficulty[i]); name += ')'; @@ -256,7 +256,7 @@ void display_alchemy(bool allowEdit,cDialog* parent) { if(!allowEdit) return; for(short i = 0; i < 20; i++) { - std::string id = "potion" + boost::lexical_cast(i + 1); + std::string id = "potion" + std::to_string(i + 1); cLed& led = dynamic_cast(showAlch->getControl(id)); if(led.getState() == led_red) univ.party.alchemy[i] = true; else univ.party.alchemy[i] = false; diff --git a/src/scenario/item.cpp b/src/scenario/item.cpp index ef63ff7f..bfc9096e 100644 --- a/src/scenario/item.cpp +++ b/src/scenario/item.cpp @@ -8,12 +8,12 @@ #include "item.hpp" +#include #include #include #include #include #include -#include #include "oldstructs.hpp" #include "utility.hpp" @@ -411,7 +411,7 @@ void cItem::enchant_weapon(eEnchant enchant_type,short new_val) { full_name = store_name; } -void cItem::import_legacy(legacy::item_record_type& old){ +void cItem::import_legacy(legacy::item_record_type const & old){ variety = (eItemType) old.variety; item_level = old.item_level; awkward = old.awkward; diff --git a/src/scenario/item.hpp b/src/scenario/item.hpp index e30005bc..39eb7b01 100644 --- a/src/scenario/item.hpp +++ b/src/scenario/item.hpp @@ -76,7 +76,7 @@ public: cItem(); explicit cItem(eItemPreset preset); explicit cItem(eAlchemy recipe); - void import_legacy(legacy::item_record_type& old); + void import_legacy(legacy::item_record_type const & old); void writeTo(std::ostream& file, std::string prefix = "") const; void readFrom(std::istream& sin); }; diff --git a/src/scenario/monster.cpp b/src/scenario/monster.cpp index 77d581ab..e8fac908 100644 --- a/src/scenario/monster.cpp +++ b/src/scenario/monster.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include "oldstructs.hpp" #include "fileio.hpp" diff --git a/src/scenario/special.cpp b/src/scenario/special.cpp index 6725513f..e5281cc9 100644 --- a/src/scenario/special.cpp +++ b/src/scenario/special.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include "strdlog.hpp" #include "oldstructs.hpp" @@ -51,7 +50,7 @@ void cSpecial::writeTo(std::ostream& file, int n) const { file << "\tgoto " << jumpto << '\n'; } -void cSpecial::import_legacy(legacy::special_node_type& old){ +void cSpecial::import_legacy(legacy::special_node_type const &old){ sd1 = old.sd1; sd2 = old.sd2; pic = old.pic; diff --git a/src/scenario/special.hpp b/src/scenario/special.hpp index d3d383d6..2f4f0857 100644 --- a/src/scenario/special.hpp +++ b/src/scenario/special.hpp @@ -85,7 +85,7 @@ public: short jumpto; cSpecial(); - void import_legacy(legacy::special_node_type& old); + void import_legacy(legacy::special_node_type const & old); void writeTo(std::ostream& file, int n) const; }; diff --git a/src/scenario/talking.cpp b/src/scenario/talking.cpp index b43d3191..195e9ec0 100644 --- a/src/scenario/talking.cpp +++ b/src/scenario/talking.cpp @@ -15,7 +15,7 @@ #include "oldstructs.hpp" -void cSpeech::import_legacy(legacy::talking_record_type& old, std::vector& shops){ +void cSpeech::import_legacy(legacy::talking_record_type const &old, std::vector& shops){ talk_nodes.resize(60); for(short i = 0; i < 60; i++){ talk_nodes[i].personality = old.talk_nodes[i].personality; diff --git a/src/scenario/talking.hpp b/src/scenario/talking.hpp index fc7f314b..dd94b14c 100644 --- a/src/scenario/talking.hpp +++ b/src/scenario/talking.hpp @@ -80,7 +80,7 @@ public: std::array people; std::vector talk_nodes; - void import_legacy(legacy::talking_record_type& old, std::vector& shops); + void import_legacy(legacy::talking_record_type const &old, std::vector& shops); void writeTo(std::ostream& file) const; }; diff --git a/src/scenario/town.cpp b/src/scenario/town.cpp index 374f41e2..dc426fa9 100644 --- a/src/scenario/town.cpp +++ b/src/scenario/town.cpp @@ -19,7 +19,7 @@ #include "fileio.hpp" #include "utility.hpp" -void cTown::import_legacy(legacy::town_record_type& old){ +void cTown::import_legacy(legacy::town_record_type const &old){ town_chop_time = old.town_chop_time; town_chop_key = old.town_chop_key; for(short i = 0; i < 4; i++){ @@ -128,14 +128,14 @@ void cTown::init_start() { in_town_rect.right = s - 4; } -void cTown::cWandering::import_legacy(legacy::wandering_type old){ +void cTown::cWandering::import_legacy(legacy::wandering_type const &old){ monst[0] = old.monst[0]; monst[1] = old.monst[1]; monst[2] = old.monst[2]; monst[3] = old.monst[3]; } -void cTown::cItem::import_legacy(legacy::preset_item_type old){ +void cTown::cItem::import_legacy(legacy::preset_item_type const &old){ loc.x = old.item_loc.x; loc.y = old.item_loc.y; code = old.item_code; @@ -145,7 +145,7 @@ void cTown::cItem::import_legacy(legacy::preset_item_type old){ contained = old.contained; } -void cTown::cField::import_legacy(legacy::preset_field_type old){ +void cTown::cField::import_legacy(legacy::preset_field_type const &old){ loc.x = old.field_loc.x; loc.y = old.field_loc.y; switch(old.field_type) { diff --git a/src/scenario/town.hpp b/src/scenario/town.hpp index cdcd9970..02fb06cb 100644 --- a/src/scenario/town.hpp +++ b/src/scenario/town.hpp @@ -50,7 +50,7 @@ public: std::array monst; bool isNull(); - void import_legacy(legacy::wandering_type old); + void import_legacy(legacy::wandering_type const &old); }; class cItem { // formerly preset_item_type public: @@ -59,7 +59,7 @@ public: int charges = -1; bool always_there = false, property = false, contained = false; - void import_legacy(legacy::preset_item_type old); + void import_legacy(legacy::preset_item_type const &old); cItem(); cItem(location loc, short num, ::cItem& item); }; @@ -68,7 +68,7 @@ public: location loc; eFieldType type; - void import_legacy(legacy::preset_field_type old); + void import_legacy(legacy::preset_field_type const &old); cField() : type(FIELD_DISPEL) {} cField(location l, eFieldType t) : loc(l), type(t) {} }; @@ -104,14 +104,14 @@ public: long m_killed = 0; template - void import_legacy(T& old, int town_num); + void import_legacy(T const & old, int town_num); void init_start(); void set_up_lights(); short light_obscurity(short x,short y); // Obscurity function used for calculating lighting bool is_cleaned_out(); explicit cTown(cScenario& scenario, size_t dim); - void import_legacy(legacy::town_record_type& old); + void import_legacy(legacy::town_record_type const & old); void reattach(cScenario& to); void writeTerrainTo(std::ostream& file); void readTerrainFrom(std::istream& file); diff --git a/src/scenario/town_import.tpp b/src/scenario/town_import.tpp index a1c859e6..27de6da4 100644 --- a/src/scenario/town_import.tpp +++ b/src/scenario/town_import.tpp @@ -23,7 +23,7 @@ struct import_helper { }; template -void cTown::import_legacy(T& old, int){ +void cTown::import_legacy(T const & old, int){ typedef import_helper sizes; assert(max_dim == sizes::dim && "Tried to import legacy town into wrong-sized town"); cField the_field, the_road; diff --git a/src/scenario/vehicle.cpp b/src/scenario/vehicle.cpp index fd4b0887..fec4e810 100644 --- a/src/scenario/vehicle.cpp +++ b/src/scenario/vehicle.cpp @@ -22,7 +22,7 @@ cVehicle::cVehicle() : property(false) {} -void cVehicle::import_legacy(legacy::horse_record_type& old){ +void cVehicle::import_legacy(legacy::horse_record_type const &old){ which_town = old.which_town; exists = old.exists; property = old.property; @@ -37,7 +37,7 @@ void cVehicle::import_legacy(legacy::horse_record_type& old){ sector.y = old.horse_sector.y; } -void cVehicle::import_legacy(legacy::boat_record_type& old){ +void cVehicle::import_legacy(legacy::boat_record_type const &old){ which_town = old.which_town; exists = old.exists; property = old.property; diff --git a/src/scenario/vehicle.hpp b/src/scenario/vehicle.hpp index a28e911e..204e30e4 100644 --- a/src/scenario/vehicle.hpp +++ b/src/scenario/vehicle.hpp @@ -28,8 +28,8 @@ public: bool property; cVehicle(); - void import_legacy(legacy::horse_record_type& old); - void import_legacy(legacy::boat_record_type& old); + void import_legacy(legacy::horse_record_type const &old); + void import_legacy(legacy::boat_record_type const &old); void writeTo(std::ostream& file) const; void readFrom(std::istream& file); }; diff --git a/src/universe/party.cpp b/src/universe/party.cpp index 9dd61bf0..c8a118c0 100644 --- a/src/universe/party.cpp +++ b/src/universe/party.cpp @@ -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) { diff --git a/src/universe/party.hpp b/src/universe/party.hpp index 76707ace..4e853080 100644 --- a/src/universe/party.hpp +++ b/src/universe/party.hpp @@ -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;