Skip to content

Commit 0a67bbe

Browse files
committed
sanitize missionWeights on load
don't mess with lolth.
1 parent da822a7 commit 0a67bbe

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/Mod/Mod.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,26 @@ void Mod::loadMod(const std::vector<std::string> &rulesetFiles, size_t modIdx)
695695
}
696696
}
697697

698+
// instead of passing a pointer to the region load function and moving the alienMission loading before region loading
699+
// and sanitizing there, i'll sanitize here, i'm sure this sanitation will grow, and will need to be refactored into
700+
// its own function at some point, but for now, i'll put it here next to the missionScript sanitation, because it seems
701+
// the logical place for it, given that this sanitation is required as a result of moving all terror mission handling
702+
// into missionScripting behaviour. apologies to all the modders that will be getting errors and need to adjust their
703+
// rulesets, but this will save you weird errors down the line.
704+
for (std::map<std::string, RuleRegion*>::iterator i = _regions.begin(); i != _regions.end(); ++i)
705+
{
706+
// bleh, make copies, const correctness kinda screwed me here.
707+
WeightedOptions weights = (*i).second->getAvailableMissions();
708+
std::vector<std::string> names = weights.getNames();
709+
for (std::vector<std::string>::iterator j = names.begin(); j != names.end(); ++j)
710+
{
711+
if (getAlienMission(*j)->getObjective() == OBJECTIVE_SITE)
712+
{
713+
throw Exception("Error with MissionWeights: Region: " + (*i).first + " has " + *j + " listed. Terror mission can only be invoked via missionScript, so sayeth the Spider Queen.");
714+
}
715+
}
716+
}
717+
698718
if (modIdx == 0)
699719
{
700720
loadVanillaResources();

0 commit comments

Comments
 (0)