don't send Ep3 card defs unnecessarily
This commit is contained in:
@@ -64,6 +64,9 @@ struct Client {
|
||||
// Client has already received a 97 (enable saves) command, so don't show
|
||||
// the programs menu anymore
|
||||
SAVE_ENABLED = 0x0400,
|
||||
// Client has received newserv's Episode 3 card definitions, so don't send
|
||||
// them again
|
||||
HAS_EP3_CARD_DEFS = 0x4000,
|
||||
};
|
||||
|
||||
uint64_t id;
|
||||
|
||||
@@ -963,6 +963,10 @@ static HandlerResult S_G_B8(shared_ptr<ServerState>,
|
||||
session.log.info("Wrote %zu bytes to %s", size, output_filename.c_str());
|
||||
}
|
||||
|
||||
// Unset the flag specifying that the client has newserv's card definitions,
|
||||
// so the file sill be sent again if the client returns to newserv.
|
||||
session.newserv_client_config.cfg.flags &= ~Client::Flag::HAS_EP3_CARD_DEFS;
|
||||
|
||||
return !(session.newserv_client_config.cfg.flags & Client::Flag::IS_EPISODE_3)
|
||||
? HandlerResult::Type::FORWARD
|
||||
: HandlerResult::Type::SUPPRESS;
|
||||
|
||||
+10
-5
@@ -1568,13 +1568,18 @@ void send_give_experience(shared_ptr<Lobby> l, shared_ptr<Client> c,
|
||||
// ep3 only commands
|
||||
|
||||
void send_ep3_card_list_update(shared_ptr<ServerState> s, shared_ptr<Client> c) {
|
||||
const auto& data = s->ep3_data_index->get_compressed_card_definitions();
|
||||
if (!(c->flags & Client::Flag::HAS_EP3_CARD_DEFS)) {
|
||||
const auto& data = s->ep3_data_index->get_compressed_card_definitions();
|
||||
|
||||
StringWriter w;
|
||||
w.put_u32l(data.size());
|
||||
w.write(data);
|
||||
StringWriter w;
|
||||
w.put_u32l(data.size());
|
||||
w.write(data);
|
||||
|
||||
send_command(c, 0xB8, 0x00, w.str());
|
||||
send_command(c, 0xB8, 0x00, w.str());
|
||||
|
||||
c->flags |= Client::Flag::HAS_EP3_CARD_DEFS;
|
||||
send_update_client_config(c);
|
||||
}
|
||||
}
|
||||
|
||||
// sends the client a generic rank
|
||||
|
||||
Reference in New Issue
Block a user