It would be nice if anyone interested could go through the code and tell me what to do better.
Most parts of the code are setting up the length, placement angle and indentation of the wall elements appropriate to the template and the predefined fortress types, so this can be skipped and it's not much left to read.
The main part I'm interested in is what types of variables should be what type of object (list/dictionary/object).
For example the fortress class is not really needed for now but could proof useful for custom fortresses later.
Until now a dictionary would do.
I don't know how to define an object inside an object because 'this' always points to the 'most top' object.
But this would be better IMO since the 'wallElement' and 'fortress' objects are not very useful without the wallTool and only take namespace.
Some variables are not that well names like 'centerX' and 'centerZ' because it's only X/Z directed if the angle of placement is 0.
And it's more an offset then a center coordinate, since it's the X/Z distance between the (unindented) position of the first wall element to the center.
Perhaps I should do it exactly the other way around (vector from point of placement to the first wall element) and call it offsetX/offsetZ...
Sounds good at the moment.
And should I define the 'wallStyles' and 'fortressTypes', which take a lot of space, somewhere else?
I find it makes the main 'wallTool' code harder to read because it splits the code for functionality.
Don't exactly know where to put it...
Also the getCenter function is really useful but I don't know when to use it exactly by default. (Returns the 'Center of mass' of the fortress)
I do it when setting the wall to a preset fortress, though, if custom fortresses have been added to the 'fortressTypes' and have a 'center' defined manually, it will be overridden until you turn the 'recalculateFortressCenter' property to 'false'.
That might not be very handy (though I doubt many would search for the center by hand ^^. And you still can simply use the 'wall' property and set the center vars manually).
The existing 'wallTypes' are not very well documented yet.
But I think they are chosen wisely. Wait to see the other fortress styles...
A circular wall tool was requested and I will add it soon.
It will have the functionality for generic bending of walls. Edit: Not to the ground but to one and another wall element so a point is enclosed.
I guess tomorrow I will finalize the other wall styles and there will be some more screenies.
Edited by FeXoR, 15 March 2012 - 08:44 AM.