qualify all calls to std::move

This commit is contained in:
Martin Michelsen
2023-05-15 23:46:19 -07:00
parent f813ed68df
commit 695e53a714
26 changed files with 145 additions and 141 deletions
+6 -6
View File
@@ -106,7 +106,7 @@ string BattleRecord::serialize() const {
for (const auto& ev : this->events) {
ev.serialize(w);
}
return move(w.str());
return std::move(w.str());
}
bool BattleRecord::writable() const {
@@ -170,7 +170,7 @@ void BattleRecord::add_command(Event::Type type, string&& data) {
Event& ev = this->events.emplace_back();
ev.type = type;
ev.timestamp = now();
ev.data = move(data);
ev.data = std::move(data);
}
void BattleRecord::add_chat_message(
@@ -182,7 +182,7 @@ void BattleRecord::add_chat_message(
ev.type = Event::Type::CHAT_MESSAGE;
ev.timestamp = now();
ev.guild_card_number = guild_card_number;
ev.data = move(data);
ev.data = std::move(data);
}
bool BattleRecord::is_map_definition_event(const Event& ev) {
@@ -248,7 +248,7 @@ void BattleRecord::set_battle_start_timestamp() {
initial_ev.players.emplace_back(players[z]);
}
}
new_events.emplace_back(move(initial_ev));
new_events.emplace_back(std::move(initial_ev));
// Skip all events before the last map definition event, and only retain
// battle commands between then and now (since these battle commands will all
@@ -264,10 +264,10 @@ void BattleRecord::set_battle_start_timestamp() {
}
for (; it != this->events.end(); it++) {
if (it->type == Event::Type::BATTLE_COMMAND) {
new_events.emplace_back(move(*it));
new_events.emplace_back(std::move(*it));
}
}
this->events = move(new_events);
this->events = std::move(new_events);
}
void BattleRecord::set_battle_end_timestamp() {
-2
View File
@@ -3871,7 +3871,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
const InterferenceProbabilityEntry* ret_entry = nullptr;
int16_t current_max = -1;
size_t logical_index = 0;
uint16_t current_row_card_id = 0xFFFF;
for (size_t z = 0; z < num_entries; z++) {
const auto& entry = entries[z];
@@ -3885,7 +3884,6 @@ const InterferenceProbabilityEntry* get_interference_probability_entry(
current_max = v;
}
}
logical_index++;
} else {
current_row_card_id = current_column_card_id;
}
+9 -9
View File
@@ -856,7 +856,7 @@ shared_ptr<JSONObject> Rules::json() const {
dict.emplace("disable_dialogue", make_json_int(this->disable_dialogue));
dict.emplace("dice_exchange_mode", make_json_int(static_cast<uint8_t>(this->dice_exchange_mode)));
dict.emplace("disable_dice_boost", make_json_int(this->disable_dice_boost));
return shared_ptr<JSONObject>(new JSONObject(move(dict)));
return shared_ptr<JSONObject>(new JSONObject(std::move(dict)));
}
void Rules::set_defaults() {
@@ -1015,7 +1015,7 @@ string MapDefinition::str(const DataIndex* data_index) const {
for (size_t x = 0; x < 0x10; x++) {
line += string_printf(" %02hhX", tiles[y][x]);
}
lines.emplace_back(move(line));
lines.emplace_back(std::move(line));
}
};
@@ -1212,7 +1212,7 @@ string MapDefinition::str(const DataIndex* data_index) const {
}
}
unavailable_sc_cards += ']';
lines.emplace_back(move(unavailable_sc_cards));
lines.emplace_back(std::move(unavailable_sc_cards));
for (size_t z = 0; z < 4; z++) {
string player_type;
switch (this->entry_states[z].player_type) {
@@ -1403,14 +1403,14 @@ DataIndex::DataIndex(const string& directory, uint32_t behavior_flags)
for (size_t offset = tag.find(" "); offset != string::npos; offset = tag.find(" ")) {
tag = tag.substr(0, offset) + tag.substr(offset + 1);
}
tags.emplace_back(move(tag));
tags.emplace_back(std::move(tag));
}
}
if (!card_text.emplace(card_id, move(orig_text)).second) {
if (!card_text.emplace(card_id, std::move(orig_text)).second) {
throw runtime_error("duplicate card text id");
}
if (!card_tags.emplace(card_id, move(tags)).second) {
if (!card_tags.emplace(card_id, std::move(tags)).second) {
throw logic_error("duplicate card tags id");
}
@@ -1473,11 +1473,11 @@ DataIndex::DataIndex(const string& directory, uint32_t behavior_flags)
if (this->behavior_flags & BehaviorFlag::LOAD_CARD_TEXT) {
try {
entry->text = move(card_text.at(defs[x].card_id));
entry->text = std::move(card_text.at(defs[x].card_id));
} catch (const out_of_range&) {
}
try {
entry->debug_tags = move(card_tags.at(defs[x].card_id));
entry->debug_tags = std::move(card_tags.at(defs[x].card_id));
} catch (const out_of_range&) {
}
}
@@ -1658,7 +1658,7 @@ const string& DataIndex::get_compressed_map_list() const {
StringWriter compressed_w;
compressed_w.put_u32b(prs.input_size());
compressed_w.write(prs.close());
this->compressed_map_list = move(compressed_w.str());
this->compressed_map_list = std::move(compressed_w.str());
if (this->compressed_map_list.size() > 0x7BEC) {
throw runtime_error("Episode 3 compressed map list is too large");
}
+3 -3
View File
@@ -225,7 +225,7 @@ string Server::prepare_6xB6x41_map_definition(
uint32_t subcommand_size = (compressed.size() + sizeof(G_MapData_GC_Ep3_6xB6x41) + 3) & (~3);
w.put<G_MapData_GC_Ep3_6xB6x41>({{{{0xB6, 0, 0}, subcommand_size}, 0x41, {}}, map->map.map_number.load(), compressed.size(), 0});
w.write(compressed);
return move(w.str());
return std::move(w.str());
}
void Server::send_commands_for_joining_spectator(Channel& c) const {
@@ -2146,7 +2146,7 @@ void Server::handle_6xB3x40_map_list_request(const string& data) {
if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command(
BattleRecord::Event::Type::BATTLE_COMMAND, move(w.str()));
BattleRecord::Event::Type::BATTLE_COMMAND, std::move(w.str()));
}
}
@@ -2170,7 +2170,7 @@ void Server::handle_6xB3x41_map_request(const string& data) {
if (l->battle_record && l->battle_record->writable()) {
l->battle_record->add_command(
BattleRecord::Event::Type::BATTLE_COMMAND, move(out_cmd));
BattleRecord::Event::Type::BATTLE_COMMAND, std::move(out_cmd));
}
}
+7 -7
View File
@@ -380,9 +380,9 @@ void Tournament::init() {
current_round_matches[z + 1]);
current_round_matches[z]->following = m;
current_round_matches[z + 1]->following = m;
next_round_matches.emplace_back(move(m));
next_round_matches.emplace_back(std::move(m));
}
current_round_matches = move(next_round_matches);
current_round_matches = std::move(next_round_matches);
}
this->final_match = current_round_matches.at(0);
@@ -476,14 +476,14 @@ std::shared_ptr<JSONObject> Tournament::json() const {
player_jsons_list.emplace_back(make_json_str(player.com_deck->deck_name));
}
}
team_dict.emplace("player_specs", make_json_list(move(player_jsons_list)));
team_dict.emplace("player_specs", make_json_list(std::move(player_jsons_list)));
team_dict.emplace("name", make_json_str(team->name));
team_dict.emplace("password", make_json_str(team->password));
team_dict.emplace("num_rounds_cleared", make_json_int(team->num_rounds_cleared));
teams_list.emplace_back(new JSONObject(move(team_dict)));
teams_list.emplace_back(new JSONObject(std::move(team_dict)));
}
dict.emplace("teams", make_json_list(move(teams_list)));
return shared_ptr<JSONObject>(new JSONObject(move(dict)));
dict.emplace("teams", make_json_list(std::move(teams_list)));
return shared_ptr<JSONObject>(new JSONObject(std::move(dict)));
}
std::shared_ptr<const DataIndex> Tournament::get_data_index() const {
@@ -690,7 +690,7 @@ void TournamentIndex::save() const {
list.emplace_back(make_json_null());
}
}
auto json = make_json_list(move(list));
auto json = make_json_list(std::move(list));
save_file(this->state_filename, json->serialize(JSONObject::SerializeOption::FORMAT));
}