<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40617 >

2009/1/2 Marko Lindqvist:
> 2009/1/2 Yoav Luft:
>>> civserver: advmilitary.c:1183: kill_something_with: Assertion `SEA_MOVING 
>>> == utype_move_type(boattype)' failed.
>
>
>>  or at least check that the
>> movement type is not "land"?
>
>  ...this sounds like a most sensible solution.

 Mainly untested patch


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c    2008-10-27 04:13:32.000000000 +0200
+++ freeciv/ai/advmilitary.c    2009-01-04 14:35:03.000000000 +0200
@@ -1180,7 +1180,7 @@
           boattype = get_role_unit(L_FERRYBOAT, 0);
         }
       }
-      assert(SEA_MOVING == utype_move_type(boattype));
+      assert(LAND_MOVING != utype_move_type(boattype));
 
       go_by_boat = !(WARMAP_COST(ptile) <= (MIN(6, move_rate) * THRESHOLD)
                      && goto_is_sane(myunit, acity->tile, TRUE));
diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c    2008-12-28 14:53:34.000000000 +0200
+++ freeciv/server/ruleset.c    2009-01-04 14:50:00.000000000 +0200
@@ -1334,11 +1334,15 @@
       ival = find_unit_role_by_rule_name(sval);
       if (ival==L_LAST) {
         freelog(LOG_ERROR, "\"%s\" unit_type \"%s\": bad role name \"%s\".",
-                filename,
-                utype_rule_name(u),
-                sval);
+                filename, utype_rule_name(u), sval);
+      } else if ((ival == L_FERRYBOAT || ival == L_BARBARIAN_BOAT)
+                 && u->uclass->move_type == LAND_MOVING) {
+        freelog(LOG_ERROR,
+                "\"%s\" unit_type \"%s\": role \"%s\" for land moving unit.",
+                filename, utype_rule_name(u), sval);
+      } else {
+        BV_SET(u->roles, ival - L_FIRST);
       }
-      BV_SET(u->roles, ival - L_FIRST);
       assert(utype_has_role(u, ival));
     }
     free(slist);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to