This small patch makes it possible to drag a line of rearm pad
production similar to how walls and defenses can be built by dragging
the production with the mouse. It also removes the obligatory empty
tile between rearm pads.

The reason should be obvious - it is currently very tedious to build
massive VTOL rearm fields.

Posted here since wz2100.net is down.

  - Per
Index: src/display.c
===================================================================
--- src/display.c	(revision 7604)
+++ src/display.c	(working copy)
@@ -565,7 +565,8 @@
 				    && sBuildDetails.psStats->ref < (REF_STRUCTURE_START + REF_RANGE))
 				{
 					if ((((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_WALL
-					     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE)
+					     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE
+					     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_REARM_PAD)
 					    && !isLasSat((STRUCTURE_STATS *)sBuildDetails.psStats))
 					{
 						wallDrag.x2 = mouseTileX;
@@ -608,7 +609,8 @@
 		    && sBuildDetails.psStats->ref < (REF_STRUCTURE_START + REF_RANGE))
 		{
 			if ((((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_WALL
-			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE)
+			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE
+			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_REARM_PAD)
 			    && !isLasSat((STRUCTURE_STATS *)sBuildDetails.psStats))
 			{
 				wallDrag.x1 = wallDrag.x2 = mouseTileX;
@@ -686,7 +688,8 @@
 		if(buildState == BUILD3D_VALID)
 		{
 			if ((((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_WALL
-			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE)
+			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_DEFENSE
+			     || ((STRUCTURE_STATS *)sBuildDetails.psStats)->type == REF_REARM_PAD)
 			    && !isLasSat((STRUCTURE_STATS *)sBuildDetails.psStats))
 			{
 				int dx, dy;
Index: src/action.c
===================================================================
--- src/action.c	(revision 7604)
+++ src/action.c	(working copy)
@@ -1860,7 +1860,7 @@
 										psDroid->player,
 										false))
 				{
-					debug( LOG_NEVER, "DACTION_MOVETOBUILD: !validLocation");
+					objTrace(psDroid->id, "DACTION_MOVETOBUILD: !validLocation");
 					psDroid->action = DACTION_NONE;
 				}
 				else
@@ -1870,9 +1870,9 @@
 					psDroid->actionPoints = 0;
 				}
 			}
-			else if(  (psDroid->order == DORDER_LINEBUILD||psDroid->order==DORDER_BUILD)
-					&&(psStructStats->type == REF_WALL   || psStructStats->type == REF_WALLCORNER ||
-					psStructStats->type == REF_DEFENSE))
+			else if ((psDroid->order == DORDER_LINEBUILD || psDroid->order==DORDER_BUILD)
+			         && (psStructStats->type == REF_WALL || psStructStats->type == REF_WALLCORNER ||
+			             psStructStats->type == REF_DEFENSE || psStructStats->type == REF_REARM_PAD))
 			{
 				// building a wall.
 				MAPTILE* const psTile = mapTile(map_coord(psDroid->orderX), map_coord(psDroid->orderY));
Index: src/structure.c
===================================================================
--- src/structure.c	(revision 7604)
+++ src/structure.c	(working copy)
@@ -4063,7 +4063,7 @@
 		}
 		//if we're dragging the wall/defense we need to check along the current dragged size
 		if (wallDrag.status != DRAG_INACTIVE
-			&& (psBuilding->type == REF_WALL || psBuilding->type == REF_DEFENSE)
+			&& (psBuilding->type == REF_WALL || psBuilding->type == REF_DEFENSE || psBuilding->type == REF_REARM_PAD)
 			&& !isLasSat(psBuilding))
 		{
 				UWORD    dx,dy;
@@ -4318,6 +4318,7 @@
 					if (!(psBuilding->type == REF_DEFENSE ||
 						psBuilding->type == REF_WALL ||
 						psBuilding->type == REF_WALLCORNER ||
+						psBuilding->type == REF_REARM_PAD ||
 						psBuilding->type == REF_MISSILE_SILO))
 					{
 						/*need to check there is one tile between buildings*/
@@ -4470,8 +4471,7 @@
 			BOOL    validCombi;
 
 			//defense and missile silo's can be built next to anything so don't need to check
-			if (!(psBuilding->type == REF_DEFENSE || psBuilding->type ==
-				REF_MISSILE_SILO))
+			if (!(psBuilding->type == REF_DEFENSE || psBuilding->type == REF_MISSILE_SILO || psBuilding->type == REF_REARM_PAD))
 			{
 				for (psDroid = apsDroidLists[player]; psDroid; psDroid = psDroid->psNext)
 				{
@@ -4488,6 +4488,8 @@
 						{
 							if (psDroid->asOrderList[order].order == DORDER_BUILD)
 							{
+								STRUCTURE_STATS *orderTarget = (STRUCTURE_STATS *)psDroid->asOrderList[order].psOrderTarget;
+
 								validCombi = false;
 								if (((STRUCTURE_STATS *)psDroid->asOrderList[order].
 									psOrderTarget)->type == REF_DEFENSE ||
@@ -4498,8 +4500,7 @@
 								}
 								//walls can be built next to walls and defence
 								if ((psBuilding->type == REF_WALL || psBuilding->type == REF_WALLCORNER)
-					&& (((STRUCTURE_STATS *)psDroid->asOrderList[order].psOrderTarget)->type == REF_WALL
-					|| ((STRUCTURE_STATS *)psDroid->asOrderList[order].psOrderTarget)->type == REF_WALLCORNER))
+								    && (orderTarget->type == REF_WALL || orderTarget->type == REF_WALLCORNER))
 								{
 									validCombi = true;
 								}
Index: src/edit3d.c
===================================================================
--- src/edit3d.c	(revision 7604)
+++ src/edit3d.c	(working copy)
@@ -288,7 +288,8 @@
 BOOL found3DBuildLocTwo(UDWORD *px1, UDWORD *py1, UDWORD *px2, UDWORD *py2)
 {
 	if ( (((STRUCTURE_STATS *)sBuildDetails.psStats)->type != REF_WALL &&
-		  ((STRUCTURE_STATS *)sBuildDetails.psStats)->type != REF_DEFENSE) ||
+		  ((STRUCTURE_STATS *)sBuildDetails.psStats)->type != REF_DEFENSE &&
+		  ((STRUCTURE_STATS *)sBuildDetails.psStats)->type != REF_REARM_PAD) ||
 		wallDrag.status != DRAG_RELEASED)
 	{
 		return false;
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to