summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-18 21:56:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-18 21:56:06 +0000
commit7d8ea8914bc230d473f558116d932f26f2b5d055 (patch)
treebf77bf707beb6a70b69d76dad7f19c0a69654c5f
parent708384a6b1fca22c6352deb79e52422266dc307e (diff)
downloadmana-7d8ea8914bc230d473f558116d932f26f2b5d055.tar.gz
mana-7d8ea8914bc230d473f558116d932f26f2b5d055.tar.bz2
mana-7d8ea8914bc230d473f558116d932f26f2b5d055.tar.xz
mana-7d8ea8914bc230d473f558116d932f26f2b5d055.zip
Fixed tileset loading to clear tilesets vector when finished.
-rw-r--r--debian/control2
-rw-r--r--debian/copyright2
-rw-r--r--src/gui/window.cpp38
-rw-r--r--src/gui/window.h68
-rw-r--r--src/net/protocol.cpp12
-rw-r--r--src/resources/mapreader.cpp8
6 files changed, 69 insertions, 61 deletions
diff --git a/debian/control b/debian/control
index 0f35c148..42e5f4e9 100644
--- a/debian/control
+++ b/debian/control
@@ -25,4 +25,4 @@ Description: The Mana World is a Great Online Game
.
Look at the website for further informations...
.
- Web Site: http://www.themanaworld.org
+ Web Site: http://themanaworld.org/
diff --git a/debian/copyright b/debian/copyright
index c7b68caa..4ea7baac 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,6 +1,6 @@
This package was debianized by Yohann FERREIRA <bertram@cegetel.net>.
-It was downloaded from http://www.themanaworld.org/
+It was downloaded from http://themanaworld.org/
Development team:
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index c9c51032..62daa9cd 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -33,11 +33,11 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
parent(parent),
snapSize(8),
modal(modal),
+ resizeable(false),
minWinWidth(256),
minWinHeight(128),
maxWinWidth(512),
- maxWinHeight(512),
- isWinResizeable(false)
+ maxWinHeight(512)
{
logger.log("Window::Window(\"%s\")", caption.c_str());
@@ -183,12 +183,12 @@ void Window::setMaxHeight(unsigned int height)
void Window::setResizeable(bool r)
{
- isWinResizeable = r;
+ resizeable = r;
}
bool Window::getResizeable()
{
- return isWinResizeable;
+ return resizeable;
}
Window *Window::getParentWindow()
@@ -229,24 +229,24 @@ void Window::mouseMotion(int mx, int my)
//if (y < snapSize) y = 0;
//if (x + winWidth + snapSize > screen->w) x = screen->w - winWidth;
//if (y + winHeight + snapSize > screen->h) y = screen->h - winHeight;
-
- if (isWinResizeable && mx > getWidth() - 16) {
- //resize
- if (mx < minWinWidth)
- mx = minWinWidth;
- if (my < minWinHeight)
- my = minWinHeight;
- if (mx >= maxWinWidth)
- mx = maxWinWidth - 1;
- if (my >= maxWinHeight)
- my = maxWinHeight - 1;
+
+ if (resizeable && mx > getWidth() - 16) {
+ // Resize
+ if (mx < minWinWidth)
+ mx = minWinWidth;
+ if (my < minWinHeight)
+ my = minWinHeight;
+ if (mx >= maxWinWidth)
+ mx = maxWinWidth - 1;
+ if (my >= maxWinHeight)
+ my = maxWinHeight - 1;
setWidth(mx);
- setHeight(my);
- } else {
- //move
+ setHeight(my);
+ } else {
+ // Move
setPosition(x, y);
- }
+ }
}
}
diff --git a/src/gui/window.h b/src/gui/window.h
index b7cab031..f2f87cc0 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -50,11 +50,11 @@ class Window : public gcn::Window, public ConfigListener
ImageRect border; /**< The window border */
- bool isWinResizeable; /**< Window can be resized */
- int minWinWidth; /**< Minimum window width */
- int minWinHeight; /**< Minimum window height */
- int maxWinWidth; /**< Maximum window width */
- int maxWinHeight; /**< Maximum window height */
+ bool resizeable; /**< Window can be resized */
+ int minWinWidth; /**< Minimum window width */
+ int minWinHeight; /**< Minimum window height */
+ int maxWinWidth; /**< Maximum window width */
+ int maxWinHeight; /**< Maximum window height */
/** The window container windows add themselves to. */
@@ -124,35 +124,35 @@ class Window : public gcn::Window, public ConfigListener
*/
void setContentSize(int width, int height);
- /**
- * Sets whether of not the window can be resized
- */
- void setResizeable(bool resize);
-
- /**
- * Returns the current value of isResizable
- */
- bool getResizeable();
-
- /**
- * Sets the minimum width of the window
- */
- void setMinWidth(unsigned int width);
-
- /**
- * Sets the minimum height of the window
- */
- void setMinHeight(unsigned int height);
-
- /**
- * Sets the maximum width of the window
- */
- void setMaxWidth(unsigned int width);
-
- /**
- * Sets the minimum height of the window
- */
- void setMaxHeight(unsigned int height);
+ /**
+ * Sets whether of not the window can be resized.
+ */
+ void setResizeable(bool resize);
+
+ /**
+ * Returns whether the window can be resized.
+ */
+ bool getResizeable();
+
+ /**
+ * Sets the minimum width of the window.
+ */
+ void setMinWidth(unsigned int width);
+
+ /**
+ * Sets the minimum height of the window.
+ */
+ void setMinHeight(unsigned int height);
+
+ /**
+ * Sets the maximum width of the window.
+ */
+ void setMaxWidth(unsigned int width);
+
+ /**
+ * Sets the minimum height of the window.
+ */
+ void setMaxHeight(unsigned int height);
/**
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index 94c4a5e1..d2f1bd77 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -197,7 +197,8 @@ void map_start()
while (out_size > 0) flush();
}
-void walk(unsigned short x, unsigned short y, unsigned char direction) {
+void walk(unsigned short x, unsigned short y, unsigned char direction)
+{
char temp[3];
set_coordinates(temp, x, y, direction);
WFIFOW(0) = net_w_value(0x0085);
@@ -205,7 +206,8 @@ void walk(unsigned short x, unsigned short y, unsigned char direction) {
WFIFOSET(5);
}
-void speak(char *speech) {
+void speak(char *speech)
+{
int len = (int)strlen(speech);
WFIFOW(0) = net_w_value(0x008c);
WFIFOW(2) = net_w_value(len + 4);
@@ -213,14 +215,16 @@ void speak(char *speech) {
WFIFOSET(len + 4);
}
-void action(char type, int id) {
+void action(char type, int id)
+{
WFIFOW(0) = net_w_value(0x0089);
WFIFOL(2) = net_l_value(id);
WFIFOB(6) = net_b_value(type);
WFIFOSET(7);
}
-void attack(unsigned short x, unsigned short y, unsigned char direction) {
+void attack(unsigned short x, unsigned short y, unsigned char direction)
+{
int monster_id = 0;
if (direction == SOUTH) {
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index cf18e4bb..11deacbf 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -76,7 +76,7 @@ Map *MapReader::readMap(const std::string &filename)
logger.log("Warning: Not a map file (%s)!", filename.c_str());
return NULL;
}
-
+
return readMap(node, filename);
xmlFreeDoc(doc);
} else {
@@ -89,7 +89,7 @@ Map *MapReader::readMap(const std::string &filename)
Map* MapReader::readMap(xmlNodePtr node, const std::string &path)
{
xmlChar *prop;
-
+
// Take the filename off the path
std::string pathDir = path.substr(0, path.rfind("/") + 1);
@@ -121,6 +121,10 @@ Map* MapReader::readMap(xmlNodePtr node, const std::string &path)
}
}
+ // Clean up tilesets
+ // TODO: Dereference them somewhere
+ tilesets.clear();
+
return map;
}