Author: sveinung
Date: Thu Dec 29 17:28:29 2016
New Revision: 34748
URL: http://svn.gna.org/viewcvs/freeciv?rev=34748&view=rev
Log:
Stop checking if "any action" has a target.
Only a specific action can be impossible because no suitable target is
found.
Reported by wotan <wotan>
See bug #25401
Modified:
trunk/server/unithand.c
Modified: trunk/server/unithand.c
URL:
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=34748&r1=34747&r2=34748&view=diff
==============================================================================
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Thu Dec 29 17:28:29 2016
@@ -802,29 +802,32 @@
bool on_native = is_native_tile(unit_type_get(punit), unit_tile(punit));
int action_custom;
- switch (action_id_get_target_kind(action_id)) {
- case ATK_CITY:
- if (target_city == NULL) {
- explnat->kind = ANEK_MISSING_TARGET;
- }
- break;
- case ATK_UNIT:
- if (target_unit == NULL) {
- explnat->kind = ANEK_MISSING_TARGET;
- }
- break;
- case ATK_UNITS:
- case ATK_TILE:
- if (target_tile == NULL) {
- explnat->kind = ANEK_MISSING_TARGET;
- }
- break;
- case ATK_SELF:
- /* No other target. */
- break;
- case ATK_COUNT:
- fc_assert(action_id_get_target_kind(action_id) != ATK_COUNT);
- break;
+ if (action_id != ACTION_ANY) {
+ /* A specific action should have a suiting target. */
+ switch (action_id_get_target_kind(action_id)) {
+ case ATK_CITY:
+ if (target_city == NULL) {
+ explnat->kind = ANEK_MISSING_TARGET;
+ }
+ break;
+ case ATK_UNIT:
+ if (target_unit == NULL) {
+ explnat->kind = ANEK_MISSING_TARGET;
+ }
+ break;
+ case ATK_UNITS:
+ case ATK_TILE:
+ if (target_tile == NULL) {
+ explnat->kind = ANEK_MISSING_TARGET;
+ }
+ break;
+ case ATK_SELF:
+ /* No other target. */
+ break;
+ case ATK_COUNT:
+ fc_assert(action_id_get_target_kind(action_id) != ATK_COUNT);
+ break;
+ }
}
if (explnat->kind == ANEK_MISSING_TARGET) {
_______________________________________________
Freeciv-commits mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-commits