About Store Forum Documentation Contact



Post Reply 
[SOLVED]world can't load twice
Author Message
kasinova Offline
Member

Post: #1
[SOLVED]world can't load twice
In my situation, I am switching back and forth from two worlds (just like teleport tutorial)
I am able to go from world1 to world2 since it creates New and not Load
I can go back to world1 from world2 and it does use load
Here is where the problem starts, when I try to go back to world2 from world1, and even trying to exit at this point, it will crash

The problem will also occur even without switching worlds. If I stay in my world1 and F2(save) then F3(load), I am able to load successfully once, then I save and load again and crash.

I've tried debugging this, and the error occurs when freeing memory.

Anyone have any ideas?
(This post was last modified: 08-09-2013 01:25 AM by kasinova.)
08-06-2013 11:04 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Member

Post: #2
RE: world can't load twice
Sounds like memory leak. Maybe you have some pointers to object in world1, and when you reload world, adresses did change, your pointer point to wrong adress. Ony suggestion, I didn't saw your code.
08-07-2013 08:49 AM
Find all posts by this user Quote this message in a reply
kasinova Offline
Member

Post: #3
RE: world can't load twice
Okay, so I copied and completely stripped my game of everything to check this error. It seems that it always goes through the create method when loading a world from a file. When I noticed this, I commented out some of my variables in my object's save function. It works fine now but I am confused as to what I should and should not be saving during a world save.

And a side question about loading, how would I effectively save and load a Memc variable? or even an enumeration?
08-09-2013 12:07 AM
Find all posts by this user Quote this message in a reply
kasinova Offline
Member

Post: #4
RE: world can't load twice
Okay, disregard that last post lol so it was all in my save/load functions. I was saving an entire Memc and loading a Memc which is a bad idea! or not even an idea! instead I had to save the elms() then FREPA. when loading, I just REP(f.getInt()) and renewed all the variables.

Tip for everyone, master file IO first before making all your systems!
08-09-2013 01:24 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: [SOLVED]world can't load twice
You can do Memc.save, if you store in it objects that have their own 'save' method
08-14-2013 09:52 PM
Find all posts by this user Quote this message in a reply
kasinova Offline
Member

Post: #6
RE: [SOLVED]world can't load twice
That never occurred to me! Which that's way more efficient than my alternative lol thanks for the advice even after I thought I solved it!
08-14-2013 11:48 PM
Find all posts by this user Quote this message in a reply
Post Reply