Update swap functions to recommended ADL-friendly format
This commit is contained in:
@@ -144,63 +144,64 @@ cScenario::cScenario(const cScenario& other)
|
||||
}
|
||||
|
||||
cScenario::cScenario(cScenario&& other) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
cScenario& cScenario::operator=(cScenario other) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cScenario::swap(cScenario& other) {
|
||||
std::swap(difficulty, other.difficulty);
|
||||
std::swap(intro_pic, other.intro_pic);
|
||||
std::swap(default_ground, other.default_ground);
|
||||
std::swap(bg_out, other.bg_out);
|
||||
std::swap(bg_fight, other.bg_fight);
|
||||
std::swap(bg_town, other.bg_town);
|
||||
std::swap(bg_dungeon, other.bg_dungeon);
|
||||
std::swap(intro_mess_pic, other.intro_mess_pic);
|
||||
std::swap(where_start, other.where_start);
|
||||
std::swap(out_sec_start, other.out_sec_start);
|
||||
std::swap(out_start, other.out_start);
|
||||
std::swap(which_town_start, other.which_town_start);
|
||||
std::swap(init_spec, other.init_spec);
|
||||
std::swap(town_mods, other.town_mods);
|
||||
std::swap(store_item_rects, other.store_item_rects);
|
||||
std::swap(store_item_towns, other.store_item_towns);
|
||||
std::swap(special_items, other.special_items);
|
||||
std::swap(quests, other.quests);
|
||||
std::swap(shops, other.shops);
|
||||
std::swap(uses_custom_graphics, other.uses_custom_graphics);
|
||||
std::swap(rating, other.rating);
|
||||
std::swap(custom_graphics, other.custom_graphics);
|
||||
std::swap(scen_monsters, other.scen_monsters);
|
||||
std::swap(boats, other.boats);
|
||||
std::swap(horses, other.horses);
|
||||
std::swap(ter_types, other.ter_types);
|
||||
std::swap(scenario_timers, other.scenario_timers);
|
||||
std::swap(scen_specials, other.scen_specials);
|
||||
std::swap(storage_shortcuts, other.storage_shortcuts);
|
||||
std::swap(last_out_edited, other.last_out_edited);
|
||||
std::swap(last_town_edited, other.last_town_edited);
|
||||
std::swap(format, other.format);
|
||||
std::swap(campaign_id, other.campaign_id);
|
||||
std::swap(scen_items, other.scen_items);
|
||||
std::swap(scen_name, other.scen_name);
|
||||
std::swap(who_wrote[0], other.who_wrote[0]);
|
||||
std::swap(who_wrote[1], other.who_wrote[1]);
|
||||
std::swap(contact_info[0], other.contact_info[0]);
|
||||
std::swap(contact_info[1], other.contact_info[1]);
|
||||
std::swap(intro_strs, other.intro_strs);
|
||||
std::swap(journal_strs, other.journal_strs);
|
||||
std::swap(spec_strs, other.spec_strs);
|
||||
std::swap(snd_names, other.snd_names);
|
||||
std::swap(adjust_diff, other.adjust_diff);
|
||||
std::swap(is_legacy, other.is_legacy);
|
||||
std::swap(scen_file, other.scen_file);
|
||||
std::swap(outdoors, other.outdoors);
|
||||
std::swap(towns, other.towns);
|
||||
void swap(cScenario& lhs, cScenario& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.difficulty, rhs.difficulty);
|
||||
swap(lhs.intro_pic, rhs.intro_pic);
|
||||
swap(lhs.default_ground, rhs.default_ground);
|
||||
swap(lhs.bg_out, rhs.bg_out);
|
||||
swap(lhs.bg_fight, rhs.bg_fight);
|
||||
swap(lhs.bg_town, rhs.bg_town);
|
||||
swap(lhs.bg_dungeon, rhs.bg_dungeon);
|
||||
swap(lhs.intro_mess_pic, rhs.intro_mess_pic);
|
||||
swap(lhs.where_start, rhs.where_start);
|
||||
swap(lhs.out_sec_start, rhs.out_sec_start);
|
||||
swap(lhs.out_start, rhs.out_start);
|
||||
swap(lhs.which_town_start, rhs.which_town_start);
|
||||
swap(lhs.init_spec, rhs.init_spec);
|
||||
swap(lhs.town_mods, rhs.town_mods);
|
||||
swap(lhs.store_item_rects, rhs.store_item_rects);
|
||||
swap(lhs.store_item_towns, rhs.store_item_towns);
|
||||
swap(lhs.special_items, rhs.special_items);
|
||||
swap(lhs.quests, rhs.quests);
|
||||
swap(lhs.shops, rhs.shops);
|
||||
swap(lhs.uses_custom_graphics, rhs.uses_custom_graphics);
|
||||
swap(lhs.rating, rhs.rating);
|
||||
swap(lhs.custom_graphics, rhs.custom_graphics);
|
||||
swap(lhs.scen_monsters, rhs.scen_monsters);
|
||||
swap(lhs.boats, rhs.boats);
|
||||
swap(lhs.horses, rhs.horses);
|
||||
swap(lhs.ter_types, rhs.ter_types);
|
||||
swap(lhs.scenario_timers, rhs.scenario_timers);
|
||||
swap(lhs.scen_specials, rhs.scen_specials);
|
||||
swap(lhs.storage_shortcuts, rhs.storage_shortcuts);
|
||||
swap(lhs.last_out_edited, rhs.last_out_edited);
|
||||
swap(lhs.last_town_edited, rhs.last_town_edited);
|
||||
swap(lhs.format, rhs.format);
|
||||
swap(lhs.campaign_id, rhs.campaign_id);
|
||||
swap(lhs.scen_items, rhs.scen_items);
|
||||
swap(lhs.scen_name, rhs.scen_name);
|
||||
swap(lhs.who_wrote[0], rhs.who_wrote[0]);
|
||||
swap(lhs.who_wrote[1], rhs.who_wrote[1]);
|
||||
swap(lhs.contact_info[0], rhs.contact_info[0]);
|
||||
swap(lhs.contact_info[1], rhs.contact_info[1]);
|
||||
swap(lhs.intro_strs, rhs.intro_strs);
|
||||
swap(lhs.journal_strs, rhs.journal_strs);
|
||||
swap(lhs.spec_strs, rhs.spec_strs);
|
||||
swap(lhs.snd_names, rhs.snd_names);
|
||||
swap(lhs.adjust_diff, rhs.adjust_diff);
|
||||
swap(lhs.is_legacy, rhs.is_legacy);
|
||||
swap(lhs.scen_file, rhs.scen_file);
|
||||
swap(lhs.outdoors, rhs.outdoors);
|
||||
swap(lhs.towns, rhs.towns);
|
||||
}
|
||||
|
||||
cScenario::cItemStorage::cItemStorage() : ter_type(-1), property(0) {
|
||||
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
explicit cScenario();
|
||||
~cScenario();
|
||||
// Copy-and-swap
|
||||
void swap(cScenario& other);
|
||||
friend void swap(cScenario& lhs, cScenario& rhs);
|
||||
cScenario(const cScenario& other);
|
||||
cScenario(cScenario&& other);
|
||||
cScenario& operator=(cScenario other);
|
||||
|
||||
@@ -1246,12 +1246,13 @@ static bool pick_out_event_filter(cDialog& me, std::string item_hit, location& c
|
||||
if(cur_loc.y >= scenario.outdoors.height() - 1) beep();
|
||||
else cur_loc.y++;
|
||||
} else if(item_hit == "choose") {
|
||||
using std::swap;
|
||||
int i = cur_loc.x * scenario.outdoors.height() + cur_loc.y;
|
||||
if(&scenario != &::scenario)
|
||||
scenario.outdoors.swap(::scenario.outdoors);
|
||||
swap(scenario.outdoors, ::scenario.outdoors);
|
||||
i = choose_text(STRT_SECTOR, i, &me, "Which sector?");
|
||||
if(&scenario != &::scenario)
|
||||
scenario.outdoors.swap(::scenario.outdoors);
|
||||
swap(scenario.outdoors, ::scenario.outdoors);
|
||||
cur_loc.x = i / scenario.outdoors.height();
|
||||
cur_loc.y = i % scenario.outdoors.height();
|
||||
}
|
||||
|
||||
@@ -248,10 +248,11 @@ public:
|
||||
data.resize(new_sz, def);
|
||||
}
|
||||
}
|
||||
void swap(vector2d& other) {
|
||||
data.swap(other.data);
|
||||
std::swap(w, other.w);
|
||||
std::swap(h, other.h);
|
||||
friend void swap(vector2d& lhs, vector2d& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.data, rhs.data);
|
||||
swap(lhs.w, rhs.w);
|
||||
swap(lhs.h, rhs.h);
|
||||
}
|
||||
bool empty() const {
|
||||
return data.empty();
|
||||
|
||||
@@ -108,71 +108,72 @@ cParty::cParty(const cParty& other)
|
||||
}
|
||||
|
||||
cParty::cParty(cParty&& other) : cParty() {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
cParty& cParty::operator=(cParty other) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cParty::swap(cParty& other) {
|
||||
std::swap(next_pc_id, other.next_pc_id);
|
||||
std::swap(age, other.age);
|
||||
std::swap(gold, other.gold);
|
||||
std::swap(food, other.food);
|
||||
std::swap(stuff_done, other.stuff_done);
|
||||
std::swap(hostiles_present, other.hostiles_present);
|
||||
std::swap(easy_mode, other.easy_mode);
|
||||
std::swap(less_wm, other.less_wm);
|
||||
std::swap(magic_ptrs, other.magic_ptrs);
|
||||
std::swap(light_level, other.light_level);
|
||||
std::swap(outdoor_corner, other.outdoor_corner);
|
||||
std::swap(i_w_c, other.i_w_c);
|
||||
std::swap(out_loc, other.out_loc);
|
||||
std::swap(town_loc, other.town_loc);
|
||||
std::swap(loc_in_sec, other.loc_in_sec);
|
||||
std::swap(town_num, other.town_num);
|
||||
std::swap(boats, other.boats);
|
||||
std::swap(horses, other.horses);
|
||||
std::swap(creature_save, other.creature_save);
|
||||
std::swap(in_boat, other.in_boat);
|
||||
std::swap(in_horse, other.in_horse);
|
||||
std::swap(out_c, other.out_c);
|
||||
std::swap(magic_store_items, other.magic_store_items);
|
||||
std::swap(store_limited_stock, other.store_limited_stock);
|
||||
std::swap(job_banks, other.job_banks);
|
||||
std::swap(imprisoned_monst, other.imprisoned_monst);
|
||||
std::swap(m_noted, other.m_noted);
|
||||
std::swap(m_seen, other.m_seen);
|
||||
std::swap(journal, other.journal);
|
||||
std::swap(special_notes, other.special_notes);
|
||||
std::swap(talk_save, other.talk_save);
|
||||
std::swap(status, other.status);
|
||||
std::swap(active_quests, other.active_quests);
|
||||
std::swap(left_at, other.left_at);
|
||||
std::swap(left_in, other.left_in);
|
||||
std::swap(direction, other.direction);
|
||||
std::swap(at_which_save_slot, other.at_which_save_slot);
|
||||
std::swap(alchemy, other.alchemy);
|
||||
std::swap(key_times, other.key_times);
|
||||
std::swap(party_event_timers, other.party_event_timers);
|
||||
std::swap(spec_items, other.spec_items);
|
||||
std::swap(total_m_killed, other.total_m_killed);
|
||||
std::swap(total_dam_done, other.total_dam_done);
|
||||
std::swap(total_xp_gained, other.total_xp_gained);
|
||||
std::swap(total_dam_taken, other.total_dam_taken);
|
||||
std::swap(scen_name, other.scen_name);
|
||||
std::swap(adven, other.adven);
|
||||
std::swap(setup, other.setup);
|
||||
std::swap(stored_items, other.stored_items);
|
||||
std::swap(summons, other.summons);
|
||||
std::swap(scen_won, other.scen_won);
|
||||
std::swap(scen_played, other.scen_played);
|
||||
std::swap(campaign_flags, other.campaign_flags);
|
||||
std::swap(pointers, other.pointers);
|
||||
for(size_t i = 0; i < adven.size(); i++) {
|
||||
std::swap(adven[i], other.adven[i]);
|
||||
void swap(cParty& lhs, cParty& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.next_pc_id, rhs.next_pc_id);
|
||||
swap(lhs.age, rhs.age);
|
||||
swap(lhs.gold, rhs.gold);
|
||||
swap(lhs.food, rhs.food);
|
||||
swap(lhs.stuff_done, rhs.stuff_done);
|
||||
swap(lhs.hostiles_present, rhs.hostiles_present);
|
||||
swap(lhs.easy_mode, rhs.easy_mode);
|
||||
swap(lhs.less_wm, rhs.less_wm);
|
||||
swap(lhs.magic_ptrs, rhs.magic_ptrs);
|
||||
swap(lhs.light_level, rhs.light_level);
|
||||
swap(lhs.outdoor_corner, rhs.outdoor_corner);
|
||||
swap(lhs.i_w_c, rhs.i_w_c);
|
||||
swap(lhs.out_loc, rhs.out_loc);
|
||||
swap(lhs.town_loc, rhs.town_loc);
|
||||
swap(lhs.loc_in_sec, rhs.loc_in_sec);
|
||||
swap(lhs.town_num, rhs.town_num);
|
||||
swap(lhs.boats, rhs.boats);
|
||||
swap(lhs.horses, rhs.horses);
|
||||
swap(lhs.creature_save, rhs.creature_save);
|
||||
swap(lhs.in_boat, rhs.in_boat);
|
||||
swap(lhs.in_horse, rhs.in_horse);
|
||||
swap(lhs.out_c, rhs.out_c);
|
||||
swap(lhs.magic_store_items, rhs.magic_store_items);
|
||||
swap(lhs.store_limited_stock, rhs.store_limited_stock);
|
||||
swap(lhs.job_banks, rhs.job_banks);
|
||||
swap(lhs.imprisoned_monst, rhs.imprisoned_monst);
|
||||
swap(lhs.m_noted, rhs.m_noted);
|
||||
swap(lhs.m_seen, rhs.m_seen);
|
||||
swap(lhs.journal, rhs.journal);
|
||||
swap(lhs.special_notes, rhs.special_notes);
|
||||
swap(lhs.talk_save, rhs.talk_save);
|
||||
swap(lhs.status, rhs.status);
|
||||
swap(lhs.active_quests, rhs.active_quests);
|
||||
swap(lhs.left_at, rhs.left_at);
|
||||
swap(lhs.left_in, rhs.left_in);
|
||||
swap(lhs.direction, rhs.direction);
|
||||
swap(lhs.at_which_save_slot, rhs.at_which_save_slot);
|
||||
swap(lhs.alchemy, rhs.alchemy);
|
||||
swap(lhs.key_times, rhs.key_times);
|
||||
swap(lhs.party_event_timers, rhs.party_event_timers);
|
||||
swap(lhs.spec_items, rhs.spec_items);
|
||||
swap(lhs.total_m_killed, rhs.total_m_killed);
|
||||
swap(lhs.total_dam_done, rhs.total_dam_done);
|
||||
swap(lhs.total_xp_gained, rhs.total_xp_gained);
|
||||
swap(lhs.total_dam_taken, rhs.total_dam_taken);
|
||||
swap(lhs.scen_name, rhs.scen_name);
|
||||
swap(lhs.adven, rhs.adven);
|
||||
swap(lhs.setup, rhs.setup);
|
||||
swap(lhs.stored_items, rhs.stored_items);
|
||||
swap(lhs.summons, rhs.summons);
|
||||
swap(lhs.scen_won, rhs.scen_won);
|
||||
swap(lhs.scen_played, rhs.scen_played);
|
||||
swap(lhs.campaign_flags, rhs.campaign_flags);
|
||||
swap(lhs.pointers, rhs.pointers);
|
||||
for(size_t i = 0; i < lhs.adven.size(); i++) {
|
||||
swap(*lhs.adven[i], *rhs.adven[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
typedef std::vector<cConvers>::iterator talkIter;
|
||||
cParty(ePartyPreset party_preset = PARTY_DEFAULT);
|
||||
// Copy-and-swap
|
||||
void swap(cParty& other);
|
||||
friend void swap(cParty& lhs, cParty& rhs);
|
||||
cParty(const cParty& other);
|
||||
cParty(cParty&& other);
|
||||
cParty& operator=(cParty other);
|
||||
|
||||
@@ -1160,34 +1160,35 @@ cPlayer::cPlayer(no_party_t, const cPlayer& other)
|
||||
{}
|
||||
|
||||
cPlayer::cPlayer(cPlayer&& other) : weap_poisoned(*this, other.weap_poisoned.slot) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
void cPlayer::swap(cPlayer& other) {
|
||||
void swap(cPlayer& lhs, cPlayer& rhs) {
|
||||
using std::swap;
|
||||
// Don't swap the party reference!
|
||||
std::swap(main_status, other.main_status);
|
||||
std::swap(name, other.name);
|
||||
std::swap(skills, other.skills);
|
||||
std::swap(max_health, other.max_health);
|
||||
std::swap(cur_health, other.cur_health);
|
||||
std::swap(max_sp, other.max_sp);
|
||||
std::swap(cur_sp, other.cur_sp);
|
||||
std::swap(experience, other.experience);
|
||||
std::swap(skill_pts, other.skill_pts);
|
||||
std::swap(level, other.level);
|
||||
std::swap(items, other.items);
|
||||
std::swap(equip, other.equip);
|
||||
std::swap(priest_spells, other.priest_spells);
|
||||
std::swap(mage_spells, other.mage_spells);
|
||||
std::swap(which_graphic, other.which_graphic);
|
||||
std::swap(weap_poisoned.slot, other.weap_poisoned.slot);
|
||||
std::swap(traits, other.traits);
|
||||
std::swap(race, other.race);
|
||||
std::swap(unique_id, other.unique_id);
|
||||
std::swap(last_cast, other.last_cast);
|
||||
std::swap(combat_pos, other.combat_pos);
|
||||
std::swap(parry, other.parry);
|
||||
std::swap(last_attacked, other.last_attacked);
|
||||
swap(lhs.main_status, rhs.main_status);
|
||||
swap(lhs.name, rhs.name);
|
||||
swap(lhs.skills, rhs.skills);
|
||||
swap(lhs.max_health, rhs.max_health);
|
||||
swap(lhs.cur_health, rhs.cur_health);
|
||||
swap(lhs.max_sp, rhs.max_sp);
|
||||
swap(lhs.cur_sp, rhs.cur_sp);
|
||||
swap(lhs.experience, rhs.experience);
|
||||
swap(lhs.skill_pts, rhs.skill_pts);
|
||||
swap(lhs.level, rhs.level);
|
||||
swap(lhs.items, rhs.items);
|
||||
swap(lhs.equip, rhs.equip);
|
||||
swap(lhs.priest_spells, rhs.priest_spells);
|
||||
swap(lhs.mage_spells, rhs.mage_spells);
|
||||
swap(lhs.which_graphic, rhs.which_graphic);
|
||||
swap(lhs.weap_poisoned.slot, rhs.weap_poisoned.slot);
|
||||
swap(lhs.traits, rhs.traits);
|
||||
swap(lhs.race, rhs.race);
|
||||
swap(lhs.unique_id, rhs.unique_id);
|
||||
swap(lhs.last_cast, rhs.last_cast);
|
||||
swap(lhs.combat_pos, rhs.combat_pos);
|
||||
swap(lhs.parry, rhs.parry);
|
||||
swap(lhs.last_attacked, rhs.last_attacked);
|
||||
}
|
||||
|
||||
void operator += (eMainStatus& stat, eMainStatus othr){
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
void readFrom(const cTagFile& file);
|
||||
virtual ~cPlayer() = default;
|
||||
// Copy-and-swap
|
||||
void swap(cPlayer& other);
|
||||
friend void swap(cPlayer& lhs, cPlayer& rhs);
|
||||
cPlayer(const cPlayer& other) = delete;
|
||||
cPlayer(cPlayer&& other);
|
||||
// For now, not assignable because of an issue of how to handle the unique_id
|
||||
|
||||
@@ -67,8 +67,9 @@ void cPopulation::assign(size_t n, const cTownperson& other, const cMonster& bas
|
||||
dudes[n].summon_time = 0;
|
||||
}
|
||||
|
||||
void cPopulation::swap(cPopulation& other) {
|
||||
std::swap(dudes, other.dudes);
|
||||
std::swap(which_town, other.which_town);
|
||||
std::swap(hostile, other.hostile);
|
||||
void swap(cPopulation& lhs, cPopulation& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.dudes, rhs.dudes);
|
||||
swap(lhs.which_town, rhs.which_town);
|
||||
swap(lhs.hostile, rhs.hostile);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
std::deque<cCreature>::iterator end() {return dudes.end();}
|
||||
// Apparently Visual Studio needs this to work
|
||||
cPopulation& operator=(const cPopulation& other) = default;
|
||||
void swap(cPopulation& other);
|
||||
friend void swap(cPopulation& lhs, cPopulation& rhs);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -994,27 +994,28 @@ cUniverse::cUniverse(const cUniverse& other)
|
||||
}
|
||||
|
||||
cUniverse::cUniverse(cUniverse&& other) : town(*this), out(*this) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
}
|
||||
|
||||
cUniverse& cUniverse::operator=(cUniverse other) {
|
||||
swap(other);
|
||||
swap(*this, other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cUniverse::swap(cUniverse& other) {
|
||||
party.swap(other.party);
|
||||
town.swap(other.town);
|
||||
out.swap(other.out);
|
||||
scenario.swap(other.scenario);
|
||||
std::swap(stored_pcs, other.stored_pcs);
|
||||
std::swap(file, other.file);
|
||||
std::swap(debug_mode, other.debug_mode);
|
||||
std::swap(ghost_mode, other.ghost_mode);
|
||||
std::swap(node_step_through, other.node_step_through);
|
||||
std::swap(cur_pc, other.cur_pc);
|
||||
std::swap(strbuf, other.strbuf);
|
||||
std::swap(extrabufs, other.extrabufs);
|
||||
void swap(cUniverse& lhs, cUniverse& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.party, rhs.party);
|
||||
swap(lhs.town, rhs.town);
|
||||
swap(lhs.out, rhs.out);
|
||||
swap(lhs.scenario, rhs.scenario);
|
||||
swap(lhs.stored_pcs, rhs.stored_pcs);
|
||||
swap(lhs.file, rhs.file);
|
||||
swap(lhs.debug_mode, rhs.debug_mode);
|
||||
swap(lhs.ghost_mode, rhs.ghost_mode);
|
||||
swap(lhs.node_step_through, rhs.node_step_through);
|
||||
swap(lhs.cur_pc, rhs.cur_pc);
|
||||
swap(lhs.strbuf, rhs.strbuf);
|
||||
swap(lhs.extrabufs, rhs.extrabufs);
|
||||
}
|
||||
|
||||
void cCurOut::copy(const cCurOut& other) {
|
||||
@@ -1022,11 +1023,10 @@ void cCurOut::copy(const cCurOut& other) {
|
||||
out_e = other.out_e;
|
||||
}
|
||||
|
||||
void cCurOut::swap(cCurOut& other) {
|
||||
cCurOut temp(univ);
|
||||
temp.copy(other);
|
||||
other.copy(*this);
|
||||
copy(temp);
|
||||
void swap(cCurOut& lhs, cCurOut& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.out, rhs.out);
|
||||
swap(lhs.out_e, rhs.out_e);
|
||||
}
|
||||
|
||||
void cCurTown::copy(const cCurTown& other) {
|
||||
@@ -1038,13 +1038,14 @@ void cCurTown::copy(const cCurTown& other) {
|
||||
fields = other.fields;
|
||||
}
|
||||
|
||||
void cCurTown::swap(cCurTown& other) {
|
||||
std::swap(cur_talk_loaded, other.cur_talk_loaded);
|
||||
std::swap(quickfire_present, other.quickfire_present);
|
||||
std::swap(belt_present, other.belt_present);
|
||||
monst.swap(other.monst);
|
||||
std::swap(items, other.items);
|
||||
fields.swap(other.fields);
|
||||
void swap(cCurTown& lhs, cCurTown& rhs) {
|
||||
using std::swap;
|
||||
swap(lhs.cur_talk_loaded, rhs.cur_talk_loaded);
|
||||
swap(lhs.quickfire_present, rhs.quickfire_present);
|
||||
swap(lhs.belt_present, rhs.belt_present);
|
||||
swap(lhs.monst, rhs.monst);
|
||||
swap(lhs.items, rhs.items);
|
||||
swap(lhs.fields, rhs.fields);
|
||||
}
|
||||
|
||||
void cUniverse::check_monst(cMonster& monst) {
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
cCurTown& operator=(const cCurTown&& other) = delete;
|
||||
// This implements the actual copy/move.
|
||||
void copy(const cCurTown& other);
|
||||
void swap(cCurTown& other);
|
||||
friend void swap(cCurTown& lhs, cCurTown& rhs);
|
||||
};
|
||||
|
||||
class cCurOut {
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
cCurOut& operator=(const cCurOut&& other) = delete;
|
||||
// This implements the actual copy/move.
|
||||
void copy(const cCurOut& other);
|
||||
void swap(cCurOut& other);
|
||||
friend void swap(cCurOut& lhs, cCurOut& rhs);
|
||||
};
|
||||
|
||||
enum eTargetType {TARG_ANY, TARG_PC, TARG_MONST};
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
short difficulty_adjust() const;
|
||||
explicit cUniverse(ePartyPreset party_type = PARTY_DEFAULT);
|
||||
// Copy-and-swap
|
||||
void swap(cUniverse& other);
|
||||
friend void swap(cUniverse& lhs, cUniverse& rhs);
|
||||
cUniverse(const cUniverse& other);
|
||||
cUniverse(cUniverse&& other);
|
||||
cUniverse& operator=(cUniverse other);
|
||||
|
||||
Reference in New Issue
Block a user