aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/walking.cpp
diff options
context:
space:
mode:
authorDavid Turner2011-12-18 18:29:05 -0800
committerDavid Turner2011-12-18 18:29:05 -0800
commit538d83408091e9077f451f45c1ac1127f302b47d (patch)
treea8b3ffaf9199665b41e8f990549fc267c6421b46 /engines/draci/walking.cpp
parentf0eee81d327957cddb85c5a1ffe7a308a377f636 (diff)
parentf722542ceea557e906699c60b10b3ace1f41c238 (diff)
downloadscummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.tar.gz
scummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.tar.bz2
scummvm-rg350-538d83408091e9077f451f45c1ac1127f302b47d.zip
Merge pull request #131 from digitall/goto_considered_harmful
Goto Considered Harmful... The following commits should improve the ScummVM code structure by reducing the number of gotos used in various engine code. They should implement identical functionality, but without using goto and without the result being less readable/maintainable than the version with goto.
Diffstat (limited to 'engines/draci/walking.cpp')
-rw-r--r--engines/draci/walking.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 9a66c6163a..f1ae769d80 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -729,20 +729,18 @@ Movement WalkingState::transitionBetweenAnimations(Movement previous, Movement n
Movement WalkingState::animationForSightDirection(SightDirection dir, const Common::Point &hero, const Common::Point &mouse, const WalkingPath &path, Movement startingDirection) {
switch (dir) {
+ case kDirectionLeft:
+ return kStopLeft;
+ case kDirectionRight:
+ return kStopRight;
case kDirectionMouse:
if (mouse.x < hero.x) {
return kStopLeft;
} else if (mouse.x > hero.x) {
return kStopRight;
- } else {
- goto defaultCase;
}
- case kDirectionLeft:
- return kStopLeft;
- case kDirectionRight:
- return kStopRight;
+ // fall-through here intentional
default: {
-defaultCase:
// Find the last horizontal direction on the path.
int i = path.size() - 1;
while (i >= 0 && path[i].x == hero.x) {