diff options
author | Eugene Sandulenko | 2013-10-23 00:36:43 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-10-23 00:37:04 +0300 |
commit | 1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34 (patch) | |
tree | f9233030a8957d924fa4ef05e324e239ff8c40b8 | |
parent | 32c52c3df7948adfbb249ecd9c68d92191265d81 (diff) | |
download | scummvm-rg350-1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34.tar.gz scummvm-rg350-1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34.tar.bz2 scummvm-rg350-1dd90e4ea9a01df9f2ccca8779c4fb3bec86cb34.zip |
FULLPIPE: Implement MovGraph::calcOffset()
-rw-r--r-- | engines/fullpipe/motion.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 94635a3b91..ebf896cf1e 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1132,9 +1132,22 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest, } MovGraphNode *MovGraph::calcOffset(int ox, int oy) { - warning("STUB: MovGraph::calcOffset()"); + MovGraphNode *res = 0; + double mindist = 1.0e10; - return 0; + for (ObList::iterator i = _nodes.begin(); i != _nodes.end(); ++i) { + assert(((CObject *)*i)->_objtype == kObjTypeMovGraphNode); + + MovGraphNode *node = (MovGraphNode *)*i; + + double dist = sqrt((double)((node->_x - oy) * (node->_x - oy) + (node->_x - ox) * (node->_x - ox))); + if (dist < mindist) { + mindist = dist; + res = node; + } + } + + return res; } void MGM::clear() { |