[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus doc/ChangeLog.html src/clone/mainloop...
From: |
ludovic pollet |
Subject: |
[Stratagus-CVS] stratagus doc/ChangeLog.html src/clone/mainloop... |
Date: |
Wed, 19 Nov 2003 21:22:31 -0500 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: ludovic pollet <address@hidden> 03/11/19 21:22:30
Modified files:
doc : ChangeLog.html
src/clone : mainloop.c unit.c
src/game : game.c loadgame.c
src/include : pathfinder.h
src/map : map_wall.c map_wood.c
src/pathfinder : Module.make astar.c ccl_pathfinder.c
pathfinder.c
Added files:
src/pathfinder : splitter.h splitter_local.h splitter.c
splitter_debug.c splitter_lowlevel.c
splitter_zoneset.c
Log message:
Added a map splitter for fast PlaceReachable.
Patches:
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.581 stratagus/doc/ChangeLog.html:1.582
--- stratagus/doc/ChangeLog.html:1.581 Sun Nov 16 01:50:38 2003
+++ stratagus/doc/ChangeLog.html Wed Nov 19 21:22:27 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.581 2003/11/16 06:50:38 mr-russ Exp $
+---- $Id: ChangeLog.html,v 1.582 2003/11/20 02:22:27 pludov Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
+ <li>Add a map splitter for fast PlaceReachable.
<li>Food, replaced with Supply/Demand. Buildings support demand (from
Russell Smith).
<li>Fixed Bug #6230: Hack to detect wc2 swamp tileset (from Russell Smith).
<li>AI tries to move its own units when blocked (from Pollet Ludovic).
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.160
stratagus/src/clone/mainloop.c:1.161
--- stratagus/src/clone/mainloop.c:1.160 Mon Nov 17 14:14:28 2003
+++ stratagus/src/clone/mainloop.c Wed Nov 19 21:22:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.160 2003/11/17 19:14:28 nehalmistry Exp $
+// $Id: mainloop.c,v 1.161 2003/11/20 02:22:29 pludov Exp $
//@{
@@ -67,6 +67,7 @@
#include "settings.h"
#include "commands.h"
#include "cdaudio.h"
+#include "pathfinder.h"
#ifdef USE_SDLCD
#include "SDL.h"
@@ -800,6 +801,9 @@
++GameCycle;
MultiPlayerReplayEachCycle();
NetworkCommands(); // Get network commands
+#ifdef MAP_REGIONS
+ MapSplitterEachCycle();
+#endif // MAP_REGIONS
UnitActions(); // handle units
MissileActions(); // handle missiles
PlayersEachCycle(); // handle players
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.339 stratagus/src/clone/unit.c:1.340
--- stratagus/src/clone/unit.c:1.339 Tue Nov 18 12:56:22 2003
+++ stratagus/src/clone/unit.c Wed Nov 19 21:22:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.339 2003/11/18 17:56:22 pludov Exp $
+// $Id: unit.c,v 1.340 2003/11/20 02:22:29 pludov Exp $
//@{
@@ -520,6 +520,12 @@
}
#endif
+#ifdef MAP_REGIONS
+ if (type->Building) {
+ MapSplitterTilesOccuped(x, y, x + type->TileWidth - 1, y +
type->TileHeight - 1);
+ }
+#endif
+
x += unit->Type->TileWidth / 2;
y += unit->Type->TileHeight / 2;
@@ -709,6 +715,16 @@
}
#endif
+#ifdef MAP_REGIONS
+ //
+ // Update map splitting.
+ //
+ if (type->Building) {
+ MapSplitterTilesCleared(unit->X, unit->Y,
+ unit->X + type->TileWidth - 1, unit->Y + type->TileHeight - 1);
+ }
+#endif
+
DebugLevel3Fn("%d %p %p\n" _C_ UnitNumber(unit) _C_ unit _C_ unit->Next);
UnitCacheRemove(unit);
// UnitCache uses Next, need to set next again
@@ -3851,7 +3867,7 @@
int RunStart;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.339 2003/11/18 17:56:22
pludov Exp $\n\n");
+ CLprintf(file, ";;; MODULE: units $Id: unit.c,v 1.340 2003/11/20 02:22:29
pludov Exp $\n\n");
//
// Local variables
Index: stratagus/src/game/game.c
diff -u stratagus/src/game/game.c:1.113 stratagus/src/game/game.c:1.114
--- stratagus/src/game/game.c:1.113 Mon Nov 17 14:14:31 2003
+++ stratagus/src/game/game.c Wed Nov 19 21:22:29 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: game.c,v 1.113 2003/11/17 19:14:31 nehalmistry Exp $
+// $Id: game.c,v 1.114 2003/11/20 02:22:29 pludov Exp $
//@{
@@ -523,7 +523,9 @@
#ifdef HIERARCHIC_PATHFINDER
PfHierInitialize();
#endif // HIERARCHIC_PATHFINDER
-
+#ifdef MAP_REGIONS
+ MapSplitterInit();
+#endif
//
// FIXME: The palette is loaded after the units are created.
// FIXME: This loops fixes the colors of the units.
Index: stratagus/src/game/loadgame.c
diff -u stratagus/src/game/loadgame.c:1.70 stratagus/src/game/loadgame.c:1.71
--- stratagus/src/game/loadgame.c:1.70 Mon Nov 17 14:14:31 2003
+++ stratagus/src/game/loadgame.c Wed Nov 19 21:22:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: loadgame.c,v 1.70 2003/11/17 19:14:31 nehalmistry Exp $
+// $Id: loadgame.c,v 1.71 2003/11/20 02:22:29 pludov Exp $
//@{
@@ -111,6 +111,9 @@
#ifdef HIERARCHIC_PATHFINDER
PfHierClean ();
#endif
+#ifdef MAP_REGIONS
+ MapSplitterClean();
+#endif
FreeAStar();
//
@@ -255,6 +258,10 @@
InitModules();
LoadModules();
+
+#ifdef MAP_REGIONS
+ MapSplitterInit();
+#endif
GameCycle = game_cycle;
SelectionChanged();
Index: stratagus/src/include/pathfinder.h
diff -u stratagus/src/include/pathfinder.h:1.35
stratagus/src/include/pathfinder.h:1.36
--- stratagus/src/include/pathfinder.h:1.35 Thu Oct 23 14:38:35 2003
+++ stratagus/src/include/pathfinder.h Wed Nov 19 21:22:29 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: pathfinder.h,v 1.35 2003/10/23 18:38:35 n0body Exp $
+// $Id: pathfinder.h,v 1.36 2003/11/20 02:22:29 pludov Exp $
#ifndef __PATH_FINDER_H__
#define __PATH_FINDER_H__
@@ -100,7 +100,7 @@
/// Return distance to unit.
extern int UnitReachable(Unit* unit,Unit* dst,int range);
-extern int PlaceReachable(Unit* src,int x,int y,int w,int h,int range);
+extern int PlaceReachable(Unit* src,int x,int y,int w,int h,int minrange,int
maxrange);
//
// in astar.c
@@ -127,5 +127,9 @@
#ifdef HIERARCHIC_PATHFINDER
#include "../pathfinder/hierarchical.h"
#endif /* HIERARCHIC_PATHFINDER */
+
+#ifdef MAP_REGIONS
+#include "../pathfinder/splitter.h"
+#endif /* MAP_REGIONS */
#endif // !__PATH_FINDER_H__
Index: stratagus/src/map/map_wall.c
diff -u stratagus/src/map/map_wall.c:1.26 stratagus/src/map/map_wall.c:1.27
--- stratagus/src/map/map_wall.c:1.26 Sat Sep 27 16:04:24 2003
+++ stratagus/src/map/map_wall.c Wed Nov 19 21:22:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_wall.c,v 1.26 2003/09/27 20:04:24 jsalmon3 Exp $
+// $Id: map_wall.c,v 1.27 2003/11/20 02:22:30 pludov Exp $
//@{
@@ -40,7 +40,7 @@
#include "map.h"
#include "minimap.h"
#include "player.h"
-#ifdef HIERARCHIC_PATHFINDER
+#if defined(HIERARCHIC_PATHFINDER) || defined(MAP_REGIONS)
#include "pathfinder.h"
#endif // HIERARCHIC_PATHFINDER
@@ -370,6 +370,9 @@
#ifdef HIERARCHIC_PATHFINDER
PfHierMapChangedCallback (x, y, x, y);
#endif
+#ifdef MAP_REGIONS
+ MapSplitterTilesCleared(x, y, x, y);
+#endif
} else {
TheMap.Fields[x + y * TheMap.Width].Value = v - damage;
MapFixWallTile(x, y);
Index: stratagus/src/map/map_wood.c
diff -u stratagus/src/map/map_wood.c:1.28 stratagus/src/map/map_wood.c:1.29
--- stratagus/src/map/map_wood.c:1.28 Sat Sep 27 16:04:24 2003
+++ stratagus/src/map/map_wood.c Wed Nov 19 21:22:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: map_wood.c,v 1.28 2003/09/27 20:04:24 jsalmon3 Exp $
+// $Id: map_wood.c,v 1.29 2003/11/20 02:22:30 pludov Exp $
//@{
@@ -47,7 +47,7 @@
#include "minimap.h"
#include "player.h"
#include "editor.h"
-#ifdef HIERARCHIC_PATHFINDER
+#if defined(HIERARCHIC_PATHFINDER) || defined(MAP_REGIONS)
#include "pathfinder.h"
#endif
@@ -348,6 +348,9 @@
}
#ifdef HIERARCHIC_PATHFINDER
PfHierMapChangedCallback (x, y, x, y);
+#endif
+#ifdef MAP_REGIONS
+ MapSplitterTilesCleared(x, y, x, y);
#endif
}
Index: stratagus/src/pathfinder/Module.make
diff -u stratagus/src/pathfinder/Module.make:1.1
stratagus/src/pathfinder/Module.make:1.2
--- stratagus/src/pathfinder/Module.make:1.1 Fri Nov 29 15:58:17 2002
+++ stratagus/src/pathfinder/Module.make Wed Nov 19 21:22:30 2003
@@ -1,3 +1,3 @@
-SRC += src/pathfinder/astar.c src/pathfinder/avl_tree.c
src/pathfinder/ccl_pathfinder.c src/pathfinder/floodfill.c
src/pathfinder/hierarchical.c src/pathfinder/pathfinder.c
src/pathfinder/pf_goal.c src/pathfinder/pf_high_open.c
src/pathfinder/pf_highlevel.c src/pathfinder/pf_low_open.c
src/pathfinder/pf_lowlevel.c src/pathfinder/regid.c src/pathfinder/region.c
src/pathfinder/region_groups.c src/pathfinder/region_set.c
-HDRS += src/pathfinder/avl_tree.h src/pathfinder/hierarchical.h
src/pathfinder/pf_goal.h src/pathfinder/pf_high_open.h
src/pathfinder/pf_highlevel.h src/pathfinder/pf_low_open.h
src/pathfinder/pf_lowlevel.h src/pathfinder/regid.h src/pathfinder/region.h
src/pathfinder/region_groups.h src/pathfinder/region_set.h
src/pathfinder/types.h
-OBJ += src/pathfinder/$(OBJDIR)/astar.o src/pathfinder/$(OBJDIR)/avl_tree.o
src/pathfinder/$(OBJDIR)/ccl_pathfinder.o src/pathfinder/$(OBJDIR)/floodfill.o
src/pathfinder/$(OBJDIR)/hierarchical.o src/pathfinder/$(OBJDIR)/pathfinder.o
src/pathfinder/$(OBJDIR)/pf_goal.o src/pathfinder/$(OBJDIR)/pf_high_open.o
src/pathfinder/$(OBJDIR)/pf_highlevel.o src/pathfinder/$(OBJDIR)/pf_low_open.o
src/pathfinder/$(OBJDIR)/pf_lowlevel.o src/pathfinder/$(OBJDIR)/regid.o
src/pathfinder/$(OBJDIR)/region.o src/pathfinder/$(OBJDIR)/region_groups.o
src/pathfinder/$(OBJDIR)/region_set.o
+SRC += src/pathfinder/astar.c src/pathfinder/avl_tree.c
src/pathfinder/ccl_pathfinder.c src/pathfinder/floodfill.c
src/pathfinder/hierarchical.c src/pathfinder/pathfinder.c
src/pathfinder/pf_goal.c src/pathfinder/pf_high_open.c
src/pathfinder/pf_highlevel.c src/pathfinder/pf_low_open.c
src/pathfinder/pf_lowlevel.c src/pathfinder/regid.c src/pathfinder/region.c
src/pathfinder/region_groups.c src/pathfinder/region_set.c
src/pathfinder/splitter.c src/pathfinder/splitter_zoneset.c
src/pathfinder/splitter_lowlevel.c src/pathfinder/splitter_debug.c
+HDRS += src/pathfinder/avl_tree.h src/pathfinder/hierarchical.h
src/pathfinder/pf_goal.h src/pathfinder/pf_high_open.h
src/pathfinder/pf_highlevel.h src/pathfinder/pf_low_open.h
src/pathfinder/pf_lowlevel.h src/pathfinder/regid.h src/pathfinder/region.h
src/pathfinder/region_groups.h src/pathfinder/region_set.h
src/pathfinder/types.h src/pathfinder/splitter.c
src/pathfinder/splitter_zoneset.c src/pathfinder/splitter_lowlevel.c
src/pathfinder/splitter_debug.c
+OBJ += src/pathfinder/$(OBJDIR)/astar.o src/pathfinder/$(OBJDIR)/avl_tree.o
src/pathfinder/$(OBJDIR)/ccl_pathfinder.o src/pathfinder/$(OBJDIR)/floodfill.o
src/pathfinder/$(OBJDIR)/hierarchical.o src/pathfinder/$(OBJDIR)/pathfinder.o
src/pathfinder/$(OBJDIR)/pf_goal.o src/pathfinder/$(OBJDIR)/pf_high_open.o
src/pathfinder/$(OBJDIR)/pf_highlevel.o src/pathfinder/$(OBJDIR)/pf_low_open.o
src/pathfinder/$(OBJDIR)/pf_lowlevel.o src/pathfinder/$(OBJDIR)/regid.o
src/pathfinder/$(OBJDIR)/region.o src/pathfinder/$(OBJDIR)/region_groups.o
src/pathfinder/$(OBJDIR)/region_set.o src/pathfinder/$(OBJDIR)/splitter.o
src/pathfinder/$(OBJDIR)/splitter_zoneset.o
src/pathfinder/$(OBJDIR)/splitter_lowlevel.o
src/pathfinder/$(OBJDIR)/splitter_debug.o
Index: stratagus/src/pathfinder/astar.c
diff -u stratagus/src/pathfinder/astar.c:1.55
stratagus/src/pathfinder/astar.c:1.56
--- stratagus/src/pathfinder/astar.c:1.55 Fri Nov 14 12:35:52 2003
+++ stratagus/src/pathfinder/astar.c Wed Nov 19 21:22:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: astar.c,v 1.55 2003/11/14 17:35:52 pludov Exp $
+// $Id: astar.c,v 1.56 2003/11/20 02:22:30 pludov Exp $
//@{
@@ -528,6 +528,13 @@
int num_in_close;
int mask;
+#ifdef MAP_REGIONS
+ // Abort in few cycle lot of astar invocations
+ if (! PlaceReachable(unit, gx, gy, gw, gh, minrange, maxrange)) {
+ return PF_UNREACHABLE;
+ }
+#endif
+
DebugLevel3Fn("%d %d,%d->%d,%d\n" _C_
UnitNumber(unit) _C_
unit->X _C_ unit->Y _C_ x _C_ y);
Index: stratagus/src/pathfinder/ccl_pathfinder.c
diff -u stratagus/src/pathfinder/ccl_pathfinder.c:1.23
stratagus/src/pathfinder/ccl_pathfinder.c:1.24
--- stratagus/src/pathfinder/ccl_pathfinder.c:1.23 Wed Nov 12 15:25:41 2003
+++ stratagus/src/pathfinder/ccl_pathfinder.c Wed Nov 19 21:22:30 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_pathfinder.c,v 1.23 2003/11/12 20:25:41 jsalmon3 Exp $
+// $Id: ccl_pathfinder.c,v 1.24 2003/11/20 02:22:30 pludov Exp $
//@{
@@ -195,6 +195,17 @@
{
return SCM_UNSPECIFIED;
}
+
+#ifdef MAP_REGIONS
+global void MapSplitterDebug(void);
+
+local SCM CclDebugRegions(SCM flag __attribute__((unused)))
+{
+ MapSplitterDebug();
+ return SCM_UNSPECIFIED;
+}
+#endif // MAP_REGIONS
+
#elif defined(USE_LUA)
#endif
#endif
@@ -207,6 +218,9 @@
{
#if defined(USE_GUILE) || defined(USE_SIOD)
gh_new_procedureN("a-star",CclAStar);
+#ifdef MAP_REGIONS
+ gh_new_procedureN("debug-regions",CclDebugRegions);
+#endif // MAP_REGIONS
gh_new_procedure1_0 ("pf-show-regids!", CclPfHierShowRegIds);
gh_new_procedure1_0 ("pf-show-groupids!", CclPfHierShowGroupIds);
#elif defined(USE_LUA)
Index: stratagus/src/pathfinder/pathfinder.c
diff -u stratagus/src/pathfinder/pathfinder.c:1.59
stratagus/src/pathfinder/pathfinder.c:1.60
--- stratagus/src/pathfinder/pathfinder.c:1.59 Tue Nov 11 04:57:33 2003
+++ stratagus/src/pathfinder/pathfinder.c Wed Nov 19 21:22:30 2003
@@ -28,7 +28,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: pathfinder.c,v 1.59 2003/11/11 09:57:33 mr-russ Exp $
+// $Id: pathfinder.c,v 1.60 2003/11/20 02:22:30 pludov Exp $
//@{
@@ -74,7 +74,6 @@
*/
global unsigned char Matrix[(MaxMapWidth+2)*(MaxMapHeight+3)+2]; ///
Path matrix
local unsigned int LocalMatrix[MaxMapWidth*MaxMapHeight];
-global int PlaceReachable(Unit* src,int x,int y,int w,int h,int range);
/*----------------------------------------------------------------------------
-- Functions
@@ -368,6 +367,7 @@
-- PATH-FINDER USE
----------------------------------------------------------------------------*/
+#ifndef MAP_REGIONS
/**
** Can the unit 'src' reach the place x,y.
**
@@ -376,11 +376,12 @@
** @param y Map Y tile position.
** @param w Width of Goal
** @param h Height of Goal
+** @param minrange min range to the tile
** @param range Range to the tile.
**
** @return Distance to place.
*/
-global int PlaceReachable(Unit* src,int x,int y,int w,int h,int range)
+global int PlaceReachable(Unit* src,int x,int y,int w,int h,int minrange
__attribute__((unused)),int range)
{
int depth;
static unsigned long LastGameCycle;
@@ -408,9 +409,10 @@
}
return depth;
-
}
+#endif
+
/**
** Can the unit 'src' reach the unit 'dst'.
**
@@ -431,7 +433,7 @@
//
// Find a path to the goal.
//
-
depth=PlaceReachable(src,dst->X,dst->Y,dst->Type->TileWidth,dst->Type->TileHeight,range);
+
depth=PlaceReachable(src,dst->X,dst->Y,dst->Type->TileWidth,dst->Type->TileHeight,0,range);
if( depth <= 0 ) {
DebugLevel3("NO WAY\n");
return 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus doc/ChangeLog.html src/clone/mainloop...,
ludovic pollet <=