ship_cmd.c
branch0.4
changeset 10014 9157e384afb6
parent 10011 66a5c07b4bae
--- a/ship_cmd.c	Sat May 20 15:54:46 2006 +0000
+++ b/ship_cmd.c	Sat May 20 17:11:09 2006 +0000
@@ -824,7 +824,7 @@
 /** Build a ship.
  * @param x,y tile coordinates of depot where ship is built
  * @param p1 ship type being built (engine)
- * @param p2 unused
+ * @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
  */
 int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
@@ -847,8 +847,9 @@
 	if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
 
 	v = AllocateVehicle();
-	if (v == NULL || IsOrderPoolFull() ||
-			(unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships)
+	unit_num = (HASBIT(p2, 0) == true) ? 0 : GetFreeUnitNumber(VEH_Ship);
+
+	if (v == NULL || IsOrderPoolFull() || unit_num > _patches.max_ships)
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 	if (flags & DC_EXEC) {