[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src/clone unit.c
From: |
Russell Smith |
Subject: |
[Stratagus-CVS] stratagus/src/clone unit.c |
Date: |
Wed, 29 Oct 2003 08:00:33 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/10/29 08:00:33
Modified files:
src/clone : unit.c
Log message:
Acidental commit, reverting to working version
Patches:
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.322 stratagus/src/clone/unit.c:1.323
--- stratagus/src/clone/unit.c:1.322 Wed Oct 29 07:58:37 2003
+++ stratagus/src/clone/unit.c Wed Oct 29 08:00:32 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.322 2003/10/29 12:58:37 mr-russ Exp $
+// $Id: unit.c,v 1.323 2003/10/29 13:00:32 mr-russ Exp $
//@{
@@ -1751,8 +1751,6 @@
int x;
int y;
int i;
- int w;
- int h;
int mask;
//FIXME: vladi: this debug check fails when used for teleporting...
@@ -1770,8 +1768,6 @@
mask = UnitMovementMask(unit);
- w = unit->Type->TileWidth;
- h = unit->Type->TileHeight;
if (heading < LookingNE || heading > LookingNW) {
x += addx - 1;
@@ -1794,28 +1790,28 @@
for (;;) {
startw:
for (i = addy; i--; ++y) {
- if (CanMoveToMask(x, y, w, h,mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
goto found;
}
}
++addx;
starts:
for (i = addx; i--; ++x) {
- if (CanMoveToMask(x, y, w, h,mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
goto found;
}
}
++addy;
starte:
for (i = addy; i--; --y) {
- if (CanMoveToMask(x, y, w, h,mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
goto found;
}
}
++addx;
startn:
for (i = addx; i--; --x) {
- if (CanMoveToMask(x, y, w, h,mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
goto found;
}
}
@@ -1846,8 +1842,6 @@
int besty;
int bestd;
int mask;
- int w;
- int h;
int n;
DebugLevel3Fn("%d\n" _C_ UnitNumber(unit));
@@ -1865,8 +1859,6 @@
DebugCheck(x == -1 || y == -1);
mask = UnitMovementMask(unit);
- w = unit->Type->TileWidth;
- h = unit->Type->TileHeight;
bestd = 99999;
#ifdef DEBUG
@@ -1877,7 +1869,7 @@
--x;
for (;;) {
for (i = addy; i--; ++y) { // go down
- if (CanMoveToMask(x, y, w, h, mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
n = MapDistance(gx, gy, x, y);
DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n);
if (n < bestd) {
@@ -1889,7 +1881,7 @@
}
++addx;
for (i = addx; i--; ++x) { // go right
- if (CanMoveToMask(x, y, w, h, mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
n = MapDistance(gx, gy, x, y);
DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n);
if (n < bestd) {
@@ -1901,7 +1893,7 @@
}
++addy;
for (i = addy; i--; --y) { // go up
- if (CanMoveToMask(x, y, w, h, mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
n = MapDistance(gx, gy, x, y);
DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n);
if (n < bestd) {
@@ -1913,7 +1905,7 @@
}
++addx;
for (i = addx; i--; --x) { // go left
- if (CanMoveToMask(x, y, w, h, mask)) {
+ if (CheckedCanMoveToMask(x, y, mask)) {
n = MapDistance(gx, gy, x, y);
DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n);
if (n < bestd) {
@@ -2322,13 +2314,13 @@
continue;
}
// Look if found what was required.
- if (rvresult ? CanMoveToMask(x, y, 1, 1, resmask) :
!CanMoveToMask(x, y, 1, 1, resmask)) {
+ if (rvresult ? CanMoveToMask(x, y, resmask) : !CanMoveToMask(x,
y, resmask)) {
*px = x;
*py = y;
DebugLevel3("Found it! %X %X\n" _C_
TheMap.Fields[x+y*TheMap.Width].Flags _C_ resmask);
return 1;
}
- if (CanMoveToMask(x, y, 1, 1, movemask)) { // reachable
+ if (CanMoveToMask(x, y, movemask)) { // reachable
*m = 1;
points[wp].X = x; // push the point
points[wp].Y = y;
@@ -2390,8 +2382,6 @@
int ep;
int i;
int w;
- int uw;
- int uh;
int n;
unsigned char* m;
unsigned char* matrix;
@@ -2419,8 +2409,6 @@
matrix += w + w + 2;
// Unit movement mask
mask = UnitMovementMask(unit);
- uw = unit->Type->TileWidth;
- uh = unit->Type->TileHeight;
// Ignore all units along the way. Might seem wierd, but otherwise
// peasants would lock at a mine with a lot of workers.
mask &= ~(MapFieldLandUnit | MapFieldSeaUnit | MapFieldAirUnit);
@@ -2472,7 +2460,7 @@
}
}
- if (CanMoveToMask(x, y, uw, uh, mask)) { // reachable
+ if (CanMoveToMask(x, y, mask)) { // reachable
*m = 1;
points[wp].X = x; // push the point
points[wp].Y = y;
@@ -2538,8 +2526,6 @@
int ep;
int i;
int w;
- int uw;
- int uh;
int nodes_searched;
unsigned char* m;
unsigned char* matrix;
@@ -2561,8 +2547,6 @@
matrix += w + w + 2;
// Unit movement mask
mask = UnitMovementMask(unit);
- uw = unit->Type->TileWidth;
- uh = unit->Type->TileHeight;
// Ignore all units along the way. Might seem wierd, but otherwise
// peasants would lock at a mine with a lot of workers.
mask &= ~(MapFieldLandUnit | MapFieldSeaUnit | MapFieldAirUnit |
MapFieldBuilding);
@@ -2606,7 +2590,7 @@
DebugLevel3("Found a resource deposit at %d,%d\n" _C_ x _C_
y);
return depot;
}
- if (CanMoveToMask(x, y, uw, uh, mask)) { // reachable
+ if (CanMoveToMask(x, y, mask)) { // reachable
*m = 1;
points[wp].X = x; // push the point
points[wp].Y = y;
@@ -3759,7 +3743,7 @@
int RunStart;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.322 2003/10/29 12:58:37
mr-russ Exp $\n\n");
+ CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.323 2003/10/29 13:00:32
mr-russ Exp $\n\n");
//
// Local variables