fix bb player choice bug

This commit is contained in:
Martin Michelsen
2022-05-11 23:19:30 -07:00
parent ea94c38598
commit 711a4b815c
4 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -80,7 +80,7 @@ ClientConfigBB Client::export_config_bb() const {
ClientConfigBB cc;
cc.cfg = this->export_config();
cc.bb_game_state = this->bb_game_state;
cc.bb_player_index = this->bb_player_index;
cc.bb_player_index = this->game_data.bb_player_index;
cc.unused.clear(0xFF);
return cc;
}
@@ -97,5 +97,5 @@ void Client::import_config(const ClientConfig& cc) {
void Client::import_config(const ClientConfigBB& cc) {
this->import_config(cc.cfg);
this->bb_game_state = cc.bb_game_state;
this->bb_player_index = cc.bb_player_index;
this->game_data.bb_player_index = cc.bb_player_index;
}
-1
View File
@@ -61,7 +61,6 @@ struct Client {
// config can be up to 0x20 bytes; on BB it can be 0x28 bytes. We don't use
// all of that space.
uint8_t bb_game_state;
uint8_t bb_player_index;
uint16_t flags;
// Encryption
+4 -4
View File
@@ -270,7 +270,7 @@ void process_login_d_e_pc_gc(shared_ptr<ServerState> s, shared_ptr<Client> c,
// to newserv before, so we should show the welcome message.
c->flags |= Client::Flag::AT_WELCOME_MESSAGE;
c->bb_game_state = ClientStateBB::INITIAL_LOGIN;
c->bb_player_index = 0;
c->game_data.bb_player_index = 0;
}
} else {
@@ -346,7 +346,7 @@ void process_login_bb(shared_ptr<ServerState> s, shared_ptr<Client> c,
}
} catch (const invalid_argument&) {
c->bb_game_state = ClientStateBB::INITIAL_LOGIN;
c->bb_player_index = 0;
c->game_data.bb_player_index = 0;
}
send_client_init_bb(c, 0);
@@ -1224,7 +1224,7 @@ void process_player_preview_request_bb(shared_ptr<ServerState>, shared_ptr<Clien
const auto& cmd = check_size_t<C_PlayerPreviewRequest_BB_E3>(data);
if (c->bb_game_state == ClientStateBB::CHOOSE_PLAYER) {
c->bb_player_index = cmd.player_index;
c->game_data.bb_player_index = cmd.player_index;
c->bb_game_state++;
send_client_init_bb(c, 0);
send_approve_player_choice_bb(c);
@@ -1309,7 +1309,7 @@ void process_create_character_bb(shared_ptr<ServerState> s, shared_ptr<Client> c
return;
}
c->bb_player_index = cmd.player_index;
c->game_data.bb_player_index = cmd.player_index;
try {
c->game_data.create_player(cmd.preview, s->level_table);
+1 -1
View File
@@ -435,7 +435,7 @@ void send_stream_file_chunk_bb(shared_ptr<Client> c, uint32_t chunk_index) {
}
void send_approve_player_choice_bb(shared_ptr<Client> c) {
S_ApprovePlayerChoice_BB_00E4 cmd = {c->bb_player_index, 1};
S_ApprovePlayerChoice_BB_00E4 cmd = {c->game_data.bb_player_index, 1};
send_command_t(c, 0x00E4, 0x00000000, cmd);
}