diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-12-16 19:04:58 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-12-16 19:04:58 +0000 |
commit | 35afca876ece89be5b282c73a200d0d3c5d27fe0 (patch) | |
tree | 90033c7dfd025ab0d90304bfc5440c9aaa3bbcc5 /src | |
parent | 201a9a7d4fdf1ff7cb8ffc75d606bfaf6d38a0f6 (diff) | |
download | mana-35afca876ece89be5b282c73a200d0d3c5d27fe0.tar.gz mana-35afca876ece89be5b282c73a200d0d3c5d27fe0.tar.bz2 mana-35afca876ece89be5b282c73a200d0d3c5d27fe0.tar.xz mana-35afca876ece89be5b282c73a200d0d3c5d27fe0.zip |
Fixed connection dialog visibility and fixed issues with walking one tile too
many and changing direction towards an obstacle.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/gui/chargedialog.cpp | 1 | ||||
-rw-r--r-- | src/gui/connection.cpp | 1 | ||||
-rw-r--r-- | src/inventory.h | 7 | ||||
-rw-r--r-- | src/localplayer.cpp | 19 | ||||
-rw-r--r-- | src/localplayer.h | 17 | ||||
-rw-r--r-- | src/player.cpp | 2 |
7 files changed, 40 insertions, 9 deletions
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(); } |