#2447: ActioninRange et al
-------------------------------+-------------------------------------------
        Reporter:  littleppig  |        Type:  to-do (no feature requests!)
          Status:  new         |    Priority:  minor
       Milestone:              |   Component:  other
  unspecified                  |    Keywords:
         Version:              |  Blocked By:
  unspecified                  |
Operating System:  All/Non-    |
  Specific                     |
        Blocking:              |
-------------------------------+-------------------------------------------
 At this moment the code have 3 functions for testing range:

 ActioninRange
 ActioninAttackRange
 ActionInsideminRange

 first checks a droid is in range to shoot,
 second checks if a droid is in range to shoot (paying attention to its
 Range option (optimum Range, long range and short range)
 third checks if it is inside min range.

 Since the idea of those functions are all transforming a distance
 (object/target) to a state (can attack, can't attack because too close,
 can't attack because to far), I propose a new enum:
 InRange, CloseInRange, FarInRange.

 When to test if a droid is able to fire, use if(ActioninRange == InRange).
 When to test if a droid needs to close range, use if(ActioninRange ==
 FarInRange).
 When to test if a droid needs to increase distance, use if(ActioninRange
 == CloseInRange).

 where ActioninRange is used with a switch for the (optimum Range, long
 range and short range), just like the function ActioninAttackRange.

 I don't know if this is the best approach, but my main point is the idea
 of state: The min range is a circumference of radius Rmin, the max range
 is a circumference of radius Rmax, and there are basically 3 states, too
 close, to far or in range.

 What do you think?

-- 
Ticket URL: <http://developer.wz2100.net/ticket/2447>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to