About Store Forum Documentation Contact
Donations:
392$/mo



Post Reply 
Memx container of references load method - compiler error
Author Message
Harry Offline
Member

Post: #1
Memx container of references load method - compiler error
I want to load saved Memx container of references but I have an error on compilation step which shows me that something is wrong with this line:

Code:
T1(TYPE) Bool Memx<TYPE>::load(File &f)  {clear(); REP(f.getInt(      ))    if(!New().load(f))return false; return true;}

in Templates.h.

Error:

Code:
1>d:\microsoft visual studio 9.0\vc\include\esenthelengine\misc\templates.h(305) : error C2171: '!' : illegal on operands of type 'void'
1>        d:\microsoft visual studio 9.0\vc\include\esenthelengine\misc\templates.h(305) : while compiling class template member function 'Bool EE::Memx<TYPE>::load(EE::File &)'
1>        with
1>        [
1>            TYPE=EE::Reference<EE::Game::Kinematic>
1>        ]
1>        d:\forest valley\source\mission.h(41) : see reference to class template instantiation 'EE::Memx<TYPE>' being compiled
1>        with
1>        [
1>            TYPE=EE::Reference<EE::Game::Kinematic>
1>        ]
1>d:\microsoft visual studio 9.0\vc\include\esenthelengine\misc\templates.h(305) : error C2451: conditional expression of type 'void' is illegal
1>        Expressions of type void cannot be converted to other types

Here is some part of my code:

Code:
Memx<Reference<Game::Kinematic>> sign;

if(!sign.load(f))return false;

If you ask why I want have this here is the answer:

I want create a container of mission pointers, characters which are mission targets etc. and I need to have to them acces even when they aren't in the visible area of world. I tried use just REPA(sign)sign[i].save(f); REPA(sign)sign[i].load(f); but I have some problems because if I save game with sign valid and then during the game I delete it then after loading I have no signs. There are just Kinematic objects which aren't stored in memx container.

Is there any better way in my problem?
08-15-2011 11:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Memx container of references load method - compiler error
//save
sign.save(f);

//load
sign.clear(); REP(f.getInt())sign.New().load(f);
08-16-2011 11:03 AM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Memx container of references load method - compiler error
Thanks, anyway it doesn't solve my problem. After loading I have immediately error in this part:

Code:
if(sign.elms())
{
     if(Dist(sign[0]().matrix.pos() .....)
}

sign.elms() shows me that there is 1 valid element and when I'm trying go through sign container and get index of this element I get -1.

EDIT: Ok, nevermind. I had commented linking references grin
(This post was last modified: 08-17-2011 10:17 AM by Harry.)
08-16-2011 12:17 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply