mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 10:52: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();
|
return areaTable[area].HasAccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Rando::Context> randoCtx;
|
Rando::Context* randoCtx;
|
||||||
std::shared_ptr<Rando::Logic> logic;
|
std::shared_ptr<Rando::Logic> logic;
|
||||||
|
|
||||||
void AreaTable_Init() {
|
void AreaTable_Init() {
|
||||||
using namespace Rando;
|
using namespace Rando;
|
||||||
randoCtx = Context::GetInstance();
|
randoCtx = Context::GetInstance().get();
|
||||||
logic = randoCtx->GetLogic();
|
logic = randoCtx->GetLogic();
|
||||||
grottoEvents = {
|
grottoEvents = {
|
||||||
EventAccess(&logic->GossipStoneFairy, { [] { return logic->GossipStoneFairy || logic->CanSummonGossipFairy; } }),
|
EventAccess(&logic->GossipStoneFairy, { [] { return logic->GossipStoneFairy || logic->CanSummonGossipFairy; } }),
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
typedef bool (*ConditionFn)();
|
typedef bool (*ConditionFn)();
|
||||||
|
|
||||||
// I hate this but every alternative I can think of right now is worse
|
// 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;
|
extern std::shared_ptr<Rando::Logic> logic;
|
||||||
|
|
||||||
class EventAccess {
|
class EventAccess {
|
||||||
|
@ -235,6 +235,11 @@ Entrance* Entrance::AssumeReachable() {
|
|||||||
return assumed;
|
return assumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntranceShuffler::EntranceShuffler() {
|
||||||
|
playthroughEntrances = {};
|
||||||
|
entranceOverrides = {};
|
||||||
|
}
|
||||||
|
|
||||||
bool EntranceShuffler::HasNoRandomEntrances() {
|
bool EntranceShuffler::HasNoRandomEntrances() {
|
||||||
return mNoRandomEntrances;
|
return mNoRandomEntrances;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,7 @@ using EntrancePools = std::map<EntranceType, std::vector<Entrance*>>;
|
|||||||
|
|
||||||
class EntranceShuffler {
|
class EntranceShuffler {
|
||||||
public:
|
public:
|
||||||
|
EntranceShuffler();
|
||||||
std::array<EntranceOverride, ENTRANCE_OVERRIDES_MAX_COUNT> entranceOverrides;
|
std::array<EntranceOverride, ENTRANCE_OVERRIDES_MAX_COUNT> entranceOverrides;
|
||||||
std::vector<std::list<Entrance*>> playthroughEntrances;
|
std::vector<std::list<Entrance*>> playthroughEntrances;
|
||||||
bool HasNoRandomEntrances();
|
bool HasNoRandomEntrances();
|
||||||
|
@ -2841,7 +2841,7 @@ extern "C" void Save_SaveGlobal(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void Save_LoadFile(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.
|
// Reset rando context for rando saves.
|
||||||
OTRGlobals::Instance->gRandoContext.reset();
|
OTRGlobals::Instance->gRandoContext.reset();
|
||||||
OTRGlobals::Instance->gRandoContext = Rando::Context::CreateInstance();
|
OTRGlobals::Instance->gRandoContext = Rando::Context::CreateInstance();
|
||||||
|
Loading…
Reference in New Issue
Block a user