[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-devel] [PATCH] Removed redundant code from character::add_dir
From: |
Chris Frey |
Subject: |
[Adonthell-devel] [PATCH] Removed redundant code from character::add_direction() |
Date: |
Sun, 5 Oct 2008 03:33:56 -0400 |
User-agent: |
Mutt/1.4.1i |
The if statements incorrectly used the && operator, instead of the
bitwise operator &. Even so, the if statements are unneeded, since
the "tstdir &= ~EAST" works whether the bit is set or not.
---
src/world/character.cc | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/world/character.cc b/src/world/character.cc
index 2b0a562..a61f052 100644
--- a/src/world/character.cc
+++ b/src/world/character.cc
@@ -87,16 +87,16 @@ void character::add_direction(direction ndir)
switch (ndir)
{
case WEST:
- if (tstdir && EAST) tstdir &= ~EAST;
+ tstdir &= ~EAST;
break;
case EAST:
- if (tstdir && WEST) tstdir &= ~WEST;
+ tstdir &= ~WEST;
break;
case SOUTH:
- if (tstdir && NORTH) tstdir &= ~NORTH;
+ tstdir &= ~NORTH;
break;
case NORTH:
- if (tstdir && SOUTH) tstdir &= ~SOUTH;
+ tstdir &= ~SOUTH;
break;
default:
break;
--
1.6.0.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-devel] [PATCH] Removed redundant code from character::add_direction(),
Chris Frey <=