About Store Forum Documentation Contact



Post Reply 
[Solved]Ineisis 1.0 sources broken by SDK update
Author Message
Fex Offline
Gold Supporter

Post: #1
[Solved]Ineisis 1.0 sources broken by SDK update
The 1.0 Ineisis source in the store cannot be compiled by the latest SDK.

I have made it compile by replacing FAll with FList and some other minor things, however object placement and the object list do not work.

This is because the meaning of ObjParams->type() has been redefined to return a UID. All the objects in the object list ObjParams->type() return UIDZero. Its taking too much brain power to think through how to make this work...

This is important to me because I am upgrading from build 11 to build 23 and the change to ObjParams->type() to return UID is causing problems all over my code. So I have two questions:

1. Is Esenthel going to update the Ineisis 1.0 code to work on the latest 1.0 SDK? If so I will put off fixing my code until I see how he fixes Ineisis 1.0.

2. Is there any easy way to emulate the old
Code:
void type    (Bool custom, C Str8         &type    =S              ) ;   C Str         & type    ()C {return _type    ;} // set/get object type        (OBJ_TYPE, for example "OBJ_ITEM"),

Instead of the new SDK's
Code:
void type    (Bool custom, C UID          &type     =UIDZero        );   C UID         & type    ()C {return _type     ;} // set/get object type        (OBJ_TYPE 'ObjType' enum element ID)

[Image: ineisis1sdk23_zpsd179809e.jpg]
(This post was last modified: 04-22-2013 05:44 AM by Fex.)
04-21-2013 05:34 PM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #2
RE: Ineisis 1.0 sources broken by SDK update
If you swap these things out in the project list it fixes the list:

replace
Code:
static int CompareElm(C Element &a, C Element &b) {return Compare(a.obj ? a.obj->type() : UIDZero, b.obj ? b.obj->type() : UIDZero);}
with
Code:
static int CompareElm(C Element &a, C Element &b) {return Compare(a.obj ? a.obj.name() : S, b.obj ? b.obj.name() : S);}


comment out and swap like this
Code:
int  types=0, type_max=0, tm=0; Str last_type; REPA(elements){Str type=(elements[i].obj ? elements[i].obj.name() : S); if(type!=last_type){last_type=type; types++; tm=0;} MAX(type_max, ++tm);} // go from end
      //int  types=0, type_max=0, tm=0; UID last_type=UIDZero; REPA(elements){UID type=(elements[i].obj ? elements[i].obj->type() : UIDZero); if(type!=last_type){last_type=type; types++; tm=0;} MAX(type_max, ++tm);} // go from end

Code:
Str      type=(elm.obj ? elm.obj.name() : S);
         if(type!=last_type){pos.x+=s; pos.y=-rect().h(); last_type=type;}
         //UID      type=(elm.obj ? elm.obj->type() : UIDZero);
         //if(type!=last_type){pos.x+=s; pos.y=-rect().h(); last_type=type;}

This fixes the object list itself. Objects still do not place, but I hope it is as simple to fix lines like
Code:
if(obj_params)if(Memx<Obj> *obj_container=GetObjContainer(Game.ObjType.find(obj_params->type())))

You can see the differnece between 1.0 and 2.0 by copying this the game update or Player.update() and hitting Z
Code:
if(Kb.b(KB_Z))
   {
      CM.New(S+ ObjList.elements.elms());
   REPA(ObjList.elements)CM.New(S+"name: "+ObjList.elements[i].obj.name()+ " id: " + ObjList.elements[i].obj.id().asText());
   }

the id is null in 1.0, name returns null in 2.0
(This post was last modified: 04-21-2013 08:37 PM by Fex.)
04-21-2013 08:36 PM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #3
RE: Ineisis 1.0 sources broken by SDK update
Solution is to put this

Code:
REPA(ObjList.elements)if(ObjList.elements[i].obj){if(Param *param=ObjList.elements[i].obj->findParam("TYPE"))ObjList.elements[i].obj->type(true, Game::ObjType.elmID(param.asEnum()));}

At the end of your InitGame() function. Also you need to add an Enum type parameter to each object in the world object editor named "TYPE" and select the object type of the object, you can't switch to constant access type and then select the object type from the type drop down box, that won't work.

If you don't want to add a parameter to each object, and if you don't need to check types for other code you may have you can simply use this line instead:

Code:
REPA(ObjList.elements)if(ObjList.elements[i].obj){ObjList.elements[i].obj->type(true, Game::ObjType.elmID(OBJ_TORCH));}

This will store all object instances in the OBJ_TORCH ObjContainer (or whatever else one you want), to no negative effect that I can discern. Doors still work as doors etc.. not really sure what the benefit of the ObjContainer system Ineisis uses is ... maybe in the future it will become apparent.
(This post was last modified: 04-22-2013 05:30 AM by Fex.)
04-22-2013 02:35 AM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #4
RE: [Solved]Ineisis 1.0 sources broken by SDK update
If you want the buildable items to properly sort in vertices categorical replace.

Code:
// int  types=0, type_max=0, tm=0; Str last_type; REPA(elements){Str type=(elements[i].obj ? elements[i].obj.name() : S); if(type!=last_type){last_type=type; types++; tm=0;} MAX(type_max, ++tm);} // go from end
with
Code:
Str type=S;
         if(ObjList.elements[i].obj)if(Param *param=ObjList.elements[i].obj->findParam("TYPE"))type = TextInt(param.asEnum());

and

Code:
Str      type=(elm.obj ? elm.obj.name() : S);

with

Code:
Str type=S;
         if(elm.obj)if(Param *param=elm.obj->findParam("TYPE"))type = TextInt(param.asEnum());
04-24-2013 02:53 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #5
RE: [Solved]Ineisis 1.0 sources broken by SDK update
Hello,

Thanks, I've uploaded updated source code.

The solution to placing objects was to put Game::ObjType=.. at the end of InitPre.
04-27-2013 11:23 AM
Find all posts by this user Quote this message in a reply
Post Reply