#1234 closed enhancement (fixed)
[PATCH] Read formations from json files
Reported by: | leper | Owned by: | leper |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 10 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
As noted in GetCivFormations in utility_functions.js the formations should probably be read from json files.
The patch also checks if a unit can actually be moved in a formation. If a unit doesn't support a specific formation it just executes the task as if it is walking alone.
This removes the use of scatter and the use of formations for female citizens as in #601.
Formations like Wedge, Testudo, Syntagma, Phalanx (and others) that are only supported by some units should be removed from template_unit.xml and added to the respective units only.
Attachments (2)
Change History (8)
comment:1 by , 12 years ago
Milestone: | Backlog → Alpha 10 |
---|
by , 12 years ago
Attachment: | #1234-2012-03-21.patch added |
---|
comment:2 by , 12 years ago
I haven't looked at this in detail, but a few comments:
- I think you should add the civ-specific formations to the existing civ data files instead of creating a set of new ones.
Identity.js:128
: I'd recommend checking the length of the array instead of comparing with an empty array. The function should be renamed somehow to distinguish it fromCanUseFormation
.- For females and other units that don't support formations, would it be cleaner to simply disable the
Formations
element in the template? Like this:<Formations disable=""/>
because it's an optional element anyway. Then make sure we properly handle that case.
comment:3 by , 12 years ago
It is now reading from the civ data files and using <Formations disable=""/>
is working, the patch is also using a length check in Identity.js but I can't think of a name other than CanUseFormations
because that is what the function does. CanUseFormation
also takes one parameter but if you can think of a better name for one of those I will change it.
by , 12 years ago
Attachment: | #1234-2012-03-22.patch added |
---|
comment:4 by , 12 years ago
Keywords: | patch added |
---|
comment:6 by , 12 years ago
Keywords: | review removed |
---|
Some formations should be removed from template_unit.xml
and only added to the templates that can really use them.
Formations can also be specified by adding
to PlayerData.