Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9324) startunits and sea units
Home

[Freeciv-Dev] (PR#9324) startunits and sea units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9324) startunits and sea units
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sat, 28 Aug 2004 10:01:07 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9324 >


  Placing sea units on land will certainly cause lots of bugreports, if 
we leave it to next release as it is. As temporary solution, attached 
patch simply disallows sea units as startunits.

  1) One cannot any longer put ferryboats (f) into startunits array with 
'set startunits'. I left later handling of satrtunits array as it is 
(ferryboat handling is there already when they are allowed again)
  2) There is check in place_starting_unit() that prevents sea unit 
creation as startunit for any role.

  2 could be much more elegant. It could report each unittype illegal 
only once (currently reports every individual creation attempt). It 
could also iterate over role unittypes to find out if there is also land 
moving types available.
  But this is meant to be quick and temporary fix, so I'm not putting 
too much effort into it.


  - Caz

diff -Nurd -X.diff_ignore freeciv/server/gamehand.c freeciv/server/gamehand.c
--- freeciv/server/gamehand.c   2004-08-27 15:50:10.500000000 +0300
+++ freeciv/server/gamehand.c   2004-08-28 19:27:47.453125000 +0300
@@ -106,6 +106,19 @@
     if (utype == U_LAST) {
       utype = get_role_unit(role, 0);
     }
+
+    /* We cannot currently handle sea units as start units. */
+
+    if (unit_types[utype].move_type == SEA_MOVING) {
+      freelog(LOG_ERROR, _("Sea moving start units are not yet supported, "
+                           "%s not created."),
+              unit_types[utype].name);
+      notify_player(pplayer, _("Sea moving start units are not yet supported. "
+                               "Nobody gets %s."),
+                    unit_types[utype].name);
+      return;
+    }
+
     (void) create_unit(pplayer, x, y, utype, FALSE, 0, -1);
   }
 }
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2004-08-27 15:50:12.000000000 +0300
+++ freeciv/server/stdinhand.c  2004-08-28 19:32:00.437500000 +0300
@@ -467,7 +467,8 @@
                "    x   = Explorer (eg. Explorer)\n"
                "    k   = Gameloss (eg. King)\n"
                "    s   = Diplomat (eg. Diplomat)\n"
-               "    f   = Ferryboat (eg. Trireme)\n"
+         /* Ferryboats disabled for now, we cannot handle sea moving units. */
+               /* "    f   = Ferryboat (eg. Trireme)\n" */
                "    d   = Ok defense unit (eg. Warriors)\n"
                "    D   = Good defense unit (eg. Phalanx)\n"
                "    a   = Fast attack unit (eg. Horsemen)\n"
@@ -5215,7 +5216,9 @@
       have_founder = TRUE;
       continue;
     }
-    if (strchr("cwxksfdDaA", start_units[i])) {
+    /* Add 'f' to valid characters when you want to enable
+       ferryboats as startunits. */
+    if (strchr("cwxksdDaA", start_units[i])) {
       continue;
     }
 

[Prev in Thread] Current Thread [Next in Thread]