refactor GameVersion and QuestScriptVersion into a single enum
This commit is contained in:
@@ -242,8 +242,7 @@ void Server::send_6xB4x46() const {
|
||||
this->send(cmd46);
|
||||
}
|
||||
|
||||
string Server::prepare_6xB6x41_map_definition(
|
||||
shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_trial) {
|
||||
string Server::prepare_6xB6x41_map_definition(shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_trial) {
|
||||
auto vm = map->version(language);
|
||||
|
||||
const auto& compressed = vm->compressed(is_trial);
|
||||
@@ -255,7 +254,7 @@ string Server::prepare_6xB6x41_map_definition(
|
||||
return std::move(w.str());
|
||||
}
|
||||
|
||||
void Server::send_commands_for_joining_spectator(Channel& ch, bool is_trial) const {
|
||||
void Server::send_commands_for_joining_spectator(Channel& ch) const {
|
||||
bool should_send_state = true;
|
||||
if (this->setup_phase == SetupPhase::REGISTRATION) {
|
||||
// If registration is still in progress, we only need to send the map data
|
||||
@@ -267,7 +266,8 @@ void Server::send_commands_for_joining_spectator(Channel& ch, bool is_trial) con
|
||||
}
|
||||
|
||||
if (this->last_chosen_map) {
|
||||
string data = this->prepare_6xB6x41_map_definition(this->last_chosen_map, ch.language, is_trial);
|
||||
string data = this->prepare_6xB6x41_map_definition(
|
||||
this->last_chosen_map, ch.language, (ch.version == Version::GC_EP3_TRIAL_EDITION));
|
||||
this->log().info("Sending %c version of map %08" PRIX32, char_for_language_code(ch.language), this->last_chosen_map->map_number);
|
||||
ch.send(0x6C, 0x00, data);
|
||||
}
|
||||
@@ -2349,7 +2349,7 @@ void Server::send_6xB6x41_to_all_clients() const {
|
||||
}
|
||||
if (map_commands_by_language[c->language()].empty()) {
|
||||
map_commands_by_language[c->language()] = this->prepare_6xB6x41_map_definition(
|
||||
this->last_chosen_map, c->language(), l->check_flag(Lobby::Flag::IS_EP3_TRIAL));
|
||||
this->last_chosen_map, c->language(), (l->base_version == Version::GC_EP3_TRIAL_EDITION));
|
||||
}
|
||||
this->log().info("Sending %c version of map %08" PRIX32, char_for_language_code(c->language()), this->last_chosen_map->map_number);
|
||||
send_command(c, 0x6C, 0x00, map_commands_by_language[c->language()]);
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
this->send(&cmd, cmd.header.size * 4);
|
||||
}
|
||||
void send(const void* data, size_t size) const;
|
||||
void send_commands_for_joining_spectator(Channel& ch, bool is_trial) const;
|
||||
void send_commands_for_joining_spectator(Channel& ch) const;
|
||||
|
||||
void force_battle_result(uint8_t surrendered_client_id, bool set_winner);
|
||||
void force_destroy_field_character(uint8_t client_id, size_t set_index);
|
||||
|
||||
@@ -701,10 +701,7 @@ void Tournament::send_all_state_updates() const {
|
||||
// Note: The last check here is to make sure the client is still linked
|
||||
// with this instance of the tournament - an intervening shell command
|
||||
// `reload ep3` could have changed the client's linkage
|
||||
if (c &&
|
||||
c->config.check_flag(Client::Flag::IS_EPISODE_3) &&
|
||||
!c->config.check_flag(Client::Flag::IS_EP3_TRIAL_EDITION) &&
|
||||
(c->ep3_tournament_team.lock() == team)) {
|
||||
if (c && (c->version() == Version::GC_EP3) && (c->ep3_tournament_team.lock() == team)) {
|
||||
send_ep3_confirm_tournament_entry(c, this->shared_from_this());
|
||||
}
|
||||
}
|
||||
@@ -715,10 +712,7 @@ void Tournament::send_all_state_updates_on_deletion() const {
|
||||
for (const auto& team : this->teams) {
|
||||
for (const auto& player : team->players) {
|
||||
auto c = player.client.lock();
|
||||
if (c &&
|
||||
c->config.check_flag(Client::Flag::IS_EPISODE_3) &&
|
||||
!c->config.check_flag(Client::Flag::IS_EP3_TRIAL_EDITION) &&
|
||||
(c->ep3_tournament_team.lock() == team)) {
|
||||
if (c && (c->version() == Version::GC_EP3) && (c->ep3_tournament_team.lock() == team)) {
|
||||
send_ep3_confirm_tournament_entry(c, nullptr);
|
||||
}
|
||||
}
|
||||
@@ -916,7 +910,7 @@ shared_ptr<Tournament::Team> TournamentIndex::team_for_serial_number(uint32_t se
|
||||
}
|
||||
|
||||
void TournamentIndex::link_client(shared_ptr<Client> c) {
|
||||
if (!c->config.check_flag(Client::Flag::IS_EPISODE_3)) {
|
||||
if (!is_ep3(c->version())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -927,7 +921,7 @@ void TournamentIndex::link_client(shared_ptr<Client> c) {
|
||||
if (player.serial_number == c->license->serial_number) {
|
||||
c->ep3_tournament_team = team;
|
||||
player.client = c;
|
||||
if (!c->config.check_flag(Client::Flag::IS_EP3_TRIAL_EDITION)) {
|
||||
if (c->version() == Version::GC_EP3) {
|
||||
send_ep3_confirm_tournament_entry(c, tourn);
|
||||
}
|
||||
return;
|
||||
@@ -936,7 +930,7 @@ void TournamentIndex::link_client(shared_ptr<Client> c) {
|
||||
throw logic_error("tournament team found for player, but player not found on team");
|
||||
} else {
|
||||
c->ep3_tournament_team.reset();
|
||||
if (!c->config.check_flag(Client::Flag::IS_EP3_TRIAL_EDITION)) {
|
||||
if (c->version() == Version::GC_EP3) {
|
||||
send_ep3_confirm_tournament_entry(c, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user