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

> [EMAIL PROTECTED] - Fri Aug 08 21:02:08 2008]:
> 
>  Editor should not allow adding units or cities to dead player.

Patch attached.


-----------------------------------------------------------------------
パチュアッタチュ!
diff --git a/server/edithand.c b/server/edithand.c
index 619f64b..c11f174 100644
--- a/server/edithand.c
+++ b/server/edithand.c
@@ -366,6 +366,16 @@ void handle_edit_unit_create(struct connection *pc, int owner,
     return;
   }
 
+  if (!pplayer->is_alive) {
+    notify_conn(pc->self, ptile, E_BAD_COMMAND,
+                _("Cannot create a unit of type %s at (%d, %d) "
+                  "owned by player %d (%s) because this player "
+                  "is dead."),
+                utype_name_translation(punittype),
+                x, y, owner, player_name(pplayer));
+    return;
+  }
+
   if (is_non_allied_unit_tile(ptile, pplayer)
       || (tile_city(ptile)
           && !pplayers_allied(pplayer, tile_owner(ptile)))) {
@@ -514,6 +524,13 @@ void handle_edit_city_create(struct connection *pc,
 
   }
 
+  if (!pplayer->is_alive) {
+    notify_conn(pc->self, ptile, E_BAD_COMMAND,
+                _("Cannot create a city at (%d, %d) owned by "
+                  "player %d (%s) because this player is dead."),
+                x, y, owner, player_name(pplayer));
+    return;
+  }
 
   if (!city_can_be_built_here(ptile, NULL)) {
     notify_conn(pc->self, ptile, E_BAD_COMMAND,
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to