diff --git a/src/Lobby.cc b/src/Lobby.cc index 843270ae..b4ca1d77 100644 --- a/src/Lobby.cc +++ b/src/Lobby.cc @@ -72,7 +72,8 @@ void Lobby::create_item_creator() { (this->mode == GameMode::SOLO) ? GameMode::NORMAL : this->mode, this->difficulty, this->section_id, - this->random_seed)); + this->random_seed, + this->quest ? this->quest->battle_rules : nullptr)); } void Lobby::create_ep3_server() { diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 765b9df7..f1a3707a 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -2085,11 +2085,14 @@ static void on_10(shared_ptr c, uint16_t, uint32_t, string& data) { } else { l->set_flag(Lobby::Flag::QUEST_IN_PROGRESS); } + l->quest = q; l->episode = q->episode; - - if (q->battle_rules && l->item_creator) { - l->item_creator->set_restrictions(q->battle_rules); + if (l->item_creator) { + l->item_creator->clear_destroyed_entities(); + if (q->battle_rules) { + l->item_creator->set_restrictions(q->battle_rules); + } } for (size_t client_id = 0; client_id < l->max_clients; client_id++) { @@ -2498,11 +2501,9 @@ static void on_AC_V3_BB(shared_ptr c, uint16_t, uint32_t, string& data) (l->base_version == GameVersion::BB) && l->map && l->quest) { - auto dat_contents = prs_decompress(*l->quest->version(QuestScriptVersion::BB_V4, c->language())->dat_contents); + auto vq = l->quest->version(QuestScriptVersion::BB_V4, c->language()); + auto dat_contents = prs_decompress(*vq->dat_contents); l->map->clear(); - if (l->item_creator) { - l->item_creator->clear_destroyed_entities(); - } l->map->add_enemies_from_quest_data(l->episode, l->difficulty, l->event, dat_contents.data(), dat_contents.size()); c->log.info("Replaced enemies list with quest layout (%zu entries)", l->map->enemies.size());