fix results screen for final tournament match
This commit is contained in:
@@ -5496,11 +5496,13 @@ struct G_TournamentMatchResult_GC_Ep3_6xB4x51 {
|
|||||||
parray<ptext<char, 0x10>, 2> player_names;
|
parray<ptext<char, 0x10>, 2> player_names;
|
||||||
} __packed__;
|
} __packed__;
|
||||||
parray<NamesEntry, 2> names_entries;
|
parray<NamesEntry, 2> names_entries;
|
||||||
struct ResultEntry {
|
le_uint16_t unused1 = 0;
|
||||||
le_uint16_t num_players;
|
// If round_num is equal to 6, the "On to the next battle..." text is replaced
|
||||||
le_uint16_t is_winner_team;
|
// with "Congratulations!" and some flashier graphics. This is used for the
|
||||||
} __packed__;
|
// final match.
|
||||||
parray<ResultEntry, 2> result_entries;
|
le_uint16_t round_num = 0;
|
||||||
|
le_uint16_t num_players_per_team = 0;
|
||||||
|
le_uint16_t winner_team_id = 0;
|
||||||
le_uint32_t meseta_amount = 0;
|
le_uint32_t meseta_amount = 0;
|
||||||
// This field apparently is supposed to contain a %s token (as for printf)
|
// This field apparently is supposed to contain a %s token (as for printf)
|
||||||
// that is replaced with meseta_amount.
|
// that is replaced with meseta_amount.
|
||||||
|
|||||||
@@ -145,6 +145,8 @@ shared_ptr<const ServerBase> Server::base() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int8_t Server::get_winner_team_id() const {
|
int8_t Server::get_winner_team_id() const {
|
||||||
|
// Note: This function is not part of the original implementation.
|
||||||
|
|
||||||
parray<size_t, 2> team_player_counts(0);
|
parray<size_t, 2> team_player_counts(0);
|
||||||
parray<size_t, 2> team_win_flag_counts(0);
|
parray<size_t, 2> team_win_flag_counts(0);
|
||||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||||
|
|||||||
@@ -345,6 +345,10 @@ shared_ptr<Tournament::Match> Tournament::next_match_for_team(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shared_ptr<Tournament::Match> Tournament::get_final_match() const {
|
||||||
|
return this->final_match;
|
||||||
|
}
|
||||||
|
|
||||||
void Tournament::start() {
|
void Tournament::start() {
|
||||||
if (this->current_state != State::REGISTRATION) {
|
if (this->current_state != State::REGISTRATION) {
|
||||||
throw runtime_error("tournament has already started");
|
throw runtime_error("tournament has already started");
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public:
|
|||||||
std::shared_ptr<Team> get_team(size_t index) const;
|
std::shared_ptr<Team> get_team(size_t index) const;
|
||||||
std::shared_ptr<Team> get_winner_team() const;
|
std::shared_ptr<Team> get_winner_team() const;
|
||||||
std::shared_ptr<Match> next_match_for_team(std::shared_ptr<Team> team) const;
|
std::shared_ptr<Match> next_match_for_team(std::shared_ptr<Team> team) const;
|
||||||
|
std::shared_ptr<Match> get_final_match() const;
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
void print_bracket(FILE* stream) const;
|
void print_bracket(FILE* stream) const;
|
||||||
|
|||||||
+10
-4
@@ -2108,6 +2108,11 @@ void send_ep3_tournament_match_result(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((match->winner_team != match->preceding_a->winner_team) &&
|
||||||
|
(match->winner_team != match->preceding_b->winner_team)) {
|
||||||
|
throw logic_error("cannot send tournament result without valid winner team");
|
||||||
|
}
|
||||||
|
|
||||||
unordered_map<uint32_t, shared_ptr<Client>> serial_number_to_client;
|
unordered_map<uint32_t, shared_ptr<Client>> serial_number_to_client;
|
||||||
for (auto client : l->clients) {
|
for (auto client : l->clients) {
|
||||||
if (client) {
|
if (client) {
|
||||||
@@ -2133,10 +2138,11 @@ void send_ep3_tournament_match_result(
|
|||||||
write_player_names(cmd.names_entries[0], match->preceding_a->winner_team);
|
write_player_names(cmd.names_entries[0], match->preceding_a->winner_team);
|
||||||
cmd.names_entries[1].team_name = match->preceding_b->winner_team->name;
|
cmd.names_entries[1].team_name = match->preceding_b->winner_team->name;
|
||||||
write_player_names(cmd.names_entries[1], match->preceding_b->winner_team);
|
write_player_names(cmd.names_entries[1], match->preceding_b->winner_team);
|
||||||
cmd.result_entries[0].num_players = match->preceding_a->winner_team->max_players;
|
// The value 6 here causes the client to show the "Congratulations" text
|
||||||
cmd.result_entries[0].is_winner_team = (match->preceding_a->winner_team == match->winner_team);
|
// instead of "On to the next round"
|
||||||
cmd.result_entries[1].num_players = match->preceding_a->winner_team->max_players;
|
cmd.round_num = (match == tourn->get_final_match()) ? 6 : match->round_num;
|
||||||
cmd.result_entries[1].is_winner_team = (match->preceding_b->winner_team == match->winner_team);
|
cmd.num_players_per_team = match->preceding_a->winner_team->max_players;
|
||||||
|
cmd.winner_team_id = (match->preceding_b->winner_team == match->winner_team);
|
||||||
// TODO: This amount should vary depending on the match level / round number,
|
// TODO: This amount should vary depending on the match level / round number,
|
||||||
// but newserv doesn't currently implement meseta at all - we just always give
|
// but newserv doesn't currently implement meseta at all - we just always give
|
||||||
// the player 1000000 and never charge for anything.
|
// the player 1000000 and never charge for anything.
|
||||||
|
|||||||
Reference in New Issue
Block a user