Using an overlay to indicate disk activity.

Started by Sslaxx, Fri 25/03/2011 21:56:17

Previous topic - Next topic

Sslaxx

I'm not really sure if it'd be worth it, but anyway...

So I want to use an overlay to indicate when there's disc activity of any type. Saving the game would be fairly straightforwards, but what about restoring - what happens to the overlay? I can see crashes happening that way.

So, I'm wanting to know if it's possible to safely use overlays to indicate disc activity when restoring a saved game?
Stuart "Sslaxx" Moore.

monkey0506

Why would the existence of an Overlay cause restoring a save file to crash?

It would take some work to actually make this type of thing useful, but it wouldn't be impossible (nor would it cause crashes of your game).

Sslaxx

Quote from: monkey_05_06 on Fri 25/03/2011 22:48:09
Why would the existence of an Overlay cause restoring a save file to crash?

It would take some work to actually make this type of thing useful, but it wouldn't be impossible (nor would it cause crashes of your game).
I dunno, what'd happen to the overlay variable created after the restore function had been called?
Stuart "Sslaxx" Moore.

Khris

The "RAM" of the game is destroyed and replaced by the one in the savegame.
Obviously, this means that the Overlay is going to disappear, but why would it crash the game? Every single other game object should cause the same crash, if that were the case.

Sslaxx

Quote from: Khris on Fri 25/03/2011 23:08:12
The "RAM" of the game is destroyed and replaced by the one in the savegame.
Obviously, this means that the Overlay is going to disappear, but why would it crash the game? Every single other game object should cause the same crash, if that were the case.
An overlay is a pointer, yes? So what'd happen if AGS tried to remove an overlay that was no longer in memory?
Stuart "Sslaxx" Moore.

monkey0506

This is precisely the reason you can't have pointers to custom struct types.

AGS uses only pointers to managed types (such as Overlay). The reason they're called "managed" types is because they are memory-managed. Garbage collection is handled automatically. AGS wouldn't try to remove an overlay that was no longer in memory. If there is a pointer pointing to the overlay then the overlay will never have its memory released; otherwise the overlay's memory will be released by AGS's garbage collection.

SMF spam blocked by CleanTalk