molokki
Member
|
How to save Memc full of pointers?
I have Memc full of pointers to characters but is it possible to save it? Can I save pointers? I tried to use references but if I understood it right they can only be used with world objects.
I have it like this:
Code:
struct Party
{
Memc<Chr*> partyMembers;
Chr* partyLeader;
void save(File &f);
Bool load(File &f);
};
|
|
09-10-2012 09:49 PM |
|
Ogniok
Member
|
RE: How to save Memc full of pointers?
Look how save function works in Memc header.
It calls for function "save()" in every element. So if you want to save this container you can't use pointers. Better user references, then it will work.
Your code should look like:
Code:
struct Party
{
Memc<Reference<Chr>> partyMembers;
Chr* partyLeader;
void save(File &f);
Bool load(File &f);
};
(This post was last modified: 09-10-2012 09:58 PM by Ogniok.)
|
|
09-10-2012 09:58 PM |
|
molokki
Member
|
RE: How to save Memc full of pointers?
Great, thanks
|
|
09-11-2012 07:56 AM |
|
molokki
Member
|
RE: How to save Memc full of pointers?
Now I have a new problem
Every character should have reference to his party. How can I add reference to that Party if my Party is not Game::obj?
|
|
09-11-2012 09:02 AM |
|
Harry
Member
|
RE: How to save Memc full of pointers?
Maybe add Party member to character class?
|
|
09-11-2012 09:13 AM |
|
molokki
Member
|
RE: How to save Memc full of pointers?
I'm not sure what do you mean
Could you specify that a little bit?
|
|
09-11-2012 05:35 PM |
|
Harry
Member
|
RE: How to save Memc full of pointers?
Code:
struct Party
{
Memc<Reference<Chr>> partyMembers;
Chr* partyLeader;
void save(File &f);
Bool load(File &f);
};
struct Chr:Game::Chr
{
Party party;
}
I mean something like that. I hope that this is what you want to get?
(This post was last modified: 09-11-2012 09:15 PM by Harry.)
|
|
09-11-2012 09:14 PM |
|
molokki
Member
|
RE: How to save Memc full of pointers?
Ok, thank you
|
|
09-11-2012 10:03 PM |
|