From de5547ff684c65b1f49d08f58da905a74a941c49 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 17 Dec 2023 18:30:29 -0800 Subject: [PATCH] clean up 6x75 structure --- src/ChatCommands.cc | 4 ++-- src/CommandFormats.hh | 7 +++---- src/ReceiveSubcommands.cc | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 06321a9d..04919cef 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -309,10 +309,10 @@ static void server_command_qset_qclear(shared_ptr c, const std::string& } if (is_v1_or_v2(c->version())) { - G_SetQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1}; + G_UpdateQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1}; send_command_t(l, 0x60, 0x00, cmd); } else { - G_SetQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x03, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000}; + G_UpdateQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x03, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000}; send_command_t(l, 0x60, 0x00, cmd); } } diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 762e8fe8..32792199 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -4781,16 +4781,15 @@ struct G_WordSelect_6x74 { WordSelectMessage message; } __packed__; -// 6x75: Set quest flag +// 6x75: Update quest flag -struct G_SetQuestFlag_DC_PC_6x75 { +struct G_UpdateQuestFlag_DC_PC_6x75 { G_UnusedHeader header; le_uint16_t flag = 0; // Must be < 0x400 le_uint16_t action = 0; // 0 = set flag, 1 = clear flag } __packed__; -struct G_SetQuestFlag_V3_BB_6x75 { - G_SetQuestFlag_DC_PC_6x75 basic_cmd; +struct G_UpdateQuestFlag_V3_BB_6x75 : G_UpdateQuestFlag_DC_PC_6x75 { le_uint16_t difficulty = 0; le_uint16_t unused = 0; } __packed__; diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 09f8685d..02166975 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -1689,14 +1689,14 @@ static void on_set_quest_flag(shared_ptr c, uint8_t command, uint8_t fla uint16_t flag_index, difficulty, action; if (is_v1_or_v2(c->version()) && (c->version() != Version::GC_NTE)) { - const auto& cmd = check_size_t(data, size); + const auto& cmd = check_size_t(data, size); flag_index = cmd.flag; action = cmd.action; difficulty = l->difficulty; } else { - const auto& cmd = check_size_t(data, size); - flag_index = cmd.basic_cmd.flag; - action = cmd.basic_cmd.action; + const auto& cmd = check_size_t(data, size); + flag_index = cmd.flag; + action = cmd.action; difficulty = cmd.difficulty; }