mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-22 01:12:19 -05:00
Fix an issue with a stray Rando::Context shared_ptr hanging around. (#4259)
* Fix an issue with a stray Rando::Context shared_ptr hanging around. * Fixes accidental leftover from when I found this bug on another branch * Properly reset randoContext on every save load, not just after save creation
This commit is contained in:
parent
483dbea330
commit
91d1e5970d
@ -240,12 +240,12 @@ bool HasAccessTo(const RandomizerRegion area) {
|
||||
return areaTable[area].HasAccess();
|
||||
}
|
||||
|
||||
std::shared_ptr<Rando::Context> randoCtx;
|
||||
Rando::Context* randoCtx;
|
||||
std::shared_ptr<Rando::Logic> logic;
|
||||
|
||||
void AreaTable_Init() {
|
||||
using namespace Rando;
|
||||
randoCtx = Context::GetInstance();
|
||||
randoCtx = Context::GetInstance().get();
|
||||
logic = randoCtx->GetLogic();
|
||||
grottoEvents = {
|
||||
EventAccess(&logic->GossipStoneFairy, { [] { return logic->GossipStoneFairy || logic->CanSummonGossipFairy; } }),
|
||||
|
@ -12,7 +12,7 @@
|
||||
typedef bool (*ConditionFn)();
|
||||
|
||||
// I hate this but every alternative I can think of right now is worse
|
||||
extern std::shared_ptr<Rando::Context> randoCtx;
|
||||
extern Rando::Context* randoCtx;
|
||||
extern std::shared_ptr<Rando::Logic> logic;
|
||||
|
||||
class EventAccess {
|
||||
|
@ -235,6 +235,11 @@ Entrance* Entrance::AssumeReachable() {
|
||||
return assumed;
|
||||
}
|
||||
|
||||
EntranceShuffler::EntranceShuffler() {
|
||||
playthroughEntrances = {};
|
||||
entranceOverrides = {};
|
||||
}
|
||||
|
||||
bool EntranceShuffler::HasNoRandomEntrances() {
|
||||
return mNoRandomEntrances;
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ using EntrancePools = std::map<EntranceType, std::vector<Entrance*>>;
|
||||
|
||||
class EntranceShuffler {
|
||||
public:
|
||||
EntranceShuffler();
|
||||
std::array<EntranceOverride, ENTRANCE_OVERRIDES_MAX_COUNT> entranceOverrides;
|
||||
std::vector<std::list<Entrance*>> playthroughEntrances;
|
||||
bool HasNoRandomEntrances();
|
||||
|
@ -2841,7 +2841,7 @@ extern "C" void Save_SaveGlobal(void) {
|
||||
}
|
||||
|
||||
extern "C" void Save_LoadFile(void) {
|
||||
if (gSaveContext.questId == QUEST_RANDOMIZER) {
|
||||
if (SaveManager::Instance->fileMetaInfo[gSaveContext.fileNum].randoSave) {
|
||||
// Reset rando context for rando saves.
|
||||
OTRGlobals::Instance->gRandoContext.reset();
|
||||
OTRGlobals::Instance->gRandoContext = Rando::Context::CreateInstance();
|
||||
|
Loading…
Reference in New Issue
Block a user