projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b917bb4
)
Patch by Matt McCutchen to prevent division by zero when Tux spawns exactly at a...
author
Wolfgang Becker
<uafr@gmx.de>
Sun, 30 Aug 2009 12:10:24 +0000
(12:10 +0000)
committer
Wolfgang Becker
<uafr@gmx.de>
Sun, 30 Aug 2009 12:10:24 +0000
(12:10 +0000)
SVN-Revision: 5910
src/badguy/willowisp.cpp
patch
|
blob
|
history
diff --git
a/src/badguy/willowisp.cpp
b/src/badguy/willowisp.cpp
index
0e55486
..
db467e7
100644
(file)
--- a/
src/badguy/willowisp.cpp
+++ b/
src/badguy/willowisp.cpp
@@
-106,11
+106,14
@@
WillOWisp::active_update(float elapsed_time)
break;
case STATE_TRACKING:
- if (dist.norm() <= vanish_range) {
+ if (dist.norm() > vanish_range) {
+ vanish();
+ } else if (dist.norm() >= 1) {
Vector dir = dist.unit();
movement = dir * elapsed_time * flyspeed;
} else {
- vanish();
+ /* We somehow landed right on top of the player without colliding.
+ * Sit tight and avoid a division by zero. */
}
sound_source->set_position(get_pos());
break;