summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-30 13:29:45 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-30 13:29:45 +0000
commitad3623ced5020c9c886cb85100ae05efa460f84a (patch)
tree2f01f33e4bf0f5e20f81a7d3f64cd6466381df95 /src/being.cpp
parent22799314e68a0535f65cc7aa56c490cdde7ca544 (diff)
downloadmana-ad3623ced5020c9c886cb85100ae05efa460f84a.tar.gz
mana-ad3623ced5020c9c886cb85100ae05efa460f84a.tar.bz2
mana-ad3623ced5020c9c886cb85100ae05efa460f84a.tar.xz
mana-ad3623ced5020c9c886cb85100ae05efa460f84a.zip
Some fixes to player control, also attempting to solve long walk path problem.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 0ef1e15f..90819f70 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -37,7 +37,8 @@ PATH_NODE::PATH_NODE(unsigned short x, unsigned short y):
{
}
-void add_node(Being *being) {
+void add_node(Being *being)
+{
beings.push_back(being);
// If the being is a player, request the name
if (being-> job < 10) {
@@ -59,10 +60,10 @@ void add_node(Being *being) {
monsterset[being->job - 1002] = new Spriteset(monsterbitmap, 60, 60);
}
}
-
}
-void remove_node(unsigned int id) {
+void remove_node(unsigned int id)
+{
std::list<Being *>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
if ((*i)->id == id) {
@@ -73,7 +74,8 @@ void remove_node(unsigned int id) {
}
}
-unsigned int findNpc(unsigned short x, unsigned short y) {
+unsigned int findNpc(unsigned short x, unsigned short y)
+{
std::list<Being *>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
Being *being = (*i);
@@ -87,7 +89,8 @@ unsigned int findNpc(unsigned short x, unsigned short y) {
return 0;
}
-unsigned int findPlayer(unsigned short x, unsigned short y) {
+unsigned int findPlayer(unsigned short x, unsigned short y)
+{
std::list<Being *>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
Being *being = (*i);
@@ -99,7 +102,8 @@ unsigned int findPlayer(unsigned short x, unsigned short y) {
return 0;
}
-unsigned int findMonster(unsigned short x, unsigned short y) {
+unsigned int findMonster(unsigned short x, unsigned short y)
+{
std::list<Being*>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
Being *being = (*i);
@@ -114,7 +118,8 @@ unsigned int findMonster(unsigned short x, unsigned short y) {
return 0;
}
-Being *findNode(unsigned int id) {
+Being *findNode(unsigned int id)
+{
std::list<Being*>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
Being *being = (*i);
@@ -125,7 +130,8 @@ Being *findNode(unsigned int id) {
return NULL;
}
-Being *findNode(unsigned short x, unsigned short y) {
+Being *findNode(unsigned short x, unsigned short y)
+{
std::list<Being*>::iterator i;
for (i = beings.begin(); i != beings.end(); i++) {
Being *being = (*i);
@@ -179,8 +185,12 @@ void Being::clearPath()
void Being::setPath(std::list<PATH_NODE> path)
{
this->path = path;
- nextStep();
- walk_time = tick_time;
+
+ if (action != WALK)
+ {
+ nextStep();
+ walk_time = tick_time;
+ }
}
void Being::setDestination(int destX, int destY)