summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/chargedialog.cpp1
-rw-r--r--src/gui/connection.cpp1
-rw-r--r--src/inventory.h7
-rw-r--r--src/localplayer.cpp19
-rw-r--r--src/localplayer.h17
-rw-r--r--src/player.cpp2
8 files changed, 49 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 6028a336..7e172fe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-2006-12-12 Philipp Sehmisch <tmw@crushnet.org>
+2006-12-16 Bjørn Lindeijer <bjorn@lindeijer.nl>
+
+ * src/gui/connection.cpp, src/gui/chargedialog.cpp: Fixed dialog
+ visibility.
+ * src/localplayer.cpp, src/game.cpp, src/localplayer.h: Fixed issues
+ with walking one tile too many and changing direction towards an
+ obstacle.
+
+2006-12-15 Philipp Sehmisch <tmw@crushnet.org>
* data/graphics/tiles/desert1.png: Removed some unused legacy tiles and
added variant tiles for the cliffs.
diff --git a/src/game.cpp b/src/game.cpp
index 97427860..a424320e 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -656,7 +656,7 @@ void Game::handleInput()
direction |= Being::RIGHT;
}
- player_node->walk(direction);
+ player_node->setWalkingDir(direction);
// Attacking monsters
if (keys[SDLK_LCTRL] || keys[SDLK_RCTRL] ||
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index 349ca223..862378ae 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -37,6 +37,7 @@ ChargeDialog::ChargeDialog():
mProgBar = new ProgressBar(0.0f, 140, 25, 128, 128, 128);
mProgBar->setPosition(20, 40);
add(mProgBar);
+ setVisible(true);
}
// update the dialog
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 8da36f20..bacc319e 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -57,6 +57,7 @@ ConnectionDialog::ConnectionDialog():
add(mProgressBar);
setLocationRelativeTo(getParent());
+ setVisible(true);
}
void ConnectionDialog::logic()
diff --git a/src/inventory.h b/src/inventory.h
index 40bcafbb..32ae393e 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -31,7 +31,14 @@ class Item;
class Inventory
{
public:
+ /**
+ * Constructor.
+ */
Inventory();
+
+ /**
+ * Destructor.
+ */
~Inventory();
/**
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index f842042c..2e583404 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -181,11 +181,6 @@ void LocalPlayer::pickUp(FloorItem *item)
void LocalPlayer::walk(unsigned char dir)
{
- if (mWalkingDir != dir)
- {
- mWalkingDir = dir;
- }
-
if (!mMap || !dir)
return;
@@ -248,6 +243,20 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y)
Being::setDestination(x, y);
}
+void LocalPlayer::setWalkingDir(int dir)
+{
+ if (mWalkingDir != dir)
+ {
+ mWalkingDir = dir;
+ }
+
+ // If we're not already walking, start walking.
+ if (mAction != WALK && dir)
+ {
+ walk(dir);
+ }
+}
+
void LocalPlayer::raiseAttribute(Attribute attr)
{
MessageOut outMsg(mNetwork);
diff --git a/src/localplayer.h b/src/localplayer.h
index 7cad9bc4..b120969e 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -43,9 +43,15 @@ class LocalPlayer : public Player
STR = 0, AGI, VIT, INT, DEX, LUK
};
+ /**
+ * Constructor.
+ */
LocalPlayer(Uint32 id, Uint16 job, Map *map);
- virtual ~LocalPlayer();
+ /**
+ * Destructor.
+ */
+ ~LocalPlayer();
void setNetwork(Network *network) { mNetwork = network; }
@@ -115,13 +121,16 @@ class LocalPlayer : public Player
*/
void setTarget(Being* target) { mTarget = target; }
- void walk(unsigned char dir);
-
/**
* Sets a new destination for this being to walk to.
*/
virtual void setDestination(Uint16 x, Uint16 y);
+ /**
+ * Sets a new direction to keep walking in.
+ */
+ void setWalkingDir(int dir);
+
void raiseAttribute(Attribute attr);
void raiseSkill(Uint16 skillId);
@@ -155,6 +164,8 @@ class LocalPlayer : public Player
std::auto_ptr<Inventory> mInventory;
protected:
+ void walk(unsigned char dir);
+
Network *mNetwork;
Being *mTarget;
FloorItem *mPickUpTarget;
diff --git a/src/player.cpp b/src/player.cpp
index b9076260..ad19fe06 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -49,6 +49,7 @@ Player::logic()
nextStep();
}
break;
+
case ATTACK:
int frames = 4;
if (getWeapon() == 2)
@@ -61,6 +62,7 @@ Player::logic()
}
break;
}
+
Being::logic();
}