[Scummvm-cvs-logs] SF.net SVN: scummvm:[54199] scummvm/trunk/engines/sci/engine/kpathing.cpp
waltervn at users.sourceforge.net
waltervn at users.sourceforge.net
Thu Nov 11 12:24:12 CET 2010
Revision: 54199
http://scummvm.svn.sourceforge.net/scummvm/?rev=54199&view=rev
Author: waltervn
Date: 2010-11-11 11:24:12 +0000 (Thu, 11 Nov 2010)
Log Message:
-----------
SCI: Allow paths along the edge of the screen in kAvoidPath.
Paths along the edge of the screen are now taken as a last resort. Fixes
bugs #3047418 and #3059595.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kpathing.cpp
Modified: scummvm/trunk/engines/sci/engine/kpathing.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kpathing.cpp 2010-11-11 10:36:10 UTC (rev 54198)
+++ scummvm/trunk/engines/sci/engine/kpathing.cpp 2010-11-11 11:24:12 UTC (rev 54199)
@@ -1330,15 +1330,21 @@
if (closedSet.contains(vertex))
continue;
- // Avoid plotting path along screen edge
- if ((vertex_min != s->vertex_start) || (vertex != s->vertex_end))
- if (s->pointOnScreenBorder(vertex_min->v) && s->pointOnScreenBorder(vertex->v))
- continue;
-
if (!openSet.contains(vertex))
openSet.push_front(vertex);
new_dist = vertex_min->costG + (uint32)sqrt((float)vertex_min->v.sqrDist(vertex->v));
+
+ // When travelling to a vertex on the screen edge, we
+ // add a penalty score to make this path less appealing.
+ // NOTE: If an obstacle has only one vertex on a screen edge,
+ // later SSCI pathfinders will treat that vertex like any
+ // other, while we apply a penalty to paths traversing it.
+ // This difference might lead to problems, but none are
+ // known at the time of writing.
+ if (s->pointOnScreenBorder(vertex->v))
+ new_dist += 10000;
+
if (new_dist < vertex->costG) {
vertex->costG = new_dist;
vertex->costF = vertex->costG + (uint32)sqrt((float)vertex->v.sqrDist(s->vertex_end->v));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list