[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: |
Thu, 28 Aug 2003 08:20:06 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Russell Smith <address@hidden> 03/08/28 08:20:04
Modified files:
doc : ChangeLog.html
src/action : action_attack.c
src/game : game.c loadgame.c
src/include : map.h
src/map : map_fog.c
src/pathfinder : astar.c
Log message:
Fixed a couple of bugs in the pathfinder and cleaned up the Vision
table allocation.
Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.515 stratagus/doc/ChangeLog.html:1.516
--- stratagus/doc/ChangeLog.html:1.515 Wed Aug 27 06:25:45 2003
+++ stratagus/doc/ChangeLog.html Thu Aug 28 08:20:03 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.515 2003/08/27 10:25:45 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.516 2003/08/28 12:20:03 mr-russ Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
+ <li>Fixed Pathfinder bug and cleaned up vision table management (from
Russell Smith).
<li>Added Circular Goal support, Major vision and pathfinding changes
(from Russell Smith).
<li>Added flags for different building methods (from Crestez Leonard).
<li>Pressing shift will now show all waypoints, including building
outlines (from Crestez Leonard)
Index: stratagus/src/action/action_attack.c
diff -u stratagus/src/action/action_attack.c:1.79
stratagus/src/action/action_attack.c:1.80
--- stratagus/src/action/action_attack.c:1.79 Mon Aug 25 07:21:14 2003
+++ stratagus/src/action/action_attack.c Thu Aug 28 08:20:04 2003
@@ -1,4 +1,4 @@
-// _________ __ __
+// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_attack.c,v 1.79 2003/08/25 11:21:14 mr-russ Exp $
+// $Id: action_attack.c,v 1.80 2003/08/28 12:20:04 mr-russ Exp $
//@{
@@ -280,24 +280,7 @@
}
}
- if( unit->Orders[0].Action==UnitActionAttackGround
- || (!unit->Orders[0].Goal &&
- WallOnMap(unit->Orders[0].X,unit->Orders[0].Y)) ) {
- // FIXME: workaround for pathfinder problem
- // FIXME: is this true with the new pathfinding??
- DebugLevel3Fn("FIXME: Johns remove this for new orders.\n");
- unit->Orders[0].X-=unit->Orders[0].RangeX;
- unit->Orders[0].Y-=unit->Orders[0].RangeY;
- unit->Orders[0].RangeX*=2;
- unit->Orders[0].RangeY*=2;
- err=DoActionMove(unit);
- unit->Orders[0].RangeX/=2;
- unit->Orders[0].RangeY/=2;
- unit->Orders[0].X+=unit->Orders[0].RangeX;
- unit->Orders[0].Y+=unit->Orders[0].RangeY;
- } else {
- err=DoActionMove(unit);
- }
+ err=DoActionMove(unit);
// NEW return codes supported, FIXME: but johns thinks not perfect.
@@ -309,7 +292,7 @@
}
if (err==PF_REACHED) {
#else /* HIERARCHIC_PATHDFINDER */
- if( unit->Reset ) {
+ if (err==PF_REACHED) {
//
// Look if we have reached the target.
//
@@ -358,7 +341,7 @@
DebugLevel3(", target %d range %d\n" _C_ UnitNumber(goal)
_C_ unit->Orders[0].RangeX);
} else {
DebugLevel0(", (%d,%d) Tring with more range...\n" _C_
unit->Orders[0].X _C_ unit->Orders[0].Y);
- if( unit->Orders[0].RangeX < TheMap.Width
+ if( unit->Orders[0].RangeX < TheMap.Width
|| unit->Orders[0].RangeY < TheMap.Height ) {
// Try again with more range
unit->Orders[0].RangeX++;
@@ -597,9 +580,6 @@
if( CheckForTargetInRange(unit) ) {
return;
}
- HandleActionAttack(unit);
- break;
-
// FALL THROUGH
//
Index: stratagus/src/game/game.c
diff -u stratagus/src/game/game.c:1.100 stratagus/src/game/game.c:1.101
--- stratagus/src/game/game.c:1.100 Mon Aug 25 07:21:17 2003
+++ stratagus/src/game/game.c Thu Aug 28 08:20:04 2003
@@ -1,4 +1,4 @@
-// _________ __ __
+// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: game.c,v 1.100 2003/08/25 11:21:17 mr-russ Exp $
+// $Id: game.c,v 1.101 2003/08/28 12:20:04 mr-russ Exp $
//@{
@@ -282,7 +282,7 @@
return;
}
- InitMapFogOfWar(); // build tables for fog of war
+ InitVisionTable(); // build vision table for fog of war
if( filename ) {
s = NULL;
@@ -427,6 +427,7 @@
CreateMinimap(); // create minimap for pud
InitMap(); // setup draw functions
+ InitMapFogOfWar(); // build tables for fog of war
PreprocessMap(); // Adjust map for use
MapColorCycle(); // Setup color cycle
Index: stratagus/src/game/loadgame.c
diff -u stratagus/src/game/loadgame.c:1.58 stratagus/src/game/loadgame.c:1.59
--- stratagus/src/game/loadgame.c:1.58 Sun Aug 10 13:54:54 2003
+++ stratagus/src/game/loadgame.c Thu Aug 28 08:20:04 2003
@@ -1,4 +1,4 @@
-// _________ __ __
+// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: loadgame.c,v 1.58 2003/08/10 17:54:54 martinxyz Exp $
+// $Id: loadgame.c,v 1.59 2003/08/28 12:20:04 mr-russ Exp $
//@{
@@ -223,6 +223,7 @@
siod_verbose_level=4;
user_gc(SCM_BOOL_F);
siod_verbose_level=old_siod_verbose_level;
+ InitVisionTable();
gh_load(filename);
user_gc(SCM_BOOL_F);
Index: stratagus/src/include/map.h
diff -u stratagus/src/include/map.h:1.98 stratagus/src/include/map.h:1.99
--- stratagus/src/include/map.h:1.98 Mon Aug 25 07:21:17 2003
+++ stratagus/src/include/map.h Thu Aug 28 08:20:04 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map.h,v 1.98 2003/08/25 11:21:17 mr-russ Exp $
+// $Id: map.h,v 1.99 2003/08/28 12:20:04 mr-russ Exp $
#ifndef __MAP_H__
#define __MAP_H__
@@ -418,6 +418,10 @@
extern void InitMapFogOfWar(void);
/// Cleanup memory for fog of war tables
extern void CleanMapFogOfWar(void);
+ /// Builds Vision and Goal Tables
+extern void InitVisionTable(void);
+ /// Cleans up Vision and Goal Tables
+extern void FreeVisionTable(void);
//
// in map_wall.c
Index: stratagus/src/map/map_fog.c
diff -u stratagus/src/map/map_fog.c:1.99 stratagus/src/map/map_fog.c:1.100
--- stratagus/src/map/map_fog.c:1.99 Wed Aug 27 06:25:46 2003
+++ stratagus/src/map/map_fog.c Thu Aug 28 08:20:04 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_fog.c,v 1.99 2003/08/27 10:25:46 mr-russ Exp $
+// $Id: map_fog.c,v 1.100 2003/08/28 12:20:04 mr-russ Exp $
//@{
@@ -2664,18 +2664,6 @@
*/
global void InitMapFogOfWar(void)
{
- int *visionlist;
- int maxsize;
- int sizex;
- int sizey;
- int maxsearchsize;
- int i;
- int VisionTablePosition;
- int marker;
- int direction;
- int right;
- int up;
- int repeat;
#ifdef USE_OPENGL
VideoDrawFog=VideoDrawFogAlphaOpenGL;
@@ -2952,6 +2940,37 @@
}
}
#endif
+}
+
+/**
+** Cleanup the fog of war.
+*/
+global void CleanMapFogOfWar(void)
+{
+ if( FogOfWarAlphaTable ) {
+ free(FogOfWarAlphaTable);
+ FogOfWarAlphaTable=NULL;
+ }
+}
+
+/**
+** Initialize Vision and Goal Tables.
+*/
+global void InitVisionTable(void)
+{
+ int *visionlist;
+ int maxsize;
+ int sizex;
+ int sizey;
+ int maxsearchsize;
+ int i;
+ int VisionTablePosition;
+ int marker;
+ int direction;
+ int right;
+ int up;
+ int repeat;
+
// Initialize Visiontable to large size, can't be more entries than tiles.
VisionTable[0]=malloc(MaxMapWidth*MaxMapWidth*sizeof(int));
VisionTable[1]=malloc(MaxMapWidth*MaxMapWidth*sizeof(int));
@@ -3082,18 +3101,15 @@
realloc(VisionTable[1],(VisionTablePosition+2)*sizeof(int));
realloc(VisionTable[2],(VisionTablePosition+2)*sizeof(int));
#endif
+
}
/**
-** Cleanup the fog of war.
+** Clean Up Generated Vision and Goal Tables.
*/
-global void CleanMapFogOfWar(void)
+global void FreeVisionTable(void)
{
- if( FogOfWarAlphaTable ) {
- free(FogOfWarAlphaTable);
- FogOfWarAlphaTable=NULL;
- }
- // Free Vision Data
+ // Free Vision Data
if( VisionTable[0] ) {
free(VisionTable[0]);
VisionTable[0]=NULL;
@@ -3111,5 +3127,4 @@
VisionLookup=NULL;
}
}
-
//@}
Index: stratagus/src/pathfinder/astar.c
diff -u stratagus/src/pathfinder/astar.c:1.45
stratagus/src/pathfinder/astar.c:1.46
--- stratagus/src/pathfinder/astar.c:1.45 Mon Aug 25 07:21:18 2003
+++ stratagus/src/pathfinder/astar.c Thu Aug 28 08:20:04 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: astar.c,v 1.45 2003/08/25 11:21:18 mr-russ Exp $
+// $Id: astar.c,v 1.46 2003/08/28 12:20:04 mr-russ Exp $
//@{
@@ -301,33 +301,29 @@
cost=0;
j=TheMap.Fields[ex+ey*TheMap.Width].Flags&mask;
if( j && (AStarKnowUnknown
- || TheMap.Fields[ex+ey*TheMap.Width].Visible[unit->Player->Player])
) {
+ || IsMapFieldExplored(unit->Player,ex,ey)) ) {
if( j&~(MapFieldLandUnit|MapFieldAirUnit|MapFieldSeaUnit) ) {
// we can't cross fixed units and other unpassable things
return -1;
}
- if( current_cost>=AStarFixedUnitCrossingCost ) {
- // we are already crossing a fixed unit. We don't need details
+ goal=UnitCacheOnXY(ex,ey,unit->Type->UnitType);
+ if( !goal ) {
+ // Shouldn't happen, mask says there is something on this tile
+ DebugCheck( 1 );
+ return -1;
+ }
+ if( goal->Moving ) {
+ // moving unit are crossable
cost+=AStarMovingUnitCrossingCost;
} else {
- goal=UnitCacheOnXY(ex,ey,unit->Type->UnitType);
- if( !goal ) {
- // Shouldn't happen, mask says there is something on this tile
- DebugCheck( 1 );
- return -1;
- }
- if( goal->Moving ) {
- // moving unit are crossable
- cost+=AStarMovingUnitCrossingCost;
- } else {
- // for non moving unit
- cost+=AStarFixedUnitCrossingCost;
- return -1;
- }
+ // for non moving unit Always Fail
+ // FIXME: Need support for moving a fixed unit to add cost
+ return -1;
+ cost+=AStarFixedUnitCrossingCost;
}
}
- // empty tile
- if( !TheMap.Fields[ex+ey*TheMap.Width].Visible[unit->Player->Player] ) {
+ // Add cost of crossing unknown tiles if required
+ if( !IsMapFieldExplored(unit->Player,ex,ey) || AStarKnowUnknown ) {
// Tend against unknown tiles.
cost+=AStarUnknownTerrainCost;
}
@@ -373,7 +369,7 @@
CloseSet[(*num_in_close)++]=(gy-range)*TheMap.Width+x;
}
}
- if( gy+range+gh < TheMap.Height &&
CostMoveTo(unit,x,gy+range,mask,AStarFixedUnitCrossingCost)>=0 ) {
+ if( gy+range+gh < TheMap.Height &&
CostMoveTo(unit,x,gy+gh+range,mask,AStarFixedUnitCrossingCost)>=0 ) {
AStarMatrix[(gy+range+gh)*TheMap.Width+x].InGoal=1;
if( *num_in_close<Threshold ) {
CloseSet[(*num_in_close)++]=(gy+range+gh)*TheMap.Width+x;
@@ -541,7 +537,7 @@
return PF_REACHED;
}
- counter=TheMap.Width*TheMap.Height;
+ counter=TheMap.Width*TheMap.Height;
while( 1 ) {
//
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus doc/ChangeLog.html src/action/action_...,
Russell Smith <=