SAO/CAO split

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

SAO/CAO split

by sapier » Sun Jan 08, 2012 18:54

By now all cao ans sao classes (rat/firefly/mob/luaentity) are within one big file and even use different coding styles.

I've harmonized coding styles and split up to different files for each object. This doesn't change any features but is meant to be a first step to remove c++ implemented mobs, or add a generic mob support to c++ if decided to go this way.

Yes i know the patch is quite big, reason for this is splitting requires removing code from one file adding to another thus patch is at least twice the size of changes.

EDIT1: there's a problem with this patch I'll have to fix it first so don't use it

Edit2: I've fixed it problem was cao/sao prototypes where created in random order not ensuring that factory is available when beeing created.
Patch V2
Last edited by sapier on Mon Jan 09, 2012 00:47, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Mon Jan 09, 2012 20:38

LuaEntityCAO is implemented the most recently and thus uses the preferred style. I think you are changing it back to the old style. The patch will never be merged upstream as such.
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Tue Jan 10, 2012 11:01

It's your game so I'll try to fix it even if I don't think it's a good idea because of following reasons:

1) I personaly think mixing declaration and implementatio reduce code readability drasticaly (of course that's only a oppinion)

2)This will cause SAO's beeing different from CAO's. SAO need to have declaration separated from implementation as the declarations are used in other parts of server.

3) minetest's static factory for objects needs to be created before prototype objects are created. Without declarations this can't be ensured if using differen't files for each object. There might be a solution for that but I haven't confirmed that.


If third problem can't be fixed we'll have to stay on that huge file.

EDIT1:

I've created a patch ONLY splitting content_cao.cpp into different files. As said I don't se any sense in splitting up content_sao.cpp if definitions have to stay in content_sao.h for all sao's. Not included is also the change in cmd handling replacing "cmd == 0" "cmd == 1" etc by speaking command names consistently used in sao and cao. It would have touched content_sao.cpp to be of any worth.

I'll provide that patches later if they do make any sense.

Patch CAO Split only
Last edited by sapier on Tue Jan 10, 2012 18:09, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 8 guests

cron