[Freeciv-Dev] [patch #4894] UnitState requirement type with the test TransportDependent

2014-07-02 Thread Sveinung Kvilhaugsvik
URL:
  http://gna.org/patch/?4894

 Summary: UnitState requirement type with the test
TransportDependent
 Project: Freeciv
Submitted by: sveinung
Submitted on: Wed 02 Jul 2014 08:51:11 PM UTC
Category: None
Priority: 5 - Normal
  Status: In Progress
 Privacy: Public
 Assigned to: sveinung
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 2.6.0

___

Details:

Add the new requirement type UnitState. UnitState is for checking the
properties of a unit's state. It is intended to be like CityTile, but for
units. The first test, TransportDependent, checks if the unit can't exist
outside a transport on the tile where it currently is located. It uses
!can_unit_exist_at_tile() internally. I expect it to mostly be used with
!present. The reason for the double negative is to make the documentation
easier to write.

The purpose of this test is to later use it to move the spy action's can't
attack from terrain it can't exist on-rule to the ruleset. That will make it
easier to move actions that don't have this requirement, like Establish Trade
Route, to be controlled by action enablers.

Note that the rule I wish to move is different from the rule about regular
attacks. Regular attacks check if the tile the unit is located at is native or
not. A spy action check if the unit can exist (outside a transport) on the
tile it is located at.

Alternative approaches:
 * Change the rule to require nativity to do a Spy action. Change this to test
nativity in stead. Consequence: A spy ship in a land city would no longer be
able to act from it (unless the restriction is removed). Consistent with
normal attack.
 * Change the rule to ban actions when transported. Change this test to see if
a unit is transported. Consequence: a land spy transported over land would
have to exit its transport before it could act (unless the restriction is
removed).



___

File Attachments:


---
Date: Wed 02 Jul 2014 08:51:11 PM UTC  Name:
0002-UnitState-requirement-type-with-the-test-TransportDe.patch  Size: 13kB  
By: sveinung

http://gna.org/patch/download.php?file_id=21247

___

Reply to this item at:

  http://gna.org/patch/?4894

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4894] UnitState requirement type with the test TransportDependent

2014-07-02 Thread Sveinung Kvilhaugsvik
Update of patch #4894 (project freeciv):

  Depends on: = patch #4893


___

Reply to this item at:

  http://gna.org/patch/?4894

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4894] UnitState requirement type with the test TransportDependent

2014-07-02 Thread Sveinung Kvilhaugsvik
Follow-up Comment #1, patch #4894 (project freeciv):

Add a patch that applies on top of this meant for testing. It will enable
sabotage or targeted sabotage in Experimental depending on if the Spy/Diplomat
is on a ship or not.

(file #21248)
___

Additional Item Attachment:

File name: 0003-Ruleset-test.patchSize:1 KB


___

Reply to this item at:

  http://gna.org/patch/?4894

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4894] UnitState requirement type with the test TransportDependent

2014-07-02 Thread Emmet Hikory
Follow-up Comment #2, patch #4894 (project freeciv):

To confirm, the intent is to use the same nativity logic as is used for
attacks, so:

If the tile's terrain is native, the tile is native
If the tile contains nativity-granting extras, the tile is native.
If the tile contains a city then:
() If the unit has UCF_BUILD_ANYWHERE, then the city tile is native
() If the tile or an adjacent tile is native, then the city tile is native
() If the city belongs to a city channel, then the city tile is native

And in all cases above, tile nativity == !TransportDependent, so a spyship
(without UCF_BUILD_ANYWHERE) on a trailer (cargo: spyship's class), in a
landlocked city would be unable to act?

On double negatives: I don't think the internal representation having many
negatives matters, so long as the expression doesn't typically require
thinking in double negatives for ruleset authors.  If there is a reason to
prefer present requirements to !present requirements, use of NativeLocation
would mean much the same.

On banning actions when transported, rather than when on non-native: if there
is a UnitState requirement, having an IsTransported state may be potentially
useful anyway, even if not required to implement this specific abstraction.

___

Reply to this item at:

  http://gna.org/patch/?4894

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev