Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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)

#1234-2012-03-21.patch (16.2 KB ) - added by leper 12 years ago.
#1234-2012-03-22.patch (18.4 KB ) - added by leper 12 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by leper, 12 years ago

Milestone: BacklogAlpha 10

Formations can also be specified by adding

"Formations": ["Scatter", "Box", "Battle Line"]

to PlayerData.

by leper, 12 years ago

Attachment: #1234-2012-03-21.patch added

comment:2 by historic_bruno, 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 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 by leper, 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 leper, 12 years ago

Attachment: #1234-2012-03-22.patch added

comment:4 by Kieran P, 12 years ago

Keywords: patch added

comment:5 by leper, 12 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 11735:

Read formations from civ JSON files. Fixes #1234, #601.

comment:6 by leper, 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.

Note: See TracTickets for help on using tickets.