Ticket #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: |
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
Change History
comment:2 Changed 14 months ago by historic_bruno
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 from CanUseFormation.
- 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 Changed 14 months ago by leper
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.

Formations can also be specified by adding
to PlayerData.