[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus doc/ChangeLog.html src/action/action_...
From: |
Russell Smith |
Subject: |
[Stratagus-CVS] stratagus doc/ChangeLog.html src/action/action_... |
Date: |
Fri, 17 Oct 2003 02:04:33 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/10/17 02:04:33
Modified files:
doc : ChangeLog.html
src/action : action_attack.c action_board.c action_build.c
action_follow.c action_move.c action_resource.c
action_spellcast.c action_still.c command.c
src/clone : unit.c
src/include : unit.h
src/pathfinder : pathfinder.c
src/unit : ccl_unit.c
Log message:
Fixed Bug #6006: Crash saving building not built yet
Orders now have Width, Height and Range.
Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.554 stratagus/doc/ChangeLog.html:1.555
--- stratagus/doc/ChangeLog.html:1.554 Sun Oct 12 01:34:04 2003
+++ stratagus/doc/ChangeLog.html Fri Oct 17 02:04:27 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.554 2003/10/12 05:34:04 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.555 2003/10/17 06:04:27 mr-russ Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
+ <li>Fixed Bug #6006: Crash saving building not built yet (from Russell
Smith).
<li>Fixed Bug: Failed Building Crashes Engine (from Russell Smith).
<li>Remove old Master Server Code, began implementing a new one (from
Russell Smith).
<li>Finished Support for units with MinAttackRange >1 Moving away to
attacker (from Russell Smith).
Index: stratagus/src/action/action_attack.c
diff -u stratagus/src/action/action_attack.c:1.87
stratagus/src/action/action_attack.c:1.88
--- stratagus/src/action/action_attack.c:1.87 Thu Oct 9 19:15:27 2003
+++ stratagus/src/action/action_attack.c Fri Oct 17 02:04:28 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_attack.c,v 1.87 2003/10/09 23:15:27 mr-russ Exp $
+// $Id: action_attack.c,v 1.88 2003/10/17 06:04:28 mr-russ Exp $
//@{
@@ -129,7 +129,7 @@
unit->Orders[0].X = goal->X + goal->Type->TileWidth / 2;
unit->Orders[0].Y = goal->Y + goal->Type->TileHeight / 2;
unit->Orders[0].MinRange = 0;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 0;
+ unit->Orders[0].Range = 0;
DebugLevel0Fn("destroyed unit %d\n" _C_ UnitNumber(goal));
RefsDebugCheck(!goal->Refs);
@@ -146,7 +146,7 @@
unit->Orders[0].X = goal->X + goal->Type->TileWidth / 2;
unit->Orders[0].Y = goal->Y + goal->Type->TileHeight / 2;
unit->Orders[0].MinRange = 0;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 0;
+ unit->Orders[0].Range = 0;
RefsDebugCheck(!goal->Refs);
--goal->Refs;
@@ -213,8 +213,7 @@
goal->Refs++;
unit->Orders[0].Goal = goal;
unit->Orders[0].MinRange = unit->Type->MinAttackRange;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY =
- unit->Stats->AttackRange;
+ unit->Orders[0].Range = unit->Stats->AttackRange;
unit->Orders[0].X = unit->Orders[0].Y = -1;
unit->SubAction |= WEAK_TARGET; // weak target
NewResetPath(unit);
@@ -242,7 +241,7 @@
unit->SavedOrder.X = goal->X + goal->Type->TileWidth / 2;
unit->SavedOrder.Y = goal->Y + goal->Type->TileHeight / 2;
unit->SavedOrder.MinRange = 0;
- unit->SavedOrder.RangeX = unit->SavedOrder.RangeY = 0;
+ unit->SavedOrder.Range = 0;
unit->SavedOrder.Goal = NoUnitP;
}
}
@@ -338,18 +337,17 @@
UnitNumber(unit));
if (goal) {
DebugLevel3(", target %d range %d\n" _C_ UnitNumber(goal) _C_
- unit->Orders[0].RangeX);
+ unit->Orders[0].Range);
} else {
//
// When attack-moving we have to allow a bigger range
//
DebugLevel3(", (%d,%d) Tring with more range...\n" _C_
unit->Orders[0].X _C_ unit->Orders[0].Y);
- if (unit->Orders[0].RangeX < TheMap.Width ||
- unit->Orders[0].RangeY < TheMap.Height) {
+ if (unit->Orders[0].Range < TheMap.Width ||
+ unit->Orders[0].Range < TheMap.Height) {
// Try again with more range
- unit->Orders[0].RangeX++;
- unit->Orders[0].RangeY++;
+ unit->Orders[0].Range++;
return;
}
}
@@ -462,7 +460,7 @@
unit->SavedOrder.X = temp->X + temp->Type->TileWidth / 2;
unit->SavedOrder.Y = temp->Y + temp->Type->TileHeight / 2;
unit->SavedOrder.MinRange = 0;
- unit->SavedOrder.RangeX = unit->SavedOrder.RangeY = 0;
+ unit->SavedOrder.Range = 0;
unit->SavedOrder.Goal = NoUnitP;
}
}
@@ -474,8 +472,7 @@
unit->Orders[0].Goal = goal;
unit->Orders[0].X = unit->Orders[0].Y = -1;
unit->Orders[0].MinRange = unit->Type->MinAttackRange;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY =
- unit->Stats->AttackRange;
+ unit->Orders[0].Range = unit->Stats->AttackRange;
NewResetPath(unit);
unit->SubAction |= WEAK_TARGET;
@@ -501,7 +498,7 @@
unit->SavedOrder.X = goal->X + goal->Type->TileWidth /
2;
unit->SavedOrder.Y = goal->Y + goal->Type->TileHeight /
2;
unit->SavedOrder.MinRange = 0;
- unit->SavedOrder.RangeX = unit->SavedOrder.RangeY = 0;
+ unit->SavedOrder.Range = 0;
unit->SavedOrder.Goal = NoUnitP;
}
}
@@ -526,7 +523,7 @@
unit->SavedOrder.X = temp->X + temp->Type->TileWidth / 2;
unit->SavedOrder.Y = temp->Y + temp->Type->TileHeight / 2;
unit->SavedOrder.MinRange = 0;
- unit->SavedOrder.RangeX = unit->SavedOrder.RangeY = 0;
+ unit->SavedOrder.Range = 0;
unit->SavedOrder.Goal = NoUnitP;
}
}
@@ -569,8 +566,8 @@
*/
global void HandleActionAttack(Unit* unit)
{
- DebugLevel3Fn("Attack %d r %d,%d\n" _C_ UnitNumber(unit) _C_
- unit->Orders->RangeX _C_ unit->Orders->RangeY);
+ DebugLevel3Fn("Attack %d range %d\n" _C_ UnitNumber(unit) _C_
+ unit->Orders->Range);
switch (unit->SubAction) {
//
Index: stratagus/src/action/action_board.c
diff -u stratagus/src/action/action_board.c:1.42
stratagus/src/action/action_board.c:1.43
--- stratagus/src/action/action_board.c:1.42 Fri Oct 3 16:31:24 2003
+++ stratagus/src/action/action_board.c Fri Oct 17 02:04:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_board.c,v 1.42 2003/10/03 20:31:24 jsalmon3 Exp $
+// $Id: action_board.c,v 1.43 2003/10/17 06:04:29 mr-russ Exp $
//@{
@@ -68,8 +68,7 @@
i = DoActionMove(unit);
// We have to reset a lot, or else they will circle each other and stuff.
if (x != unit->X || y != unit->Y) {
- unit->Orders[0].RangeX = 1;
- unit->Orders[0].RangeY = 1;
+ unit->Orders[0].Range = 1;
NewResetPath(unit);
}
// New code has this as default.
@@ -132,8 +131,7 @@
// it's there. This is why we reset the search. The transporter
// should be a lot closer now, so it's not as bad as it seems.
unit->SubAction = 0;
- unit->Orders[0].RangeX = 1;
- unit->Orders[0].RangeY = 1;
+ unit->Orders[0].Range = 1;
//Uhh wait a bit.
unit->Wait = 10;
@@ -258,10 +256,9 @@
//
// Try with a bigger range.
//
- if (unit->Orders[0].RangeX <= TheMap.Width ||
- unit->Orders[0].RangeX <= TheMap.Height) {
- unit->Orders[0].RangeX++;
- unit->Orders[0].RangeY++;
+ if (unit->Orders[0].Range <= TheMap.Width ||
+ unit->Orders[0].Range <= TheMap.Height) {
+ unit->Orders[0].Range++;
unit->SubAction--;
}
}
Index: stratagus/src/action/action_build.c
diff -u stratagus/src/action/action_build.c:1.98
stratagus/src/action/action_build.c:1.99
--- stratagus/src/action/action_build.c:1.98 Sun Oct 12 01:34:05 2003
+++ stratagus/src/action/action_build.c Fri Oct 17 02:04:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_build.c,v 1.98 2003/10/12 05:34:05 mr-russ Exp $
+// $Id: action_build.c,v 1.99 2003/10/17 06:04:29 mr-russ Exp $
//@{
@@ -102,14 +102,6 @@
type = unit->Orders[0].Type;
- // Create the building to find a valid path to any part of it.
- // Only create if we didn't already.
- if (unit->Orders[0].Goal == NoUnitP) {
- unit->Orders[0].Goal = MakeUnit(type, NULL);
- unit->Orders[0].Goal->X = unit->Orders[0].X;
- unit->Orders[0].Goal->Y = unit->Orders[0].Y;
- }
-
switch (DoActionMove(unit)) { // reached end-point?
case PF_UNREACHABLE:
//
@@ -129,10 +121,6 @@
}
unit->Orders[0].Action = UnitActionStill;
- // Release Temporary Building
- UnitClearOrders(unit->Orders[0].Goal);
- ReleaseUnit(unit->Orders[0].Goal);
- unit->Orders[0].Goal = NULL;
unit->SubAction = 0;
if (unit->Selected) { // update display for new action
SelectedUnitChanged();
@@ -171,10 +159,6 @@
}
unit->Orders[0].Action = UnitActionStill;
- // Release Temporary Building
- UnitClearOrders(unit->Orders[0].Goal);
- ReleaseUnit(unit->Orders[0].Goal);
- unit->Orders[0].Goal = NULL;
unit->SubAction = 0;
if (unit->Selected) { // update display for new action
SelectedUnitChanged();
@@ -204,10 +188,6 @@
}
unit->Orders[0].Action = UnitActionStill;
- // Release Temporary Building
- UnitClearOrders(unit->Orders[0].Goal);
- ReleaseUnit(unit->Orders[0].Goal);
- unit->Orders[0].Goal = NULL;
unit->SubAction = 0;
if (unit->Selected) { // update display for new action
SelectedUnitChanged();
@@ -226,10 +206,6 @@
}
unit->Orders[0].Action = UnitActionStill;
- // Release Temporary Building
- UnitClearOrders(unit->Orders[0].Goal);
- ReleaseUnit(unit->Orders[0].Goal);
- unit->Orders[0].Goal = NULL;
unit->SubAction = 0;
if (unit->Selected) { // update display for new action
SelectedUnitChanged();
@@ -238,10 +214,7 @@
}
PlayerSubUnitType(unit->Player, type);
-
- build = unit->Orders[0].Goal;
- unit->Orders[0].Goal = NoUnitP;
- AssignUnitToPlayer(build, unit->Player);
+ build=MakeUnit(type,unit->Player);
build->Constructed = 1;
build->CurrentSightRange = 0;
PlaceUnit(build, x, y);
@@ -300,7 +273,7 @@
unit->Orders[0].Action = UnitActionRepair;
unit->Orders[0].Goal = build;
unit->Orders[0].X = unit->Orders[0].Y = -1;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY =
unit->Type->RepairRange;
+ unit->Orders[0].Range = unit->Type->RepairRange;
unit->SubAction = 0;
unit->Wait = 1;
RefsDebugCheck(!build->Refs);
Index: stratagus/src/action/action_follow.c
diff -u stratagus/src/action/action_follow.c:1.31
stratagus/src/action/action_follow.c:1.32
--- stratagus/src/action/action_follow.c:1.31 Fri Oct 3 16:31:24 2003
+++ stratagus/src/action/action_follow.c Fri Oct 17 02:04:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_follow.c,v 1.31 2003/10/03 20:31:24 jsalmon3 Exp $
+// $Id: action_follow.c,v 1.32 2003/10/17 06:04:29 mr-russ Exp $
//@{
@@ -103,8 +103,8 @@
if ((goal->X == unit->Orders[0].X && goal->Y == unit->Orders[0].Y)) {
unit->Reset = 1;
unit->Wait = 10;
- if ((unit->Orders[0].RangeX > 1) || (unit->Orders[0].RangeY > 1)) {
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 1;
+ if (unit->Orders[0].Range > 1) {
+ unit->Orders[0].Range = 1;
unit->SubAction = 0;
}
return;
@@ -124,10 +124,9 @@
//
// Some tries to reach the goal
//
- if (unit->Orders[0].RangeX <= TheMap.Width ||
- unit->Orders[0].RangeX <= TheMap.Height) {
- unit->Orders[0].RangeX++;
- unit->Orders[0].RangeY++;
+ if (unit->Orders[0].Range <= TheMap.Width ||
+ unit->Orders[0].Range <= TheMap.Height) {
+ unit->Orders[0].Range++;
break;
}
// FALL THROUGH
Index: stratagus/src/action/action_move.c
diff -u stratagus/src/action/action_move.c:1.69
stratagus/src/action/action_move.c:1.70
--- stratagus/src/action/action_move.c:1.69 Tue Oct 7 08:03:38 2003
+++ stratagus/src/action/action_move.c Fri Oct 17 02:04:29 2003
@@ -21,7 +21,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// $Id: action_move.c,v 1.69 2003/10/07 12:03:38 martinxyz Exp $
+// $Id: action_move.c,v 1.70 2003/10/17 06:04:29 mr-russ Exp $
//@{
@@ -279,10 +279,9 @@
//
// Some tries to reach the goal
//
- if (unit->Orders[0].RangeX <= TheMap.Width ||
- unit->Orders[0].RangeX <= TheMap.Height) {
- unit->Orders[0].RangeX++;
- unit->Orders[0].RangeY++;
+ if (unit->Orders[0].Range <= TheMap.Width ||
+ unit->Orders[0].Range <= TheMap.Height) {
+ unit->Orders[0].Range++;
break;
}
// FALL THROUGH
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.58
stratagus/src/action/action_resource.c:1.59
--- stratagus/src/action/action_resource.c:1.58 Sat Oct 11 15:07:22 2003
+++ stratagus/src/action/action_resource.c Fri Oct 17 02:04:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_resource.c,v 1.58 2003/10/11 19:07:22 n0body Exp $
+// $Id: action_resource.c,v 1.59 2003/10/17 06:04:29 mr-russ Exp $
//@{
@@ -547,7 +547,7 @@
unit->Orders[0].Goal = depot;
RefsDebugCheck(!depot->Refs);
++depot->Refs;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 1;
+ unit->Orders[0].Range = 1;
unit->Orders[0].X = unit->Orders[0].Y = -1;
unit->SubAction = SUB_MOVE_TO_DEPOT;
NewResetPath(unit);
@@ -707,7 +707,7 @@
unit->Orders[0].Goal = goal;
RefsDebugCheck(!goal->Refs);
++goal->Refs;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 1;
+ unit->Orders[0].Range = 1;
unit->Orders[0].X = unit->Orders[0].Y = -1;
} else {
DropOutOnSide(unit, LookingW, depot->Type->TileWidth,
depot->Type->TileHeight);
Index: stratagus/src/action/action_spellcast.c
diff -u stratagus/src/action/action_spellcast.c:1.34
stratagus/src/action/action_spellcast.c:1.35
--- stratagus/src/action/action_spellcast.c:1.34 Thu Oct 9 16:54:35 2003
+++ stratagus/src/action/action_spellcast.c Fri Oct 17 02:04:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_spellcast.c,v 1.34 2003/10/09 20:54:35 jsalmon3 Exp $
+// $Id: action_spellcast.c,v 1.35 2003/10/17 06:04:30 mr-russ Exp $
/*
** This is inherited from action_attack.c, actually spell casting will
@@ -112,7 +112,7 @@
goal = unit->Orders[0].Goal;
if (goal && MapDistanceBetweenUnits(unit, goal) <=
- unit->Orders[0].RangeX) {
+ unit->Orders[0].Range) {
// there is goal and it is in range
unit->State = 0;
@@ -125,7 +125,7 @@
unit->SubAction++; // cast the spell
return;
} else if (!goal && MapDistanceToUnit(unit->Orders[0].X,
- unit->Orders[0].Y, unit) <= unit->Orders[0].RangeX) {
+ unit->Orders[0].Y, unit) <= unit->Orders[0].Range) {
// there is no goal and target spot is in range
unit->State = 0;
if (!unit->Type->Building) {
@@ -165,9 +165,9 @@
int flags;
const SpellType* spell;
- DebugLevel3Fn("%d %d,%d+%d+%d\n" _C_
+ DebugLevel3Fn("%d %d,%d+%d\n" _C_
UnitNumber(unit) _C_ unit->Orders[0].X _C_ unit->Orders[0].Y _C_
- unit->Orders[0].RangeX _C_ unit->Orders[0].RangeY);
+ unit->Orders[0].Range);
switch (unit->SubAction) {
case 0: // first entry.
Index: stratagus/src/action/action_still.c
diff -u stratagus/src/action/action_still.c:1.72
stratagus/src/action/action_still.c:1.73
--- stratagus/src/action/action_still.c:1.72 Fri Oct 3 18:42:30 2003
+++ stratagus/src/action/action_still.c Fri Oct 17 02:04:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_still.c,v 1.72 2003/10/03 22:42:30 jsalmon3 Exp $
+// $Id: action_still.c,v 1.73 2003/10/17 06:04:30 mr-russ Exp $
//@{
@@ -146,7 +146,7 @@
unit->Orders[0].Action = UnitActionMove;
DebugCheck(unit->Orders[0].Goal);
unit->Orders[0].Goal = NoUnitP;
- unit->Orders[0].RangeX = unit->Orders[0].RangeY = 0;
+ unit->Orders[0].Range = 0;
unit->Orders[0].X = x;
unit->Orders[0].Y = y;
unit->State = 0;
@@ -179,7 +179,7 @@
DebugCheck(unit->SavedOrder.Action != UnitActionStill);
DebugCheck(unit->SavedOrder.Goal);
unit->SavedOrder.Action = UnitActionAttack;
- unit->SavedOrder.RangeX = unit->SavedOrder.RangeY = 0;
+ unit->SavedOrder.Range = 0;
unit->SavedOrder.X = unit->X;
unit->SavedOrder.Y = unit->Y;
unit->SavedOrder.Goal = NoUnitP;
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.108
stratagus/src/action/command.c:1.109
--- stratagus/src/action/command.c:1.108 Tue Oct 7 10:16:24 2003
+++ stratagus/src/action/command.c Fri Oct 17 02:04:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: command.c,v 1.108 2003/10/07 14:16:24 mr-russ Exp $
+// $Id: command.c,v 1.109 2003/10/17 06:04:30 mr-russ Exp $
//@{
@@ -265,13 +265,13 @@
order->X = dest->X + dest->Type->TileWidth / 2;
order->Y = dest->Y + dest->Type->TileHeight / 2;
order->Goal = NoUnitP;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
} else {
order->X = order->Y = -1;
order->Goal = dest;
RefsDebugCheck(!dest->Refs);
dest->Refs++;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
}
order->Type = NULL;
order->Arg1 = NULL;
@@ -314,7 +314,7 @@
order->Goal = NoUnitP;
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
order->Type = NULL;
order->Arg1 = NULL;
#ifdef HIERARCHIC_PATHFINDER
@@ -368,19 +368,21 @@
order->X = dest->X + dest->Type->TileWidth / 2;
order->Y = dest->Y + dest->Type->TileHeight / 2;
order->Goal = NoUnitP;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
+ order->Width = order->Height = 0;
} else {
order->X = order->Y = -1;
+ order->Width = order->Height = 0;
order->Goal = dest;
RefsDebugCheck(!dest->Refs);
dest->Refs++;
- order->RangeX = order->RangeY = unit->Type->RepairRange;
+ order->Range = unit->Type->RepairRange;
}
} else {
order->X = x;
order->Y = y;
order->Goal = NoUnitP;
- order->RangeX = order->RangeY = unit->Type->RepairRange;
+ order->Range = 0;
}
order->Type = NULL;
order->Arg1 = NULL;
@@ -431,27 +433,27 @@
order->X = attack->X + attack->Type->TileWidth / 2;
order->Y = attack->Y + attack->Type->TileHeight / 2;
order->Goal = NoUnitP;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
} else {
// Removed, Dying handled by action routine.
order->X = order->Y = -1;
order->Goal = attack;
RefsDebugCheck(!attack->Refs);
attack->Refs++;
- order->RangeX = order->RangeY = unit->Stats->AttackRange;
+ order->Range = unit->Stats->AttackRange;
order->MinRange = unit->Type->MinAttackRange;
}
} else if (WallOnMap(x,y)) {
// FIXME: look into action_attack.c about this ugly problem
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = unit->Stats->AttackRange;
+ order->Range = unit->Stats->AttackRange;
order->MinRange = unit->Type->MinAttackRange;
order->Goal = NoUnitP;
} else {
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
order->Goal = NoUnitP;
}
order->Type = NULL;
@@ -495,7 +497,7 @@
order->Action = UnitActionAttackGround;
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = unit->Stats->AttackRange;
+ order->Range = unit->Stats->AttackRange;
order->MinRange = unit->Type->MinAttackRange;
order->Goal = NoUnitP;
order->Type = NULL;
@@ -543,7 +545,7 @@
order->Goal = NoUnitP;
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
order->Type = NULL;
DebugCheck(unit->X & ~0xFFFF || unit->Y & ~0xFFFF);
// BUG-ALERT: encode source into arg1 as two 16 bit values!
@@ -589,7 +591,7 @@
order->Goal = dest;
RefsDebugCheck(!dest->Refs);
dest->Refs++;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
order->Type = NULL;
order->Arg1 = NULL;
}
@@ -631,7 +633,7 @@
RefsDebugCheck(!what->Refs);
what->Refs++;
}
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
order->Type = NULL;
order->Arg1 = NULL;
}
@@ -666,16 +668,15 @@
order->Action = UnitActionBuild;
order->Goal = NoUnitP;
- order->IsRect = 1;
order->X = x;
order->Y = y;
+ order->Width = what->TileWidth;
+ order->Height = what->TileHeight;
if (what->BuilderOutside) {
- order->RangeX = unit->Type->RepairRange;
- order->RangeY = unit->Type->RepairRange;
+ order->Range = unit->Type->RepairRange;
} else {
// If building inside, but be next to stop
- order->RangeX = 1;
- order->RangeY = 1;
+ order->Range = 1;
}
order->Type = what;
order->Arg1 = NULL;
@@ -750,7 +751,7 @@
order->X = nx;
order->Y = ny;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
order->Goal = NoUnitP;
order->Type = NULL;
order->Arg1 = NULL;
@@ -795,7 +796,7 @@
order->Goal = dest;
RefsDebugCheck(!dest->Refs);
dest->Refs++;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
order->Type = NULL;
order->Arg1 = NULL;
}
@@ -842,7 +843,7 @@
RefsDebugCheck(!goal->Refs);
goal->Refs++;
}
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
order->Type = NULL;
order->Arg1 = NULL;
}
@@ -1203,23 +1204,23 @@
order->X = dest->X + dest->Type->TileWidth / 2;
order->Y = dest->Y + dest->Type->TileHeight / 2;
order->Goal = NoUnitP;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
} else {
order->X = order->Y = -1;
order->Goal = dest;
RefsDebugCheck(!dest->Refs);
dest->Refs++;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
}
} else if (WallOnMap(x,y) || ForestOnMap(x,y) || RockOnMap(x,y)) {
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = 1;
+ order->Range = 1;
order->Goal = NoUnitP;
} else {
order->X = x;
order->Y = y;
- order->RangeX = order->RangeY = 0;
+ order->Range = 0;
order->Goal = NoUnitP;
}
order->Type = NULL;
@@ -1274,7 +1275,7 @@
}
order->Action = UnitActionSpellCast;
- order->RangeX = order->RangeY = spell->Range;
+ order->Range = spell->Range;
if (dest) {
//
// Destination could be killed.
@@ -1283,11 +1284,11 @@
//
if (dest->Destroyed) {
// FIXME: where check if spell needs an unit as destination?
- order->X = dest->X + dest->Type->TileWidth / 2 - order->RangeX;
- order->Y = dest->Y + dest->Type->TileHeight / 2 - order->RangeY;
+ order->X = dest->X + dest->Type->TileWidth / 2 - order->Range;
+ order->Y = dest->Y + dest->Type->TileHeight / 2 - order->Range;
order->Goal = NoUnitP;
- order->RangeX <<= 1;
- order->RangeY <<= 1;
+ order->Range <<= 1;
+ order->Range <<= 1;
} else {
order->X = order->Y = -1;
order->Goal = dest;
@@ -1295,11 +1296,10 @@
dest->Refs++;
}
} else {
- order->X = x-order->RangeX;
- order->Y = y-order->RangeY;
+ order->X = x-order->Range;
+ order->Y = y-order->Range;
order->Goal = NoUnitP;
- order->RangeX <<= 1;
- order->RangeY <<= 1;
+ order->Range <<= 1;
}
order->Type = NULL;
order->Arg1 = spell;
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.309 stratagus/src/clone/unit.c:1.310
--- stratagus/src/clone/unit.c:1.309 Fri Oct 17 00:56:20 2003
+++ stratagus/src/clone/unit.c Fri Oct 17 02:04:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.309 2003/10/17 04:56:20 mr-russ Exp $
+// $Id: unit.c,v 1.310 2003/10/17 06:04:30 mr-russ Exp $
//@{
@@ -3419,8 +3419,11 @@
default:
DebugLevel0Fn("Unknown action in order\n");
}
- CLprintf(file," flags %d",order->Flags);
- CLprintf(file," range (%d %d)",order->RangeX,order->RangeY);
+ CLprintf(file," flags %d", order->Flags);
+ CLprintf(file," range %d", order->Range);
+ CLprintf(file," width %d", order->Width);
+ CLprintf(file," height %d", order->Height);
+ CLprintf(file," min-range %d", order->MinRange);
if( order->Goal ) {
if (order->Goal->Destroyed) {
/* this unit is destroyed so it's not in the global unit
@@ -3715,7 +3718,7 @@
int InRun, RunStart;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.309 2003/10/17 04:56:20
mr-russ Exp $\n\n");
+ CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.310 2003/10/17 06:04:30
mr-russ Exp $\n\n");
//
// Local variables
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.218 stratagus/src/include/unit.h:1.219
--- stratagus/src/include/unit.h:1.218 Tue Oct 7 20:06:42 2003
+++ stratagus/src/include/unit.h Fri Oct 17 02:04:31 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.218 2003/10/08 00:06:42 jsalmon3 Exp $
+// $Id: unit.h,v 1.219 2003/10/17 06:04:31 mr-russ Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -432,10 +432,10 @@
typedef struct _order_ {
unsigned char Action; /// global action
unsigned char Flags; /// Order flags (unused)
- int RangeX; /// How near in X direction
- int RangeY; /// How near in Y direction
+ int Range; /// How far away
unsigned int MinRange; /// How far away minimum
- unsigned char IsRect:1; /// For goal as a square, not circle
+ unsigned char Width; /// Goal Width (used when Goal is not)
+ unsigned char Height; /// Goal Height (used when Goal is not)
Unit* Goal; /// goal of the order (if any)
int X; /// or X tile coordinate of
destination
Index: stratagus/src/pathfinder/pathfinder.c
diff -u stratagus/src/pathfinder/pathfinder.c:1.56
stratagus/src/pathfinder/pathfinder.c:1.57
--- stratagus/src/pathfinder/pathfinder.c:1.56 Thu Oct 9 19:15:29 2003
+++ stratagus/src/pathfinder/pathfinder.c Fri Oct 17 02:04:31 2003
@@ -28,7 +28,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: pathfinder.c,v 1.56 2003/10/09 23:15:29 mr-russ Exp $
+// $Id: pathfinder.c,v 1.57 2003/10/17 06:04:31 mr-russ Exp $
//@{
@@ -474,24 +474,16 @@
gh=unit->Orders[0].Goal->Type->TileHeight-1;
gx=unit->Orders[0].Goal->X;
gy=unit->Orders[0].Goal->Y;
- maxrange=unit->Orders[0].RangeX;
+ maxrange=unit->Orders[0].Range;
minrange=unit->Orders[0].MinRange;
- DebugCheck( unit->Orders[0].RangeX != unit->Orders[0].RangeY );
} else {
// Take care of non square goals :)
// If goal is non square, range states a non-existant goal rather
// than a tile.
- if( unit->Orders[0].IsRect ) {
- gw = unit->Orders[0].RangeX;
- gh = unit->Orders[0].RangeY;
- maxrange=0;
- minrange=0;
- } else {
- gw=0;
- gh=0;
- maxrange=unit->Orders[0].RangeX;
- minrange=unit->Orders[0].MinRange;
- }
+ gw = unit->Orders[0].Width;
+ gh = unit->Orders[0].Height;
+ maxrange=unit->Orders[0].Range;
+ minrange=unit->Orders[0].MinRange;
gx=unit->Orders[0].X;
gy=unit->Orders[0].Y;
}
Index: stratagus/src/unit/ccl_unit.c
diff -u stratagus/src/unit/ccl_unit.c:1.68 stratagus/src/unit/ccl_unit.c:1.69
--- stratagus/src/unit/ccl_unit.c:1.68 Thu Oct 2 12:15:05 2003
+++ stratagus/src/unit/ccl_unit.c Fri Oct 17 02:04:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unit.c,v 1.68 2003/10/02 16:15:05 jsalmon3 Exp $
+// $Id: ccl_unit.c,v 1.69 2003/10/17 06:04:32 mr-russ Exp $
//@{
@@ -224,11 +224,17 @@
order->Flags = gh_scm2int(value);
} else if (gh_eq_p(value, gh_symbol2scm("range"))) {
- sublist = gh_car(list);
+ order->Range = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("min-range"))) {
+ order->MinRange = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("width"))) {
+ order->Width = gh_scm2int(gh_car(list));
+ list = gh_cdr(list);
+ } else if (gh_eq_p(value, gh_symbol2scm("height"))) {
+ order->Height = gh_scm2int(gh_car(list));
list = gh_cdr(list);
- order->RangeX = gh_scm2int(gh_car(sublist));
- order->RangeY = gh_scm2int(gh_cadr(sublist));
-
} else if (gh_eq_p(value, gh_symbol2scm("goal"))) {
char* str;
int slot;