1
0
forked from 0ad/0ad

adding flag -triPathfind to enable triangulation pathfinding. it will use the orignial A* without the flag

This was SVN commit r5397.
This commit is contained in:
kai 2007-10-10 19:35:23 +00:00
parent 0841404218
commit 7ba586b16e
7 changed files with 31 additions and 12 deletions

View File

@ -30,12 +30,12 @@ lodbias = -1.0
language=english
; Enable/disable windowed mode.
windowed=false
windowed=true
; You can specify these as well, but the default (keeping the current resolution) is
; probably best for most people.
;xres = 1024
;yres = 768
xres = 800
yres = 600
; Logging settings:
;

View File

@ -43,7 +43,11 @@ bool g_VSync = false;
bool g_Quickstart = false;
// flag to switch on drawing terrain overlays
bool g_showOverlay = false;
bool g_ShowOverlay = false;
// flag to switch on triangulation pathfinding
bool g_TriPathfind = false;
// If non-empty, specified map will be automatically loaded
CStr g_AutostartMap = "";
@ -162,7 +166,10 @@ static void ProcessCommandLineArgs(const CmdLineArgs& args)
g_ConfigDB.CreateValue(CFG_COMMAND, "vsync")->m_String = "true";
if (args.Has("showOverlay"))
g_showOverlay = true;
g_ShowOverlay = true;
if (args.Has("triPathfind"))
g_TriPathfind = true;
}

View File

@ -53,4 +53,6 @@ extern CStr g_CursorName;
class CmdLineArgs;
extern void CONFIG_Init(const CmdLineArgs& args);
extern bool g_showOverlay;
extern bool g_ShowOverlay;
extern bool g_TriPathfind;

View File

@ -214,7 +214,7 @@ void TerrainOverlay::GetTileExtents(
void TerrainOverlay::Render()
{
if(g_showOverlay)
if(g_ShowOverlay)
{
m_Terrain = g_Game->GetWorld()->GetTerrain();

View File

@ -227,7 +227,7 @@ bool CAStarEngine::FindPath(
//it's guarded here to stop setting the drawing path in pathfindingOverlay.
//(efficiency issue)
//the drawing is disable in the render() function in TerraiOverlay.cpp
if(g_showOverlay)
if(g_ShowOverlay)
{
pathfindingOverlay.setPath(mPath);
}

View File

@ -23,6 +23,8 @@
#include "lib/rand.h"
#include "ps/GameSetup/Config.h"
enum EGotoSituation
{
NORMAL = 0,
@ -663,10 +665,18 @@ bool CEntity::ProcessGotoWaypoint( CEntityOrder* current, size_t UNUSED(timestep
ChooseMovementSpeed( Distance );
//Kai: invoking triangulation pathfinding function instead
//g_Pathfinder.RequestLowLevelPath( me, path_to, contact, pathfinder_radius, source );
//Kai: invoking triangulation or original A* pathfinding
if(g_TriPathfind)
{
g_Pathfinder.RequestTriangulationPath( me, path_to, contact, pathfinder_radius, source );
}
else
{
g_Pathfinder.RequestLowLevelPath( me, path_to, contact, pathfinder_radius, source );
}
g_Pathfinder.RequestTriangulationPath( me, path_to, contact, pathfinder_radius, source );
return( true );
}

View File

@ -194,7 +194,7 @@ void CPathfindEngine::RequestPath( HEntity entity, const CVector2D& destination,
//it's guarded here to stop setting constrainedEdges and unconstrainedEdges in triangulationOverlay.
//(efficiency issue)
//the drawing is disable in the render() function in TerraiOverlay.cpp
if(g_showOverlay)
if(g_ShowOverlay)
{
drawTrianulation();
}