fix quest expr checks from lobby
This commit is contained in:
+6
-4
@@ -816,8 +816,9 @@ Lobby::JoinError Lobby::join_error_for_client(std::shared_ptr<Client> c, const s
|
||||
if (this->quest) {
|
||||
size_t num_clients = this->count_clients() + 1;
|
||||
bool v1_present = is_v1(c->version()) || this->any_v1_clients_present();
|
||||
if (!c->can_see_quest(this->quest, this->event, this->difficulty, num_clients, v1_present) ||
|
||||
!c->can_play_quest(this->quest, this->event, this->difficulty, num_clients, v1_present)) {
|
||||
auto this_sh = this->shared_from_this();
|
||||
if (!c->can_see_quest(this->quest, this_sh, this->event, this->difficulty, num_clients, v1_present) ||
|
||||
!c->can_play_quest(this->quest, this_sh, this->event, this->difficulty, num_clients, v1_present)) {
|
||||
return JoinError::NO_ACCESS_TO_QUEST;
|
||||
}
|
||||
}
|
||||
@@ -930,10 +931,11 @@ QuestIndex::IncludeCondition Lobby::quest_include_condition() const {
|
||||
return [this, num_players, v1_present](shared_ptr<const Quest> q) -> QuestIndex::IncludeState {
|
||||
bool is_enabled = true;
|
||||
for (const auto& lc : this->clients) {
|
||||
if (lc && !lc->can_see_quest(q, this->event, this->difficulty, num_players, v1_present)) {
|
||||
auto this_sh = this->shared_from_this();
|
||||
if (lc && !lc->can_see_quest(q, this_sh, this->event, this->difficulty, num_players, v1_present)) {
|
||||
return QuestIndex::IncludeState::HIDDEN;
|
||||
}
|
||||
if (lc && !lc->can_play_quest(q, this->event, this->difficulty, num_players, v1_present)) {
|
||||
if (lc && !lc->can_play_quest(q, this_sh, this->event, this->difficulty, num_players, v1_present)) {
|
||||
is_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user