Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Howto replace a Defcore entry with a property
- - By Günther [de] Date 2012-04-17 00:27
The recipe is something like this:
- Remove the line in C4Def::CompileFunc in C4Def.cpp that connects the Defcore value to the internal engine variable
- Remove the internal engine variable from C4Def.h and replace all users with GetPropertyInt(P_Foo). For non-integer values it gets a bit more complicated. See C4PropList.h for the APIs to use.
- Add one line each to C4StringTable.h and C4StringTable.cpp for P_Foo, mirroring the other P_* values
- Add the property in question to tools/convert_cr_to_oc.py, mirroring Collectible or Grab/Touchable and run the script in planet/.

Another problem is that a lot of engine functions pass around C4Def* pointers, which makes deriving definitions somewhat useless. I don't have a better idea than changing those to be C4PropList* and writing a custom check that the proplist is a definition (pPropList && pPropList->GetDef()) instead of making the binding templates do that.
Reply
Parent - - By Clonkonaut [ie] Date 2012-04-17 00:38
Is there anything that needs to remain a DefCore value or anything that we want to remain or are we heading straight towards removing defcore?

/e
I'm asking because I want to know if I have to think about anything if I'd like to change it from defcore to property.
Reply
Parent - - By Newton [de] Date 2012-04-17 08:08
I'd appreciate that, for the sake of consistency (all properties in the same file, at the same space). But then it would be irritating to write local in front of each line.
Parent - - By Zapper [de] Date 2012-04-17 08:57
if it's just about the "local" and the semicolon, we could use some syntax sugar to make that easier to write
Parent - - By Newton [de] Date 2012-04-17 16:35
Well I was thinking of making use of the Definition function.
Parent - By Zapper [de] Date 2012-04-17 17:00
How? Doesn't that just make stuff longer?
Parent - By Günther [de] Date 2012-04-17 17:47
The Definition function will be removed as soon as I figure out a solution to the matrix math problem.
Reply
Parent - By Caesar [de] Date 2012-04-17 13:52
We could also just have everything in DefCore.txt and parse all the entries that are definition members as properties.
Parent - - By Günther [de] Date 2012-04-17 17:52
You can just write
local
Name="§Name§",
ActMap={
[...]
},
Placement=1;

That's just a comma more than the Defcore format. For less, we'd need significant whitespace. While I like significant whitespace, I'm not sure that it'd be a good fit for a C-Syntax family language like C4Script.
Reply
Parent - By Luchs [de] Date 2012-04-17 18:18
Introducing..CloffeeScript!
Parent - By Newton [de] Date 2012-04-17 18:53
oh, yeah
Up Topic Development / Developer's Corner / Howto replace a Defcore entry with a property

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill