From 6654030bd3d707ed444de534fb48b2dcd9ca826d Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 2 May 2023 09:27:34 -0700 Subject: [PATCH] reformat some files after clang-format option change --- src/ItemCreator.cc | 21 ++- src/Items.cc | 2 +- src/License.cc | 22 ++- src/Lobby.cc | 4 +- src/ReceiveCommands.cc | 336 +++++++++++++++++++------------------- src/ReceiveSubcommands.cc | 282 ++++++++++++++++---------------- src/ServerState.cc | 41 +++-- 7 files changed, 356 insertions(+), 352 deletions(-) diff --git a/src/ItemCreator.cc b/src/ItemCreator.cc index a33f7bf0..6e899df8 100644 --- a/src/ItemCreator.cc +++ b/src/ItemCreator.cc @@ -170,8 +170,8 @@ ItemData ItemCreator::on_monster_item_drop_with_norm_area( if (item.empty()) { uint32_t item_class_determinant = this->should_allow_meseta_drops() - ? this->rand_int(3) - : (this->rand_int(2) + 1); + ? this->rand_int(3) + : (this->rand_int(2) + 1); uint32_t item_class; switch (item_class_determinant) { @@ -189,7 +189,7 @@ ItemData ItemCreator::on_monster_item_drop_with_norm_area( } this->log.info("Rare drop not chosen; item class determinant is %" PRIu32 "; item class is %" PRIu32, - item_class_determinant, item_class); + item_class_determinant, item_class); switch (item_class) { case 0: // Weapon @@ -211,7 +211,7 @@ ItemData ItemCreator::on_monster_item_drop_with_norm_area( item.data1[0] = 0x04; item.data2d = this->choose_meseta_amount( this->pt->enemy_meseta_ranges, enemy_type) & - 0xFFFF; + 0xFFFF; break; default: return item; @@ -423,8 +423,7 @@ void ItemCreator::clear_item_if_restricted(ItemData& item) const { // Note: PSO GC doesn't check for 0x61 or 0x62 here since those items // (HP/Resurrection and TP/Resurrection) only exist on BB. if (item.data1[0] == 1) { - if ((item.data1[1] == 3) && (((item.data1[2] >= 0x33) && (item.data1[2] <= 0x38)) || - (item.data1[2] == 0x61) || (item.data1[2] == 0x62))) { + if ((item.data1[1] == 3) && (((item.data1[2] >= 0x33) && (item.data1[2] <= 0x38)) || (item.data1[2] == 0x61) || (item.data1[2] == 0x62))) { this->log.info("Restricted: restore items not allowed in Challenge mode"); item.clear(); } @@ -476,7 +475,7 @@ void ItemCreator::clear_item_if_restricted(ItemData& item) const { break; case Restrictions::TechDiskMode::LIMIT_LEVEL: this->log.info("Restricted: tech disk level limited to %hhu", - static_cast(this->restrictions->max_tech_disk_level + 1)); + static_cast(this->restrictions->max_tech_disk_level + 1)); if (this->restrictions->max_tech_disk_level == 0) { item.data1[2] = 0; } else { @@ -532,7 +531,7 @@ void ItemCreator::generate_common_item_variances( case 4: item.data2d = this->choose_meseta_amount( this->pt->box_meseta_ranges, norm_area) & - 0xFFFF; + 0xFFFF; break; default: // Note: The original code does the following here: @@ -836,7 +835,7 @@ template IntT ItemCreator::get_rand_from_weighted_tables_2d_vertical( const parray, Y>& tables, size_t offset) { return ItemCreator::get_rand_from_weighted_tables(tables[0].data(), - offset, Y, X); + offset, Y, X); } // Note: There are clearly better ways of doing this, but this implementation @@ -1477,8 +1476,8 @@ void ItemCreator::generate_weapon_shop_item_grind( uint8_t favored_weapon = favored_weapon_by_section_id.at(this->section_id); bool is_favored = (favored_weapon != 0xFF) && (item.data1[1] == favored_weapon); const auto* range = is_favored - ? this->weapon_random_set->get_favored_grind_range(table_index) - : this->weapon_random_set->get_standard_grind_range(table_index); + ? this->weapon_random_set->get_favored_grind_range(table_index) + : this->weapon_random_set->get_standard_grind_range(table_index); const auto& weapon_def = this->item_parameter_table->get_weapon( item.data1[1], item.data1[2]); diff --git a/src/Items.cc b/src/Items.cc index 5e929ef6..e10a964e 100644 --- a/src/Items.cc +++ b/src/Items.cc @@ -165,7 +165,7 @@ void player_use_item(shared_ptr c, size_t item_index) { // used item. On GC and later versions, this does not happen, so we should // delete the item here. bool should_delete_item = (c->version() != GameVersion::DC) && - (c->version() != GameVersion::PC); + (c->version() != GameVersion::PC); auto& item = c->game_data.player()->inventory.items[item_index]; if (item.data.data1w[0] == 0x0203) { // technique disk diff --git a/src/License.cc b/src/License.cc index 613cdf76..fda5953d 100644 --- a/src/License.cc +++ b/src/License.cc @@ -10,7 +10,10 @@ using namespace std; -License::License() : serial_number(0), privileges(0), ban_end_time(0) {} +License::License() + : serial_number(0), + privileges(0), + ban_end_time(0) {} string License::str() const { string ret = string_printf("License(serial_number=%" PRIu32, this->serial_number); @@ -37,10 +40,13 @@ string License::str() const { return ret + ")"; } -LicenseManager::LicenseManager() : filename(""), autosave(false) {} +LicenseManager::LicenseManager() + : filename(""), + autosave(false) {} LicenseManager::LicenseManager(const string& filename) - : filename(filename), autosave(true) { + : filename(filename), + autosave(true) { try { auto licenses = load_vector_file(this->filename); for (const auto& read_license : licenses) { @@ -58,7 +64,7 @@ LicenseManager::LicenseManager(const string& filename) } catch (const cannot_open_file&) { license_log.warning("File %s does not exist; no licenses are registered", - this->filename.c_str()); + this->filename.c_str()); } } @@ -80,7 +86,7 @@ void LicenseManager::set_autosave(bool autosave) { } shared_ptr LicenseManager::verify_pc(uint32_t serial_number, - const string& access_key) const { + const string& access_key) const { try { auto& license = this->serial_number_to_license.at(serial_number); if (!license->access_key.eq_n(access_key, 8)) { @@ -97,7 +103,7 @@ shared_ptr LicenseManager::verify_pc(uint32_t serial_number, } shared_ptr LicenseManager::verify_gc(uint32_t serial_number, - const string& access_key) const { + const string& access_key) const { try { auto& license = this->serial_number_to_license.at(serial_number); if (!license->access_key.eq_n(access_key, 12)) { @@ -113,7 +119,7 @@ shared_ptr LicenseManager::verify_gc(uint32_t serial_number, } shared_ptr LicenseManager::verify_gc(uint32_t serial_number, - const string& access_key, const string& password) const { + const string& access_key, const string& password) const { try { auto& license = this->serial_number_to_license.at(serial_number); if (!license->access_key.eq_n(access_key, 12)) { @@ -132,7 +138,7 @@ shared_ptr LicenseManager::verify_gc(uint32_t serial_number, } shared_ptr LicenseManager::verify_bb(const string& username, - const string& password) const { + const string& password) const { try { auto& license = this->bb_username_to_license.at(username); if (license->bb_password != password) { diff --git a/src/Lobby.cc b/src/Lobby.cc index d1e2f7ea..97bd2422 100644 --- a/src/Lobby.cc +++ b/src/Lobby.cc @@ -214,8 +214,8 @@ void Lobby::move_client_to_lobby( dest_lobby->add_client(c, required_client_id); } -shared_ptr Lobby::find_client(const u16string* identifier, - uint64_t serial_number) { +shared_ptr Lobby::find_client( + const u16string* identifier, uint64_t serial_number) { for (size_t x = 0; x < this->max_clients; x++) { if (!this->clients[x]) { continue; diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 67c3caae..0c66b2a2 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -129,7 +129,7 @@ static vector proxy_options_menu_for_client( static void send_client_to_lobby_server(shared_ptr s, shared_ptr c) { const auto& port_name = version_to_lobby_port_name.at(static_cast(c->version())); send_reconnect(c, s->connect_address_for_client(c), - s->name_to_port_config.at(port_name)->port); + s->name_to_port_config.at(port_name)->port); } static void send_client_to_proxy_server(shared_ptr s, shared_ptr c) { @@ -151,7 +151,7 @@ static void send_client_to_proxy_server(shared_ptr s, shared_ptr s, shared_ptr c) { send_menu(c, u"Proxy server", MenuID::PROXY_DESTINATIONS, - s->proxy_destinations_menu_for_version(c->version())); + s->proxy_destinations_menu_for_version(c->version())); } static bool send_enable_send_function_call_if_applicable( @@ -197,7 +197,7 @@ void on_connect(std::shared_ptr s, std::shared_ptr c) { default: c->log.error("Unimplemented behavior: %" PRId64, - static_cast(c->server_behavior)); + static_cast(c->server_behavior)); } } @@ -286,7 +286,7 @@ static void set_console_client_flags( } static void on_DB_V3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (c->channel.crypt_in->type() == PSOEncryption::Type::V2) { @@ -297,7 +297,7 @@ static void on_DB_V3(shared_ptr s, shared_ptr c, uint32_t serial_number = stoul(cmd.serial_number, nullptr, 16); try { auto l = s->license_manager->verify_gc(serial_number, cmd.access_key, - cmd.password); + cmd.password); c->set_license(l); send_command(c, 0x9A, 0x02); @@ -318,7 +318,7 @@ static void on_DB_V3(shared_ptr s, shared_ptr c, return; } else { auto l = LicenseManager::create_license_gc(serial_number, cmd.access_key, - cmd.password, true); + cmd.password, true); s->license_manager->add(l); c->set_license(l); send_command(c, 0x9A, 0x02); @@ -327,7 +327,7 @@ static void on_DB_V3(shared_ptr s, shared_ptr c, } static void on_88_DCNTE(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); c->channel.version = GameVersion::DC; c->flags |= flags_for_version(c->version(), -1); @@ -359,9 +359,9 @@ static void on_88_DCNTE(shared_ptr s, shared_ptr c, } static void on_8B_DCNTE(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data, - sizeof(C_Login_DCNTE_8B), sizeof(C_LoginExtended_DCNTE_8B)); + sizeof(C_Login_DCNTE_8B), sizeof(C_LoginExtended_DCNTE_8B)); c->channel.version = GameVersion::DC; c->flags |= flags_for_version(c->version(), -1); c->flags |= Client::Flag::IS_DC_V1 | Client::Flag::IS_TRIAL_EDITION; @@ -404,7 +404,7 @@ static void on_8B_DCNTE(shared_ptr s, shared_ptr c, } static void on_90_DC(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); c->channel.version = GameVersion::DC; c->flags |= flags_for_version(c->version(), -1); @@ -436,15 +436,15 @@ static void on_90_DC(shared_ptr s, shared_ptr c, } static void on_92_DC(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_t(data); send_command(c, 0x92, 0x01); } static void on_93_DC(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data, - sizeof(C_LoginV1_DC_93), sizeof(C_LoginExtendedV1_DC_93)); + sizeof(C_LoginV1_DC_93), sizeof(C_LoginExtendedV1_DC_93)); set_console_client_flags(c, cmd.sub_version); uint32_t serial_number = stoul(cmd.serial_number, nullptr, 16); @@ -484,7 +484,7 @@ static void on_93_DC(shared_ptr s, shared_ptr c, } static void on_9A(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); set_console_client_flags(c, cmd.sub_version); @@ -540,7 +540,7 @@ static void on_9A(shared_ptr s, shared_ptr c, } static void on_9C(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); c->flags |= flags_for_version(c->version(), cmd.sub_version); @@ -555,7 +555,7 @@ static void on_9C(shared_ptr s, shared_ptr c, break; case GameVersion::GC: l = s->license_manager->verify_gc(serial_number, cmd.access_key, - cmd.password); + cmd.password); break; case GameVersion::XB: throw runtime_error("xbox licenses are not implemented"); @@ -582,11 +582,11 @@ static void on_9C(shared_ptr s, shared_ptr c, case GameVersion::DC: case GameVersion::PC: l = LicenseManager::create_license_pc(serial_number, cmd.access_key, - true); + true); break; case GameVersion::GC: l = LicenseManager::create_license_gc(serial_number, cmd.access_key, - cmd.password, true); + cmd.password, true); break; case GameVersion::XB: throw runtime_error("xbox licenses are not implemented"); @@ -602,11 +602,11 @@ static void on_9C(shared_ptr s, shared_ptr c, } static void on_9D_9E(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { const C_Login_DC_PC_GC_9D* base_cmd; if (command == 0x9D) { base_cmd = &check_size_t(data, - sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_PC_9D)); + sizeof(C_Login_DC_PC_GC_9D), sizeof(C_LoginExtended_PC_9D)); if (base_cmd->is_extended) { if (c->version() == GameVersion::PC) { const auto& cmd = check_size_t(data); @@ -625,7 +625,7 @@ static void on_9D_9E(shared_ptr s, shared_ptr c, // GC and XB send different amounts of data in this command. This is how // newserv determines if a V3 client is GC or XB. const auto& cmd = check_size_t(data, - sizeof(C_Login_GC_9E), sizeof(C_LoginExtended_XB_9E)); + sizeof(C_Login_GC_9E), sizeof(C_LoginExtended_XB_9E)); switch (data.size()) { case sizeof(C_Login_GC_9E): case sizeof(C_LoginExtended_GC_9E): @@ -668,7 +668,7 @@ static void on_9D_9E(shared_ptr s, shared_ptr c, if (base_cmd->unused1 == 0x5F5CA297) { c->flags &= ~(Client::Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL | Client::Flag::NO_SEND_FUNCTION_CALL); } else if (!s->episode_3_send_function_call_enabled && - (c->flags & Client::Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL)) { + (c->flags & Client::Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL)) { c->flags &= ~Client::Flag::USE_OVERFLOW_FOR_SEND_FUNCTION_CALL; c->flags |= Client::Flag::NO_SEND_FUNCTION_CALL; } @@ -726,9 +726,9 @@ static void on_9D_9E(shared_ptr s, shared_ptr c, } static void on_93_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data, - sizeof(C_Login_BB_93) - 8, sizeof(C_Login_BB_93)); + sizeof(C_Login_BB_93) - 8, sizeof(C_Login_BB_93)); bool is_old_format; if (data.size() == sizeof(C_Login_BB_93) - 8) { @@ -789,7 +789,7 @@ static void on_93_BB(shared_ptr s, shared_ptr c, case ClientStateBB::INITIAL_LOGIN: // On first login, send the client to the data server port send_reconnect(c, s->connect_address_for_client(c), - s->name_to_port_config.at("bb-data1")->port); + s->name_to_port_config.at("bb-data1")->port); break; case ClientStateBB::DOWNLOAD_DATA: @@ -812,7 +812,7 @@ static void on_93_BB(shared_ptr s, shared_ptr c, } static void on_9F_V3(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { if (c->version() == GameVersion::BB) { const auto& cfg = check_size_t(data); c->import_config(cfg); @@ -823,13 +823,13 @@ static void on_9F_V3(shared_ptr, shared_ptr c, } static void on_96(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_t(data); send_server_time(c); } static void on_B1(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); send_server_time(c); // The B1 command is sent in response to a 97 command, which is normally part @@ -849,7 +849,7 @@ static void on_B1(shared_ptr s, shared_ptr c, } static void on_BA_Ep3(shared_ptr, - shared_ptr c, uint16_t command, uint32_t, const string& data) { + shared_ptr c, uint16_t command, uint32_t, const string& data) { const auto& in_cmd = check_size_t(data); S_Meseta_GC_Ep3_BA out_cmd = {1000000, 1000000, in_cmd.request_token}; @@ -1125,7 +1125,7 @@ static void on_ep3_battle_table_state_updated( } static void on_E4_Ep3(shared_ptr s, - shared_ptr c, uint16_t, uint32_t flag, const string& data) { + shared_ptr c, uint16_t, uint32_t flag, const string& data) { const auto& cmd = check_size_t(data); auto l = s->find_lobby(c->lobby_id); @@ -1167,7 +1167,7 @@ static void on_E4_Ep3(shared_ptr s, } static void on_E5_Ep3(shared_ptr s, - shared_ptr c, uint16_t, uint32_t flag, const string& data) { + shared_ptr c, uint16_t, uint32_t flag, const string& data) { check_size_t(data); auto l = s->find_lobby(c->lobby_id); if (l->is_game() || !l->is_ep3()) { @@ -1187,7 +1187,7 @@ static void on_E5_Ep3(shared_ptr s, } static void on_DC_Ep3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string& data) { + uint16_t, uint32_t flag, const string& data) { check_size_v(data.size(), 0); shared_ptr l; @@ -1251,7 +1251,7 @@ static void on_tournament_bracket_updated( } static void on_CA_Ep3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { shared_ptr l; try { l = s->find_lobby(c->lobby_id); @@ -1304,8 +1304,8 @@ static void on_CA_Ep3(shared_ptr s, shared_ptr c, lobby_data.player_tag = 0x00010000; lobby_data.guild_card = existing_c->license->serial_number; l->battle_record->add_player(lobby_data, - existing_c->game_data.player()->inventory, - existing_c->game_data.player()->disp.to_dcpcv3()); + existing_c->game_data.player()->inventory, + existing_c->game_data.player()->disp.to_dcpcv3()); } } if (l->prev_battle_record) { @@ -1338,7 +1338,7 @@ static void on_CA_Ep3(shared_ptr s, shared_ptr c, } static void on_E2_Ep3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string&) { + uint16_t, uint32_t flag, const string&) { switch (flag) { case 0x00: // Request tournament list send_ep3_tournament_list(s, c, false); @@ -1382,11 +1382,11 @@ static void on_E2_Ep3(shared_ptr s, shared_ptr c, } static void on_D6_V3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); if (c->flags & Client::Flag::IN_INFORMATION_MENU) { send_menu(c, u"Information", MenuID::INFORMATION, - *s->information_menu_for_version(c->version())); + *s->information_menu_for_version(c->version())); } else if (c->flags & Client::Flag::AT_WELCOME_MESSAGE) { send_enable_send_function_call_if_applicable(s, c); c->flags &= ~Client::Flag::AT_WELCOME_MESSAGE; @@ -1396,7 +1396,7 @@ static void on_D6_V3(shared_ptr s, shared_ptr c, } static void on_09(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); switch (cmd.menu_id) { @@ -1516,22 +1516,22 @@ static void on_09(shared_ptr s, shared_ptr c, auto name = encode_sjis(player->disp.name); if (game->is_ep3()) { info += string_printf("%zu: $C6%s$C7 L%" PRIu32 "\n", - x + 1, name.c_str(), player->disp.level + 1); + x + 1, name.c_str(), player->disp.level + 1); } else { info += string_printf("%zu: $C6%s$C7 %s L%" PRIu32 "\n", - x + 1, name.c_str(), - abbreviation_for_char_class(player->disp.char_class), - player->disp.level + 1); + x + 1, name.c_str(), + abbreviation_for_char_class(player->disp.char_class), + player->disp.level + 1); } } } string secid_str = name_for_section_id(game->section_id); info += string_printf("%s %c %s %s\n", - abbreviation_for_episode(game->episode), - abbreviation_for_difficulty(game->difficulty), - abbreviation_for_mode(game->mode), - secid_str.c_str()); + abbreviation_for_episode(game->episode), + abbreviation_for_difficulty(game->difficulty), + abbreviation_for_mode(game->mode), + secid_str.c_str()); bool cheats_enabled = game->flags & Lobby::Flag::CHEATS_ENABLED; bool locked = !game->password.empty(); @@ -1614,17 +1614,17 @@ static void on_09(shared_ptr s, shared_ptr c, message = "(No registrant)"; } else if (team->max_players == 1) { message = string_printf("$C6%s$C7\n%zu %s", - team->name.c_str(), - team->num_rounds_cleared, - team->num_rounds_cleared == 1 ? "win" : "wins"); + team->name.c_str(), + team->num_rounds_cleared, + team->num_rounds_cleared == 1 ? "win" : "wins"); } else { message = string_printf("$C6%s$C7\n%zuH/%zuC\n%zu %s\n%s", - team->name.c_str(), - team->num_human_players(), - team->num_com_players(), - team->num_rounds_cleared, - team->num_rounds_cleared == 1 ? "win" : "wins", - team->password.empty() ? "" : "Locked"); + team->name.c_str(), + team->num_human_players(), + team->num_com_players(), + team->num_rounds_cleared, + team->num_rounds_cleared == 1 ? "win" : "wins", + team->password.empty() ? "" : "Locked"); } send_ship_info(c, decode_sjis(message)); } else { @@ -1643,7 +1643,7 @@ static void on_09(shared_ptr s, shared_ptr c, } static void on_10(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { bool uses_unicode = ((c->version() == GameVersion::PC) || (c->version() == GameVersion::BB)); uint32_t menu_id; @@ -1700,7 +1700,7 @@ static void on_10(shared_ptr s, shared_ptr c, case MainMenuItemID::INFORMATION: send_menu(c, u"Information", MenuID::INFORMATION, - *s->information_menu_for_version(c->version())); + *s->information_menu_for_version(c->version())); c->flags |= Client::Flag::IN_INFORMATION_MENU; break; @@ -1818,7 +1818,7 @@ static void on_10(shared_ptr s, shared_ptr c, c->options.zero_remote_guild_card = !c->options.zero_remote_guild_card; resend_proxy_options_menu: send_menu(c, s->name.c_str(), MenuID::PROXY_OPTIONS, - proxy_options_menu_for_client(s, c)); + proxy_options_menu_for_client(s, c)); break; default: send_message_box(c, u"Incorrect menu item ID."); @@ -1833,7 +1833,7 @@ static void on_10(shared_ptr s, shared_ptr c, } else if (item_id == ProxyDestinationsMenuItemID::OPTIONS) { send_menu(c, s->name.c_str(), MenuID::PROXY_OPTIONS, - proxy_options_menu_for_client(s, c)); + proxy_options_menu_for_client(s, c)); } else { const pair* dest = nullptr; @@ -1934,8 +1934,8 @@ static void on_10(shared_ptr s, shared_ptr c, } shared_ptr l = c->lobby_id ? s->find_lobby(c->lobby_id) : nullptr; auto quests = s->quest_index->filter(c->version(), - c->flags & Client::Flag::IS_DC_V1, - static_cast(item_id & 0xFF)); + c->flags & Client::Flag::IS_DC_V1, + static_cast(item_id & 0xFF)); // Hack: Assume the menu to be sent is the download quest menu if the // client is not in any lobby @@ -1991,9 +1991,9 @@ static void on_10(shared_ptr s, shared_ptr c, } send_open_quest_file(l->clients[x], bin_basename + ".bin", - bin_basename, bin_contents, QuestFileType::ONLINE); + bin_basename, bin_contents, QuestFileType::ONLINE); send_open_quest_file(l->clients[x], dat_basename + ".dat", - dat_basename, dat_contents, QuestFileType::ONLINE); + dat_basename, dat_contents, QuestFileType::ONLINE); // There is no such thing as command AC on PSO V2 - quests just start // immediately when they're done downloading. (This is also the case @@ -2020,10 +2020,10 @@ static void on_10(shared_ptr s, shared_ptr c, q = q->create_download_quest(); } send_open_quest_file(c, quest_name, bin_basename, q->bin_contents(), - is_ep3 ? QuestFileType::EPISODE_3 : QuestFileType::DOWNLOAD); + is_ep3 ? QuestFileType::EPISODE_3 : QuestFileType::DOWNLOAD); if (dat_contents) { send_open_quest_file(c, quest_name, dat_basename, q->dat_contents(), - is_ep3 ? QuestFileType::EPISODE_3 : QuestFileType::DOWNLOAD); + is_ep3 ? QuestFileType::EPISODE_3 : QuestFileType::DOWNLOAD); } } break; @@ -2073,7 +2073,7 @@ static void on_10(shared_ptr s, shared_ptr c, auto tourn = s->ep3_tournament_index->get_tournament(item_id); if (tourn) { send_ep3_tournament_entry_list(c, tourn, - (menu_id == MenuID::TOURNAMENTS_FOR_SPEC)); + (menu_id == MenuID::TOURNAMENTS_FOR_SPEC)); } break; } @@ -2108,7 +2108,7 @@ After registration ends, start your matches by\n\ standing at the rightmost 4-player Battle Table\n\ in the lobby along with your partner (if any) and\n\ opponent(s).", - tourn->get_name().c_str()); + tourn->get_name().c_str()); send_ep3_timed_message_box(c->channel, 240, message.c_str()); s->ep3_tournament_index->save(); @@ -2133,7 +2133,7 @@ opponent(s).", } static void on_84(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (cmd.menu_id != MenuID::LOBBY) { @@ -2170,20 +2170,20 @@ static void on_84(shared_ptr s, shared_ptr c, } static void on_08_E6(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { check_size_v(data.size(), 0); send_game_menu(c, s, (command == 0xE6), false); } static void on_1F(shared_ptr s, - shared_ptr c, uint16_t, uint32_t, const string& data) { + shared_ptr c, uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); send_menu(c, u"Information", MenuID::INFORMATION, - *s->information_menu_for_version(c->version()), true); + *s->information_menu_for_version(c->version()), true); } static void on_A0(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string&) { + uint16_t, uint32_t, const string&) { // The client sends data in this command, but none of it is important. We // intentionally don't call check_size here, but just ignore the data. @@ -2204,17 +2204,17 @@ static void on_A0(shared_ptr s, shared_ptr c, const auto& port_name = version_to_login_port_name.at(static_cast(c->version())); send_reconnect(c, s->connect_address_for_client(c), - s->name_to_port_config.at(port_name)->port); + s->name_to_port_config.at(port_name)->port); } static void on_A1(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { // newserv doesn't have blocks; treat block change the same as ship change on_A0(s, c, command, flag, data); } static void on_8E_DCNTE(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { if (c->flags & Client::Flag::IS_TRIAL_EDITION) { on_A0(s, c, command, flag, data); } else { @@ -2223,7 +2223,7 @@ static void on_8E_DCNTE(shared_ptr s, shared_ptr c, } static void on_8F_DCNTE(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { if (c->flags & Client::Flag::IS_TRIAL_EDITION) { on_A1(s, c, command, flag, data); } else { @@ -2232,7 +2232,7 @@ static void on_8F_DCNTE(shared_ptr s, shared_ptr c, } static void send_dol_file_chunk(shared_ptr s, shared_ptr c, - uint32_t start_addr) { + uint32_t start_addr) { size_t offset = start_addr - c->dol_base_addr; if (offset >= c->loading_dol_file->data.size()) { throw logic_error("DOL file offset beyond end of data"); @@ -2247,12 +2247,12 @@ static void send_dol_file_chunk(shared_ptr s, shared_ptr c, size_t progress_percent = ((offset + bytes_to_send) * 100) / c->loading_dol_file->data.size(); string info = string_printf("Loading $C6%s$C7\n%zu%%%% complete", - c->loading_dol_file->name.c_str(), progress_percent); + c->loading_dol_file->name.c_str(), progress_percent); send_ship_info(c, decode_sjis(info)); } static void on_B3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string& data) { + uint16_t, uint32_t flag, const string& data) { const auto& cmd = check_size_t(data); if (flag == 0) { return; @@ -2280,7 +2280,7 @@ static void on_B3(shared_ptr s, shared_ptr c, } static void on_A2(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string& data) { + uint16_t, uint32_t flag, const string& data) { check_size_v(data.size(), 0); if (!s->quest_index) { @@ -2327,7 +2327,7 @@ static void on_A2(shared_ptr s, shared_ptr c, } static void on_AC_V3_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); // If this client is NOT loading, they should not send an AC. Sending an AC to @@ -2369,7 +2369,7 @@ static void on_AC_V3_BB(shared_ptr s, shared_ptr c, } static void on_AA(shared_ptr s, - shared_ptr c, uint16_t, uint32_t, const string& data) { + shared_ptr c, uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (c->flags & Client::Flag::IS_TRIAL_EDITION) { @@ -2391,7 +2391,7 @@ static void on_AA(shared_ptr s, } static void on_D7_GC(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { string filename(data); strip_trailing_zeroes(filename); @@ -2425,25 +2425,25 @@ static void send_file_chunk( } static void on_44_A6_V3_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { const auto& cmd = check_size_t(data); send_file_chunk(c, cmd.filename, 0, (command == 0xA6)); } static void on_13_A7_V3_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { const auto& cmd = check_size_t(data); send_file_chunk(c, cmd.filename, flag + 1, (command == 0xA7)); } static void on_61_98(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { switch (c->version()) { case GameVersion::DC: case GameVersion::PC: { const auto& pd = check_size_t(data, - sizeof(PSOPlayerDataDCPC), 0xFFFF); + sizeof(PSOPlayerDataDCPC), 0xFFFF); c->game_data.import_player(pd); break; } @@ -2459,14 +2459,14 @@ static void on_61_98(shared_ptr s, shared_ptr c, pd = reinterpret_cast(pd3); } else { pd = &check_size_t(data, sizeof(PSOPlayerDataV3), - sizeof(PSOPlayerDataV3) + c->game_data.player()->auto_reply.bytes()); + sizeof(PSOPlayerDataV3) + c->game_data.player()->auto_reply.bytes()); } c->game_data.import_player(*pd); break; } case GameVersion::BB: { const auto& pd = check_size_t(data, sizeof(PSOPlayerDataBB), - sizeof(PSOPlayerDataBB) + c->game_data.player()->auto_reply.bytes()); + sizeof(PSOPlayerDataBB) + c->game_data.player()->auto_reply.bytes()); c->game_data.import_player(pd); break; } @@ -2478,7 +2478,7 @@ static void on_61_98(shared_ptr s, shared_ptr c, if (player) { string name_str = remove_language_marker(encode_sjis(player->disp.name)); c->channel.name = string_printf("C-%" PRIX64 " (%s)", - c->id, name_str.c_str()); + c->id, name_str.c_str()); } // 98 should only be sent when leaving a game, and we should leave the client @@ -2505,9 +2505,9 @@ static void on_61_98(shared_ptr s, shared_ptr c, if (!failure) { send_text_message_printf(c, - "$C6BB player data saved\nas player %hhu for user\n%s", - static_cast(c->pending_bb_save_player_index + 1), - c->pending_bb_save_username.c_str()); + "$C6BB player data saved\nas player %hhu for user\n%s", + static_cast(c->pending_bb_save_player_index + 1), + c->pending_bb_save_username.c_str()); } c->game_data.bb_username = prev_bb_username; @@ -2525,7 +2525,7 @@ static void on_61_98(shared_ptr s, shared_ptr c, } static void on_6x_C9_CB(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { check_size_v(data.size(), 4, 0xFFFF); auto l = s->find_lobby(c->lobby_id); @@ -2537,7 +2537,7 @@ static void on_6x_C9_CB(shared_ptr s, shared_ptr c, } static void on_chat_generic(shared_ptr s, shared_ptr c, - const u16string& text) { + const u16string& text) { if (text.empty()) { return; @@ -2578,8 +2578,8 @@ static void on_chat_generic(shared_ptr s, shared_ptr c, continue; } send_chat_message(l->clients[x], c->license->serial_number, - c->game_data.player()->disp.name.data(), processed_text.c_str(), - private_flags); + c->game_data.player()->disp.name.data(), processed_text.c_str(), + private_flags); } if (l->battle_record && l->battle_record->battle_in_progress()) { @@ -2592,7 +2592,7 @@ static void on_chat_generic(shared_ptr s, shared_ptr c, } static void on_06_PC_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data, sizeof(C_Chat_06), 0xFFFF); u16string text(cmd.text.pcbb, (data.size() - sizeof(C_Chat_06)) / sizeof(char16_t)); strip_trailing_zeroes(text); @@ -2600,14 +2600,14 @@ static void on_06_PC_BB(shared_ptr s, shared_ptr c, } static void on_06_DC_V3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data, sizeof(C_Chat_06), 0xFFFF); u16string decoded_s = decode_sjis(cmd.text.dcv3, data.size() - sizeof(C_Chat_06)); on_chat_generic(s, c, decoded_s); } static void on_00E0_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); send_team_and_key_config_bb(c); c->game_data.account()->newserv_flags &= ~AccountFlag::IN_DRESSING_ROOM; @@ -2615,7 +2615,7 @@ static void on_00E0_BB(shared_ptr, shared_ptr c, } static void on_00E3_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (c->bb_game_state == ClientStateBB::CHOOSE_PLAYER) { @@ -2646,7 +2646,7 @@ static void on_00E3_BB(shared_ptr, shared_ptr c, } static void on_00E8_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { constexpr size_t max_count = sizeof(GuildCardFileBB::entries) / sizeof(GuildCardEntryBB); constexpr size_t max_blocked = sizeof(GuildCardFileBB::blocked) / sizeof(GuildCardBB); switch (command) { @@ -2654,7 +2654,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, const auto& cmd = check_size_t(data); uint32_t checksum = c->game_data.account()->guild_cards.checksum(); c->log.info("(Guild card file) Server checksum = %08" PRIX32 ", client checksum = %08" PRIX32, - checksum, cmd.checksum.load()); + checksum, cmd.checksum.load()); S_GuildCardChecksumResponse_BB_02E8 response = { (cmd.checksum != checksum), 0}; send_command_t(c, 0x02E8, 0x00000000, response); @@ -2672,7 +2672,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, gcf.entries[z].data = new_gc; gcf.entries[z].unknown_a1.clear(0); c->log.info("Added guild card %" PRIu32 " at position %zu", - new_gc.guild_card_number.load(), z); + new_gc.guild_card_number.load(), z); break; } } @@ -2684,7 +2684,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, for (size_t z = 0; z < max_count; z++) { if (gcf.entries[z].data.guild_card_number == cmd.guild_card_number) { c->log.info("Deleted guild card %" PRIu32 " at position %zu", - cmd.guild_card_number.load(), z); + cmd.guild_card_number.load(), z); for (z = 0; z < max_count - 1; z++) { gcf.entries[z] = gcf.entries[z + 1]; } @@ -2701,7 +2701,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, if (gcf.entries[z].data.guild_card_number == new_gc.guild_card_number) { gcf.entries[z].data = new_gc; c->log.info("Updated guild card %" PRIu32 " at position %zu", - new_gc.guild_card_number.load(), z); + new_gc.guild_card_number.load(), z); } } break; @@ -2713,7 +2713,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, if (!gcf.blocked[z].present) { gcf.blocked[z] = new_gc; c->log.info("Added blocked guild card %" PRIu32 " at position %zu", - new_gc.guild_card_number.load(), z); + new_gc.guild_card_number.load(), z); // Note: The client also sends a C6 command, so we don't have to // manually sync the actual blocked senders list here break; @@ -2727,7 +2727,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, for (size_t z = 0; z < max_blocked; z++) { if (gcf.blocked[z].guild_card_number == cmd.guild_card_number) { c->log.info("Deleted blocked guild card %" PRIu32 " at position %zu", - cmd.guild_card_number.load(), z); + cmd.guild_card_number.load(), z); for (z = 0; z < max_blocked - 1; z++) { gcf.blocked[z] = gcf.blocked[z + 1]; } @@ -2746,7 +2746,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, if (gcf.entries[z].data.guild_card_number == cmd.guild_card_number) { gcf.entries[z].comment = cmd.comment; c->log.info("Updated comment on guild card %" PRIu32 " at position %zu", - cmd.guild_card_number.load(), z); + cmd.guild_card_number.load(), z); break; } } @@ -2776,7 +2776,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, } gcf.entries[index] = moved_gc; c->log.info("Moved guild card %" PRIu32 " to position %zu", - cmd.guild_card_number.load(), index); + cmd.guild_card_number.load(), index); break; } default: @@ -2785,7 +2785,7 @@ static void on_00E8_BB(shared_ptr, shared_ptr c, } static void on_DC_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (cmd.cont) { send_guild_card_chunk_bb(c, cmd.chunk_index); @@ -2793,7 +2793,7 @@ static void on_DC_BB(shared_ptr, shared_ptr c, } static void on_xxEB_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { check_size_v(data.size(), 0); if (command == 0x04EB) { @@ -2806,7 +2806,7 @@ static void on_xxEB_BB(shared_ptr, shared_ptr c, } static void on_00EC_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (cmd.reason == 2) { c->game_data.account()->newserv_flags |= AccountFlag::IN_DRESSING_ROOM; @@ -2818,7 +2818,7 @@ static void on_00EC_BB(shared_ptr, shared_ptr c, } static void on_00E5_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); if (!c->license) { @@ -2868,7 +2868,7 @@ static void on_00E5_BB(shared_ptr s, shared_ptr c, } static void on_xxED_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { const auto* cmd = reinterpret_cast(data.data()); switch (command) { @@ -2906,7 +2906,7 @@ static void on_xxED_BB(shared_ptr, shared_ptr c, } static void on_00E7_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); // We only trust the player's quest data and challenge data. @@ -2916,16 +2916,16 @@ static void on_00E7_BB(shared_ptr, shared_ptr c, } static void on_00E2_BB(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { // Some clients have only a uint32_t at the end for team rewards auto& cmd = check_size_t(data, - sizeof(KeyAndTeamConfigBB) - 4, sizeof(KeyAndTeamConfigBB)); + sizeof(KeyAndTeamConfigBB) - 4, sizeof(KeyAndTeamConfigBB)); c->game_data.account()->key_config = cmd; // TODO: We should probably send a response here, but I don't know which one! } static void on_89(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string& data) { + uint16_t, uint32_t flag, const string& data) { check_size_v(data.size(), 0); c->lobby_arrow_color = flag; @@ -2936,7 +2936,7 @@ static void on_89(shared_ptr s, shared_ptr c, } static void on_40(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); try { auto result = s->find_client(nullptr, cmd.target_guild_card_number); @@ -2947,13 +2947,13 @@ static void on_40(shared_ptr s, shared_ptr c, } static void on_C0(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string&) { + uint16_t, uint32_t, const string&) { // TODO: Implement choice search. send_text_message(c, u"$C6Choice Search is\nnot supported"); } static void on_81(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { u16string message; uint32_t to_guild_card_number; switch (c->version()) { @@ -3005,8 +3005,8 @@ static void on_81(shared_ptr s, shared_ptr c, // forward the message in this case. if (!target->game_data.player()->auto_reply.empty()) { send_simple_mail(c, target->license->serial_number, - target->game_data.player()->disp.name, - target->game_data.player()->auto_reply); + target->game_data.player()->disp.name, + target->game_data.player()->auto_reply); } // Forward the message @@ -3019,14 +3019,14 @@ static void on_81(shared_ptr s, shared_ptr c, } static void on_D8(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); send_info_board(c, s->find_lobby(c->lobby_id)); } template void on_D9_t(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0, c->game_data.player()->info_board.size() * sizeof(CharT)); c->game_data.player()->info_board.assign( reinterpret_cast(data.data()), @@ -3034,17 +3034,17 @@ void on_D9_t(shared_ptr, shared_ptr c, } void on_D9_a(shared_ptr s, shared_ptr c, - uint16_t cmd, uint32_t flag, const string& data) { + uint16_t cmd, uint32_t flag, const string& data) { on_D9_t(s, c, cmd, flag, data); } void on_D9_w(shared_ptr s, shared_ptr c, - uint16_t cmd, uint32_t flag, const string& data) { + uint16_t cmd, uint32_t flag, const string& data) { on_D9_t(s, c, cmd, flag, data); } template void on_C7_t(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0, c->game_data.player()->auto_reply.size() * sizeof(CharT)); c->game_data.player()->auto_reply.assign( reinterpret_cast(data.data()), @@ -3052,22 +3052,22 @@ void on_C7_t(shared_ptr, shared_ptr c, } void on_C7_a(shared_ptr s, shared_ptr c, - uint16_t cmd, uint32_t flag, const string& data) { + uint16_t cmd, uint32_t flag, const string& data) { on_C7_t(s, c, cmd, flag, data); } void on_C7_w(shared_ptr s, shared_ptr c, - uint16_t cmd, uint32_t flag, const string& data) { + uint16_t cmd, uint32_t flag, const string& data) { on_C7_t(s, c, cmd, flag, data); } static void on_C8(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); c->game_data.player()->auto_reply.clear(0); } static void on_C6(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { if (c->version() == GameVersion::BB) { const auto& cmd = check_size_t(data); c->game_data.account()->blocked_senders = cmd.blocked_senders; @@ -3150,13 +3150,13 @@ shared_ptr create_game_generic( shared_ptr game = s->create_lobby(); game->name = name; game->flags = flags | - Lobby::Flag::GAME | - (item_tracking_enabled ? Lobby::Flag::ITEM_TRACKING_ENABLED : 0); + Lobby::Flag::GAME | + (item_tracking_enabled ? Lobby::Flag::ITEM_TRACKING_ENABLED : 0); game->password = password; game->version = c->version(); game->section_id = c->options.override_section_id >= 0 - ? c->options.override_section_id - : c->game_data.player()->disp.section_id; + ? c->options.override_section_id + : c->game_data.player()->disp.section_id; game->episode = episode; game->mode = mode; game->difficulty = difficulty; @@ -3210,7 +3210,7 @@ shared_ptr create_game_generic( for (size_t area = 0; area < 0x10; area++) { c->log.info("[Map/%zu] Using variations %" PRIX32 ", %" PRIX32, - area, game->variations[area * 2].load(), game->variations[area * 2 + 1].load()); + area, game->variations[area * 2].load(), game->variations[area * 2 + 1].load()); auto filenames = map_filenames_for_variation( game->episode, is_solo, @@ -3238,7 +3238,7 @@ shared_ptr create_game_generic( area_enemies.begin(), area_enemies.end()); c->log.info("[Map/%zu] Loaded %s (%zu entries)", - area, filename.c_str(), area_enemies.size()); + area, filename.c_str(), area_enemies.size()); for (size_t z = 0; z < area_enemies.size(); z++) { string e_str = area_enemies[z].str(); static_game_data_log.info("(Entry %zX) %s", z, e_str.c_str()); @@ -3260,7 +3260,7 @@ shared_ptr create_game_generic( } static void on_C1_PC(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); uint32_t flags = Lobby::Flag::NON_V1_ONLY; @@ -3279,7 +3279,7 @@ static void on_C1_PC(shared_ptr s, shared_ptr c, } static void on_0C_C1_E7_EC(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t, const string& data) { + uint16_t command, uint32_t, const string& data) { const auto& cmd = check_size_t(data); // Only allow E7/EC from Ep3 clients @@ -3341,7 +3341,7 @@ static void on_0C_C1_E7_EC(shared_ptr s, shared_ptr c, } static void on_C1_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); uint32_t flags = Lobby::Flag::NON_V1_ONLY; @@ -3380,7 +3380,7 @@ static void on_C1_BB(shared_ptr s, shared_ptr c, } static void on_8A(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { if ((c->version() == GameVersion::DC) && (c->flags & Client::Flag::IS_TRIAL_EDITION)) { const auto& cmd = check_size_t(data); set_console_client_flags(c, cmd.sub_version); @@ -3397,7 +3397,7 @@ static void on_8A(shared_ptr s, shared_ptr c, } static void on_6F(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); auto l = s->find_lobby(c->lobby_id); @@ -3429,7 +3429,7 @@ static void on_6F(shared_ptr s, shared_ptr c, } static void on_D0_V3_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { auto& cmd = check_size_t(data); if (c->game_data.pending_item_trade) { @@ -3469,7 +3469,7 @@ static void on_D0_V3_BB(shared_ptr s, shared_ptr c, } static void on_D2_V3_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); if (!c->game_data.pending_item_trade) { @@ -3500,7 +3500,7 @@ static void on_D2_V3_BB(shared_ptr s, shared_ptr c, } static void on_D4_V3_BB(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); // Annoyingly, if the other client disconnects at a certain point during the @@ -3531,7 +3531,7 @@ static void on_D4_V3_BB(shared_ptr s, shared_ptr c, } static void on_EE_Ep3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t flag, const string& data) { + uint16_t, uint32_t flag, const string& data) { if (!(c->flags & Client::Flag::IS_EPISODE_3)) { throw runtime_error("non-Ep3 client sent card trade command"); } @@ -3634,7 +3634,7 @@ static void on_EE_Ep3(shared_ptr s, shared_ptr c, } static void on_EF_Ep3(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); if (!(c->flags & Client::Flag::IS_EPISODE_3)) { @@ -3656,7 +3656,7 @@ static void on_EF_Ep3(shared_ptr s, shared_ptr c, } static void on_xxEA_BB(shared_ptr, shared_ptr c, - uint16_t command, uint32_t, const string&) { + uint16_t command, uint32_t, const string&) { // TODO: Implement teams. This command has a very large number of subcommands // (up to 20EA!). @@ -3670,7 +3670,7 @@ static void on_xxEA_BB(shared_ptr, shared_ptr c, } static void on_02_P(shared_ptr, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { check_size_v(data.size(), 0); send_command(c, 0x04, 0x00); // This requests the user's login information } @@ -3681,7 +3681,7 @@ static void change_to_directory_patch( const vector& file_path_directories) { // First, exit all leaf directories that don't match the desired path while (!client_path_directories.empty() && - ((client_path_directories.size() > file_path_directories.size()) || + ((client_path_directories.size() > file_path_directories.size()) || (client_path_directories.back() != file_path_directories[client_path_directories.size() - 1]))) { send_command(c, 0x0A, 0x00); client_path_directories.pop_back(); @@ -3707,7 +3707,7 @@ static void change_to_directory_patch( } static void on_04_P(shared_ptr s, shared_ptr c, - uint16_t, uint32_t, const string& data) { + uint16_t, uint32_t, const string& data) { const auto& cmd = check_size_t(data); try { @@ -3737,8 +3737,8 @@ static void on_04_P(shared_ptr s, shared_ptr c, // On BB we can use colors and newlines should be \n; on PC we can't use // colors, the text is auto-word-wrapped, and newlines should be \r\n. const u16string& message = (c->flags & Client::Flag::IS_BB_PATCH) - ? s->bb_patch_server_message - : s->pc_patch_server_message; + ? s->bb_patch_server_message + : s->pc_patch_server_message; if (!message.empty()) { send_message_box(c, message.c_str()); } @@ -3774,7 +3774,7 @@ static void on_04_P(shared_ptr s, shared_ptr c, } static void on_0F_P(shared_ptr, - shared_ptr c, uint16_t, uint32_t, const string& data) { + shared_ptr c, uint16_t, uint32_t, const string& data) { auto& cmd = check_size_t(data); auto& req = c->patch_file_checksum_requests.at(cmd.request_id); req.crc32 = cmd.checksum; @@ -3783,7 +3783,7 @@ static void on_0F_P(shared_ptr, } static void on_10_P(shared_ptr, - shared_ptr c, uint16_t, uint32_t, const string&) { + shared_ptr c, uint16_t, uint32_t, const string&) { S_StartFileDownloads_Patch_11 start_cmd = {0, 0}; for (const auto& req : c->patch_file_checksum_requests) { @@ -3792,7 +3792,7 @@ static void on_10_P(shared_ptr, } if (req.needs_update()) { c->log.info("File %s needs update (CRC: %08" PRIX32 "/%08" PRIX32 ", size: %" PRIu32 "/%" PRIu32 ")", - req.file->name.c_str(), req.file->crc32, req.crc32, req.file->size, req.size); + req.file->name.c_str(), req.file->crc32, req.crc32, req.file->size, req.size); start_cmd.total_bytes += req.file->size; start_cmd.num_files++; } else { @@ -3816,17 +3816,17 @@ static void on_10_P(shared_ptr, } static void on_ignored(shared_ptr, shared_ptr, - uint16_t, uint32_t, const string&) {} + uint16_t, uint32_t, const string&) {} static void on_unimplemented_command(shared_ptr, - shared_ptr c, uint16_t command, uint32_t flag, const string& data) { + shared_ptr c, uint16_t command, uint32_t flag, const string& data) { c->log.warning("Unknown command: size=%04zX command=%04hX flag=%08" PRIX32, - data.size(), command, flag); + data.size(), command, flag); throw invalid_argument("unimplemented command"); } typedef void (*on_command_t)(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data); + uint16_t command, uint32_t flag, const string& data); // Command handler table, indexed by command number and game version. Null // entries in this table cause on_unimplemented_command to be called, which @@ -4143,7 +4143,7 @@ static void check_unlicensed_command(GameVersion version, uint8_t command) { } void on_command(shared_ptr s, shared_ptr c, - uint16_t command, uint32_t flag, const string& data) { + uint16_t command, uint32_t flag, const string& data) { string encoded_name; auto player = c->game_data.player(false); if (player) { @@ -4167,26 +4167,26 @@ void on_command(shared_ptr s, shared_ptr c, } void on_command_with_header(shared_ptr s, shared_ptr c, - string& data) { + string& data) { switch (c->version()) { case GameVersion::DC: case GameVersion::GC: case GameVersion::XB: { auto& header = check_size_t(data, - sizeof(PSOCommandHeaderDCV3), 0xFFFF); + sizeof(PSOCommandHeaderDCV3), 0xFFFF); on_command(s, c, header.command, header.flag, data.substr(sizeof(header))); break; } case GameVersion::PC: case GameVersion::PATCH: { auto& header = check_size_t(data, - sizeof(PSOCommandHeaderPC), 0xFFFF); + sizeof(PSOCommandHeaderPC), 0xFFFF); on_command(s, c, header.command, header.flag, data.substr(sizeof(header))); break; } case GameVersion::BB: { auto& header = check_size_t(data, - sizeof(PSOCommandHeaderBB), 0xFFFF); + sizeof(PSOCommandHeaderBB), 0xFFFF); on_command(s, c, header.command, header.flag, data.substr(sizeof(header))); break; } diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index b0a1113f..90c1df80 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -65,7 +65,7 @@ static const unordered_set watcher_subcommands({ }); static void forward_subcommand(shared_ptr l, shared_ptr c, - uint8_t command, uint8_t flag, const void* data, size_t size) { + uint8_t command, uint8_t flag, const void* data, size_t size) { // if the command is an Ep3-only command, make sure an Ep3 client sent it bool command_is_ep3 = (command & 0xF0) == 0xC0; @@ -103,8 +103,8 @@ static void forward_subcommand(shared_ptr l, shared_ptr c, // battle, forward everything to watcher lobbies. if (size && (watcher_subcommands.count(*reinterpret_cast(data) || - (l->ep3_server_base && - l->ep3_server_base->server->setup_phase != Episode3::SetupPhase::REGISTRATION)))) { + (l->ep3_server_base && + l->ep3_server_base->server->setup_phase != Episode3::SetupPhase::REGISTRATION)))) { for (const auto& watcher_lobby : l->watcher_lobbies) { forward_subcommand(watcher_lobby, c, command, flag, data, size); } @@ -112,39 +112,39 @@ static void forward_subcommand(shared_ptr l, shared_ptr c, if (l->battle_record && l->battle_record->battle_in_progress()) { auto type = ((command & 0xF0) == 0xC0) - ? Episode3::BattleRecord::Event::Type::EP3_GAME_COMMAND - : Episode3::BattleRecord::Event::Type::GAME_COMMAND; + ? Episode3::BattleRecord::Event::Type::EP3_GAME_COMMAND + : Episode3::BattleRecord::Event::Type::GAME_COMMAND; l->battle_record->add_command(type, data, size); } } } static void forward_subcommand(shared_ptr l, shared_ptr c, - uint8_t command, uint8_t flag, const string& data) { + uint8_t command, uint8_t flag, const string& data) { forward_subcommand(l, c, command, flag, data.data(), data.size()); } static void on_invalid(shared_ptr, - shared_ptr, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc( data, sizeof(G_UnusedHeader), 0xFFFF); if (command_is_private(command)) { c->log.error("Invalid subcommand: %02hhX (private to %hhu)", - cmd.subcommand, flag); + cmd.subcommand, flag); } else { c->log.error("Invalid subcommand: %02hhX (public)", cmd.subcommand); } } static void on_unimplemented(shared_ptr, - shared_ptr, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc( data, sizeof(G_UnusedHeader), 0xFFFF); if (command_is_private(command)) { c->log.warning("Unknown subcommand: %02hhX (private to %hhu)", - cmd.subcommand, flag); + cmd.subcommand, flag); } else { c->log.warning("Unknown subcommand: %02hhX (public)", cmd.subcommand); } @@ -154,15 +154,15 @@ static void on_unimplemented(shared_ptr, } static void on_forward_check_size(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { check_size_sc(data, sizeof(G_UnusedHeader), 0xFFFF); forward_subcommand(l, c, command, flag, data); } static void on_forward_check_game(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (!l->is_game()) { return; } @@ -170,8 +170,8 @@ static void on_forward_check_game(shared_ptr, } static void on_forward_check_game_loading(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (!l->is_game() || !l->any_client_loading()) { return; } @@ -179,8 +179,8 @@ static void on_forward_check_game_loading(shared_ptr, } static void on_forward_check_size_client(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc( data, sizeof(G_ClientIDHeader), 0xFFFF); if (cmd.client_id != c->lobby_client_id) { @@ -190,8 +190,8 @@ static void on_forward_check_size_client(shared_ptr, } static void on_forward_check_size_game(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { check_size_sc(data, sizeof(G_UnusedHeader), 0xFFFF); if (!l->is_game()) { return; @@ -200,8 +200,8 @@ static void on_forward_check_size_game(shared_ptr, } static void on_forward_check_size_ep3_lobby(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { check_size_sc(data, sizeof(G_UnusedHeader), 0xFFFF); if (l->is_game() || !l->is_ep3()) { return; @@ -210,8 +210,8 @@ static void on_forward_check_size_ep3_lobby(shared_ptr, } static void on_forward_check_size_ep3_game(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { check_size_sc(data, sizeof(G_UnusedHeader), 0xFFFF); if (!l->is_game() || !l->is_ep3()) { return; @@ -223,8 +223,8 @@ static void on_forward_check_size_ep3_game(shared_ptr, // Ep3 subcommands static void on_ep3_battle_subs(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& orig_data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& orig_data) { const auto& header = check_size_sc( orig_data, sizeof(G_CardBattleCommandHeader), 0xFFFF); if (!l->is_game() || !l->is_ep3()) { @@ -260,8 +260,8 @@ static void on_ep3_battle_subs(shared_ptr s, // Chat commands and the like static void on_send_guild_card(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (!command_is_private(command) || !l || (flag >= l->max_clients) || (!l->clients[flag])) { return; @@ -297,8 +297,8 @@ static void on_send_guild_card(shared_ptr, // client sends a symbol chat static void on_symbol_chat(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!c->can_chat || (cmd.client_id != c->lobby_client_id)) { @@ -309,8 +309,8 @@ static void on_symbol_chat(shared_ptr, // client sends a word select chat static void on_word_select(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!c->can_chat || (cmd.header.client_id != c->lobby_client_id)) { @@ -322,8 +322,8 @@ static void on_word_select(shared_ptr, // client is done loading into a lobby (we use this to trigger arrow updates) static void on_set_player_visibility(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (cmd.header.client_id != c->lobby_client_id) { @@ -341,8 +341,8 @@ static void on_set_player_visibility(shared_ptr, // Game commands used by cheat mechanisms static void on_change_area(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!l->is_game()) { return; @@ -353,8 +353,8 @@ static void on_change_area(shared_ptr, // when a player is hit by an enemy, heal them if infinite HP is enabled static void on_hit_by_enemy(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, sizeof(G_ClientIDHeader), 0xFFFF); if (!l->is_game() || (cmd.client_id != c->lobby_client_id)) { return; @@ -367,8 +367,8 @@ static void on_hit_by_enemy(shared_ptr, // when a player casts a tech, restore TP if infinite TP is enabled static void on_cast_technique_finished(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!l->is_game() || (cmd.header.client_id != c->lobby_client_id)) { return; @@ -380,10 +380,10 @@ static void on_cast_technique_finished(shared_ptr, } static void on_attack_finished(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - offsetof(G_AttackFinished_6x46, entries), sizeof(G_AttackFinished_6x46)); + offsetof(G_AttackFinished_6x46, entries), sizeof(G_AttackFinished_6x46)); size_t allowed_count = min(cmd.header.size - 2, 11); if (cmd.count > allowed_count) { throw runtime_error("invalid attack finished command"); @@ -392,10 +392,10 @@ static void on_attack_finished(shared_ptr s, } static void on_cast_technique(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - offsetof(G_CastTechnique_6x47, targets), sizeof(G_CastTechnique_6x47)); + offsetof(G_CastTechnique_6x47, targets), sizeof(G_CastTechnique_6x47)); size_t allowed_count = min(cmd.header.size - 2, 10); if (cmd.target_count > allowed_count) { throw runtime_error("invalid cast technique command"); @@ -404,10 +404,10 @@ static void on_cast_technique(shared_ptr s, } static void on_subtract_pb_energy(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - offsetof(G_SubtractPBEnergy_6x49, entries), sizeof(G_SubtractPBEnergy_6x49)); + offsetof(G_SubtractPBEnergy_6x49, entries), sizeof(G_SubtractPBEnergy_6x49)); size_t allowed_count = min(cmd.header.size - 3, 14); if (cmd.entry_count > allowed_count) { throw runtime_error("invalid subtract PB energy command"); @@ -416,8 +416,8 @@ static void on_subtract_pb_energy(shared_ptr s, } static void on_switch_state_changed(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { auto& cmd = check_size_t(data); if (!l->is_game()) { return; @@ -431,7 +431,7 @@ static void on_switch_state_changed(shared_ptr, send_text_message(c, u"$C5Switch assist"); } forward_subcommand(l, c, command, flag, &c->last_switch_enabled_command, - sizeof(c->last_switch_enabled_command)); + sizeof(c->last_switch_enabled_command)); send_command_t(c, command, flag, c->last_switch_enabled_command); } c->last_switch_enabled_command = cmd; @@ -442,8 +442,8 @@ static void on_switch_state_changed(shared_ptr, template void on_movement(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (cmd.header.client_id != c->lobby_client_id) { @@ -460,8 +460,8 @@ void on_movement(shared_ptr, // Item commands static void on_player_drop_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if ((cmd.header.client_id != c->lobby_client_id)) { @@ -474,12 +474,12 @@ static void on_player_drop_item(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu dropped item %08" PRIX32 " (%s) at %hu:(%g, %g)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str(), - cmd.area.load(), cmd.x.load(), cmd.z.load()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str(), + cmd.area.load(), cmd.x.load(), cmd.z.load()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: drop %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); } @@ -488,10 +488,10 @@ static void on_player_drop_item(shared_ptr, } static void on_create_inventory_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - sizeof(G_CreateInventoryItem_DC_6x2B), sizeof(G_CreateInventoryItem_PC_V3_BB_6x2B)); + sizeof(G_CreateInventoryItem_DC_6x2B), sizeof(G_CreateInventoryItem_PC_V3_BB_6x2B)); if ((cmd.header.client_id != c->lobby_client_id)) { return; @@ -511,11 +511,11 @@ static void on_create_inventory_item(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu created inventory item %08" PRIX32 " (%s)", - cmd.header.client_id.load(), cmd.item.id.load(), name.c_str()); + cmd.header.client_id.load(), cmd.item.id.load(), name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: create %08" PRIX32 "\n%s", - cmd.item.id.load(), name.c_str()); + cmd.item.id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); } @@ -524,10 +524,10 @@ static void on_create_inventory_item(shared_ptr, } static void on_drop_partial_stack(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - sizeof(G_DropStackedItem_DC_6x5D), sizeof(G_DropStackedItem_PC_V3_BB_6x5D)); + sizeof(G_DropStackedItem_DC_6x5D), sizeof(G_DropStackedItem_PC_V3_BB_6x5D)); // TODO: Should we check the client ID here too? if (!l->is_game()) { @@ -548,12 +548,12 @@ static void on_drop_partial_stack(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu split stack to create ground item %08" PRIX32 " (%s) at %hu:(%g, %g)", - cmd.header.client_id.load(), item.data.id.load(), name.c_str(), - cmd.area.load(), cmd.x.load(), cmd.z.load()); + cmd.header.client_id.load(), item.data.id.load(), name.c_str(), + cmd.area.load(), cmd.x.load(), cmd.z.load()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: split %08" PRIX32 "\n%s", - item.data.id.load(), name.c_str()); + item.data.id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); } @@ -562,8 +562,8 @@ static void on_drop_partial_stack(shared_ptr, } static void on_drop_partial_stack_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -593,12 +593,12 @@ static void on_drop_partial_stack_bb(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu split stack %08" PRIX32 " (removed: %s) at %hu:(%g, %g)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str(), - cmd.area.load(), cmd.x.load(), cmd.z.load()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str(), + cmd.area.load(), cmd.x.load(), cmd.z.load()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: split/BB %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); @@ -610,8 +610,8 @@ static void on_drop_partial_stack_bb(shared_ptr, } static void on_buy_shop_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!l->is_game() || (cmd.header.client_id != c->lobby_client_id)) { @@ -630,11 +630,11 @@ static void on_buy_shop_item(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu bought item %08" PRIX32 " (%s) from shop", - cmd.header.client_id.load(), item.data.id.load(), name.c_str()); + cmd.header.client_id.load(), item.data.id.load(), name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: buy %08" PRIX32 "\n%s", - item.data.id.load(), name.c_str()); + item.data.id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); } @@ -643,10 +643,10 @@ static void on_buy_shop_item(shared_ptr, } static void on_box_or_enemy_item_drop(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data, - sizeof(G_DropItem_DC_6x5F), sizeof(G_DropItem_PC_V3_BB_6x5F)); + sizeof(G_DropItem_DC_6x5F), sizeof(G_DropItem_PC_V3_BB_6x5F)); if (!l->is_game() || (c->lobby_client_id != l->leader_id)) { return; @@ -664,11 +664,11 @@ static void on_box_or_enemy_item_drop(shared_ptr, auto name = item.data.name(false); l->log.info("Leader created ground item %08" PRIX32 " (%s) at %hhu:(%g, %g)", - item.data.id.load(), name.c_str(), cmd.area, cmd.x.load(), cmd.z.load()); + item.data.id.load(), name.c_str(), cmd.area, cmd.x.load(), cmd.z.load()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: drop %08" PRIX32 "\n%s", - item.data.id.load(), name.c_str()); + item.data.id.load(), name.c_str()); } } @@ -676,8 +676,8 @@ static void on_box_or_enemy_item_drop(shared_ptr, } static void on_pick_up_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { auto& cmd = check_size_sc(data); if (!l->is_game()) { @@ -699,11 +699,11 @@ static void on_pick_up_item(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu picked up %08" PRIX32 " (%s)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: pick %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } effective_c->game_data.player()->print_inventory(stderr); } @@ -712,8 +712,8 @@ static void on_pick_up_item(shared_ptr, } static void on_pick_up_item_request(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { // This is handled by the server on BB, and by the leader on other versions if (l->version == GameVersion::BB) { auto& cmd = check_size_sc(data); @@ -731,11 +731,11 @@ static void on_pick_up_item_request(shared_ptr, auto name = item.data.name(false); l->log.info("Player %hu picked up %08" PRIX32 " (%s)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: pick/BB %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); @@ -747,8 +747,8 @@ static void on_pick_up_item_request(shared_ptr, } static void on_equip_unequip_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (cmd.header.client_id != c->lobby_client_id) { @@ -772,8 +772,8 @@ static void on_equip_unequip_item(shared_ptr, } static void on_use_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (cmd.header.client_id != c->lobby_client_id) { @@ -793,10 +793,10 @@ static void on_use_item(shared_ptr, player_use_item(c, index); l->log.info("Player used item %hu:%08" PRIX32 " (%s)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); if (c->options.debug) { send_text_message_printf(c, "$C5Items: use %08" PRIX32 "\n%s", - cmd.item_id.load(), colored_name.c_str()); + cmd.item_id.load(), colored_name.c_str()); } c->game_data.player()->print_inventory(stderr); } @@ -805,8 +805,8 @@ static void on_use_item(shared_ptr, } static void on_open_shop_bb_or_ep3_battle_subs(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (l->is_ep3()) { on_ep3_battle_subs(s, l, c, command, flag, data); @@ -845,7 +845,7 @@ static void on_open_shop_bb_or_ep3_battle_subs(shared_ptr s, } static void on_open_bank_bb_or_card_trade_counter_ep3(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, const string& data) { if ((l->version == GameVersion::BB) && l->is_game()) { send_bank(c); } else if ((l->version == GameVersion::GC) && l->is_ep3()) { @@ -854,7 +854,7 @@ static void on_open_bank_bb_or_card_trade_counter_ep3(shared_ptr, } static void on_bank_action_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string& data) { + shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -904,8 +904,8 @@ static void on_bank_action_bb(shared_ptr, } static void on_sort_inventory_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t, uint8_t, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t, uint8_t, + const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -974,23 +974,23 @@ static bool drop_item( } static void on_enemy_drop_item_request(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (!l->is_game()) { return; } const auto& cmd = check_size_sc(data, - sizeof(G_EnemyDropItemRequest_DC_6x60), - sizeof(G_EnemyDropItemRequest_PC_V3_BB_6x60)); + sizeof(G_EnemyDropItemRequest_DC_6x60), + sizeof(G_EnemyDropItemRequest_PC_V3_BB_6x60)); if (!drop_item(l, cmd.enemy_id, cmd.area, cmd.x, cmd.z, cmd.enemy_id)) { forward_subcommand(l, c, command, flag, data); } } static void on_box_drop_item_request(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (!l->is_game()) { return; } @@ -1002,8 +1002,8 @@ static void on_box_drop_item_request(shared_ptr, } static void on_phase_setup(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (c->version() == GameVersion::DC || c->version() == GameVersion::PC) { forward_subcommand(l, c, command, flag, data); return; @@ -1054,8 +1054,8 @@ static void on_phase_setup(shared_ptr, // enemy hit by player static void on_enemy_hit(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -1077,8 +1077,8 @@ static void on_enemy_hit(shared_ptr, } static void on_enemy_killed(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { forward_subcommand(l, c, command, flag, data); if (l->version == GameVersion::BB) { @@ -1136,7 +1136,7 @@ static void on_enemy_killed(shared_ptr s, send_give_experience(l, other_c, exp); if (other_c->options.debug) { send_text_message_printf(other_c, "$C5+%" PRIu32 " E-%hX (%s)", - exp, cmd.enemy_id.load(), e.type_name); + exp, cmd.enemy_id.load(), e.type_name); } bool leveled_up = false; @@ -1159,8 +1159,8 @@ static void on_enemy_killed(shared_ptr s, } static void on_destroy_inventory_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!l->is_game()) { return; @@ -1173,11 +1173,11 @@ static void on_destroy_inventory_item(shared_ptr, cmd.item_id, cmd.amount, c->version() != GameVersion::BB); auto name = item.data.name(false); l->log.info("Inventory item %hu:%08" PRIX32 " destroyed (%s)", - cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); + cmd.header.client_id.load(), cmd.item_id.load(), name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: destroy %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } c->game_data.player()->print_inventory(stderr); forward_subcommand(l, c, command, flag, data); @@ -1185,8 +1185,8 @@ static void on_destroy_inventory_item(shared_ptr, } static void on_destroy_ground_item(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { const auto& cmd = check_size_sc(data); if (!l->is_game()) { return; @@ -1195,19 +1195,19 @@ static void on_destroy_ground_item(shared_ptr, auto item = l->remove_item(cmd.item_id); auto name = item.data.name(false); l->log.info("Ground item %08" PRIX32 " destroyed (%s)", cmd.item_id.load(), - name.c_str()); + name.c_str()); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: destroy/ground %08" PRIX32 "\n%s", - cmd.item_id.load(), name.c_str()); + cmd.item_id.load(), name.c_str()); } forward_subcommand(l, c, command, flag, data); } } static void on_identify_item_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); if (!l->is_game()) { @@ -1240,8 +1240,8 @@ static void on_identify_item_bb(shared_ptr, } static void on_accept_identify_item_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -1266,7 +1266,7 @@ static void on_accept_identify_item_bb(shared_ptr, } static void on_sell_item_at_shop_bb(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, const string& data) { + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); @@ -1283,12 +1283,12 @@ static void on_sell_item_at_shop_bb(shared_ptr s, auto name = item.data.name(false); l->log.info("Inventory item %hu:%08" PRIX32 " destroyed via sale (%s)", - c->lobby_client_id, cmd.item_id.load(), name.c_str()); + c->lobby_client_id, cmd.item_id.load(), name.c_str()); c->game_data.player()->print_inventory(stderr); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: destroy/sale %08" PRIX32 "\n+%zu Meseta\n%s", - cmd.item_id.load(), price, name.c_str()); + cmd.item_id.load(), price, name.c_str()); } forward_subcommand(l, c, command, flag, data); @@ -1296,7 +1296,7 @@ static void on_sell_item_at_shop_bb(shared_ptr s, } static void on_buy_shop_item_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string& data) { + shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string& data) { if (l->version == GameVersion::BB) { const auto& cmd = check_size_sc(data); if (!(l->flags & Lobby::Flag::ITEM_TRACKING_ENABLED)) { @@ -1324,18 +1324,18 @@ static void on_buy_shop_item_bb(shared_ptr, auto name = item.data.name(false); l->log.info("Inventory item %hu:%08" PRIX32 " created via purchase (%s) for %zu meseta", - c->lobby_client_id, cmd.inventory_item_id.load(), name.c_str(), price); + c->lobby_client_id, cmd.inventory_item_id.load(), name.c_str(), price); c->game_data.player()->print_inventory(stderr); if (c->options.debug) { string name = item.data.name(true); send_text_message_printf(c, "$C5Items: create/purchase %08" PRIX32 "\n-%zu Meseta\n%s", - cmd.inventory_item_id.load(), price, name.c_str()); + cmd.inventory_item_id.load(), price, name.c_str()); } } } static void on_medical_center_bb(shared_ptr, - shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string&) { + shared_ptr l, shared_ptr c, uint8_t, uint8_t, const string&) { if (l->version == GameVersion::BB) { if (c->game_data.player()->disp.meseta < 10) { @@ -1351,8 +1351,8 @@ static void on_medical_center_bb(shared_ptr, // the handler function, and flags that tell when to allow the command. See command-input-subs.h // for more information on flags. The maximum size is not enforced if it's zero. typedef void (*subcommand_handler_t)(shared_ptr s, - shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, - const string& data); + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data); subcommand_handler_t subcommand_handlers[0x100] = { /* 00 */ on_invalid, @@ -1614,7 +1614,7 @@ subcommand_handler_t subcommand_handlers[0x100] = { }; void on_subcommand(shared_ptr s, shared_ptr l, - shared_ptr c, uint8_t command, uint8_t flag, const string& data) { + shared_ptr c, uint8_t command, uint8_t flag, const string& data) { if (data.empty()) { throw runtime_error("game command is empty"); } diff --git a/src/ServerState.cc b/src/ServerState.cc index 1abcb7c3..f4628176 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -181,7 +181,7 @@ bool ServerState::change_client_lobby( } void ServerState::send_lobby_join_notifications(shared_ptr l, - shared_ptr joining_client) { + shared_ptr joining_client) { for (auto& other_client : l->clients) { if (!other_client) { continue; @@ -259,7 +259,7 @@ void ServerState::remove_lobby(uint32_t lobby_id) { } shared_ptr ServerState::find_client(const std::u16string* identifier, - uint64_t serial_number, shared_ptr l) { + uint64_t serial_number, shared_ptr l) { if ((serial_number == 0) && identifier) { try { @@ -397,15 +397,15 @@ void ServerState::create_menus(shared_ptr config_json) { shared_ptr> information_contents(new vector()); information_menu_v3->emplace_back(InformationMenuItemID::GO_BACK, u"Go back", - u"Return to the\nmain menu", 0); + u"Return to the\nmain menu", 0); { uint32_t item_id = 0; for (const auto& item : d.at("InformationMenuContents")->as_list()) { auto& v = item->as_list(); information_menu_v2->emplace_back(item_id, decode_sjis(v.at(0)->as_string()), - decode_sjis(v.at(1)->as_string()), 0); + decode_sjis(v.at(1)->as_string()), 0); information_menu_v3->emplace_back(item_id, decode_sjis(v.at(0)->as_string()), - decode_sjis(v.at(1)->as_string()), MenuItem::Flag::REQUIRES_MESSAGE_BOXES); + decode_sjis(v.at(1)->as_string()), MenuItem::Flag::REQUIRES_MESSAGE_BOXES); information_contents->emplace_back(decode_sjis(v.at(2)->as_string())); item_id++; } @@ -428,16 +428,16 @@ void ServerState::create_menus(shared_ptr config_json) { ret_pds.clear(); ret_menu.emplace_back(ProxyDestinationsMenuItemID::GO_BACK, u"Go back", - u"Return to the\nmain menu", 0); + u"Return to the\nmain menu", 0); ret_menu.emplace_back(ProxyDestinationsMenuItemID::OPTIONS, u"Options", - u"Set proxy options", 0); + u"Set proxy options", 0); uint32_t item_id = 0; for (const auto& item : sorted_jsons) { const string& netloc_str = item.second->as_string(); const string& description = "$C7Remote server:\n$C6" + netloc_str; ret_menu.emplace_back(item_id, decode_sjis(item.first), - decode_sjis(description), 0); + decode_sjis(description), 0); ret_pds.emplace_back(parse_netloc(netloc_str)); item_id++; } @@ -490,9 +490,9 @@ void ServerState::create_menus(shared_ptr config_json) { } this->main_menu.emplace_back(MainMenuItemID::GO_TO_LOBBY, u"Go to lobby", - u"Join the lobby", 0); + u"Join the lobby", 0); this->main_menu.emplace_back(MainMenuItemID::INFORMATION, u"Information", - u"View server\ninformation", MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::REQUIRES_MESSAGE_BOXES); + u"View server\ninformation", MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::REQUIRES_MESSAGE_BOXES); uint32_t proxy_destinations_menu_item_flags = // DCNTE doesn't support multiple ship select menus without changing // servers (via a 19 command) apparently :( @@ -503,24 +503,24 @@ void ServerState::create_menus(shared_ptr config_json) { (this->proxy_destinations_xb.empty() ? MenuItem::Flag::INVISIBLE_ON_XB : 0) | MenuItem::Flag::INVISIBLE_ON_BB; this->main_menu.emplace_back(MainMenuItemID::PROXY_DESTINATIONS, u"Proxy server", - u"Connect to another\nserver", proxy_destinations_menu_item_flags); + u"Connect to another\nserver", proxy_destinations_menu_item_flags); this->main_menu.emplace_back(MainMenuItemID::DOWNLOAD_QUESTS, u"Download quests", - u"Download quests", MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::INVISIBLE_ON_BB); + u"Download quests", MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::INVISIBLE_ON_BB); if (!this->is_replay) { if (!this->function_code_index->patch_menu_empty()) { this->main_menu.emplace_back(MainMenuItemID::PATCHES, u"Patches", - u"Change game\nbehaviors", MenuItem::Flag::GC_ONLY | MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL); + u"Change game\nbehaviors", MenuItem::Flag::GC_ONLY | MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL); } if (!this->dol_file_index->empty()) { this->main_menu.emplace_back(MainMenuItemID::PROGRAMS, u"Programs", - u"Run GameCube\nprograms", MenuItem::Flag::GC_ONLY | MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL | MenuItem::Flag::REQUIRES_SAVE_DISABLED); + u"Run GameCube\nprograms", MenuItem::Flag::GC_ONLY | MenuItem::Flag::REQUIRES_SEND_FUNCTION_CALL | MenuItem::Flag::REQUIRES_SAVE_DISABLED); } } this->main_menu.emplace_back(MainMenuItemID::DISCONNECT, u"Disconnect", - u"Disconnect", 0); + u"Disconnect", 0); this->main_menu.emplace_back(MainMenuItemID::CLEAR_LICENSE, u"Clear license", - u"Disconnect with an\ninvalid license error\nso you can enter a\ndifferent serial\nnumber, access key,\nor password", - MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::INVISIBLE_ON_BB); + u"Disconnect with an\ninvalid license error\nso you can enter a\ndifferent serial\nnumber, access key,\nor password", + MenuItem::Flag::INVISIBLE_ON_DCNTE | MenuItem::Flag::INVISIBLE_ON_BB); try { this->welcome_message = decode_sjis(d.at("WelcomeMessage")->as_string()); @@ -647,7 +647,7 @@ void ServerState::parse_config(shared_ptr config_json) { this->local_address = this->all_addresses.at(local_address_str); string addr_str = string_for_address(this->local_address); config_log.info("Added local address: %s (%s)", addr_str.c_str(), - local_address_str.c_str()); + local_address_str.c_str()); } catch (const out_of_range&) { this->local_address = address_for_string(local_address_str.c_str()); config_log.info("Added local address: %s", local_address_str.c_str()); @@ -659,7 +659,7 @@ void ServerState::parse_config(shared_ptr config_json) { this->external_address = this->all_addresses.at(external_address_str); string addr_str = string_for_address(this->external_address); config_log.info("Added external address: %s (%s)", addr_str.c_str(), - external_address_str.c_str()); + external_address_str.c_str()); } catch (const out_of_range&) { this->external_address = address_for_string(external_address_str.c_str()); config_log.info("Added external address: %s", external_address_str.c_str()); @@ -747,8 +747,7 @@ void ServerState::parse_config(shared_ptr config_json) { for (const auto& it : d.at("CardAuctionPool")->as_dict()) { const auto& card_name = it.first; const auto& card_cfg_json = it.second->as_list(); - this->ep3_card_auction_pool.emplace(card_name, make_pair( - card_cfg_json.at(0)->as_int(), card_cfg_json.at(1)->as_int())); + this->ep3_card_auction_pool.emplace(card_name, make_pair(card_cfg_json.at(0)->as_int(), card_cfg_json.at(1)->as_int())); } } catch (const out_of_range&) { }