mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
NANCY: Fix crash loading scene with PuzzleData
A scene that contains one of the puzzles that have an associated PuzzleData struct would previously crash on load, because loading from a save would clear the PuzzleData struct after the pointer to it was acquired by the puzzle. This commit adds second calls to getPuzzleData() in those puzzles, ensuring the pointer will be correct.
This commit is contained in:
parent
c07720c1c0
commit
dd6e641f9c
@ -118,6 +118,9 @@ void AssemblyPuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void AssemblyPuzzle::execute() {
|
||||
switch (_state) {
|
||||
case kBegin:
|
||||
_puzzleState = (AssemblyPuzzleData *)NancySceneState.getPuzzleData(AssemblyPuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
|
||||
|
@ -97,6 +97,9 @@ void RiddlePuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void RiddlePuzzle::execute() {
|
||||
switch (_state) {
|
||||
case kBegin: {
|
||||
_puzzleState = (RiddlePuzzleData *)NancySceneState.getPuzzleData(RiddlePuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
_nextBlinkTime = g_nancy->getTotalPlayTime() + _cursorBlinkTime;
|
||||
|
@ -194,6 +194,9 @@ void RippedLetterPuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void RippedLetterPuzzle::execute() {
|
||||
switch (_state) {
|
||||
case kBegin:
|
||||
_puzzleState = (RippedLetterPuzzleData *)NancySceneState.getPuzzleData(RippedLetterPuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
|
||||
|
@ -109,6 +109,9 @@ void SliderPuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void SliderPuzzle::execute() {
|
||||
switch (_state) {
|
||||
case kBegin:
|
||||
_puzzleState = (SliderPuzzleData *)NancySceneState.getPuzzleData(SliderPuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
if (!_puzzleState->playerHasTriedPuzzle || !_retainState) {
|
||||
|
@ -192,6 +192,9 @@ void SoundEqualizerPuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void SoundEqualizerPuzzle::execute() {
|
||||
switch(_state) {
|
||||
case kBegin:
|
||||
_puzzleState = (SoundEqualizerPuzzleData *)NancySceneState.getPuzzleData(SoundEqualizerPuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
|
||||
|
@ -96,6 +96,9 @@ void TowerPuzzle::readData(Common::SeekableReadStream &stream) {
|
||||
void TowerPuzzle::execute() {
|
||||
switch (_state) {
|
||||
case kBegin:
|
||||
_puzzleState = (TowerPuzzleData *)NancySceneState.getPuzzleData(TowerPuzzleData::getTag());
|
||||
assert(_puzzleState);
|
||||
|
||||
init();
|
||||
registerGraphics();
|
||||
_numRings = _numRingsByDifficulty[NancySceneState.getDifficulty()];
|
||||
|
Loading…
x
Reference in New Issue
Block a user