summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-20 17:16:37 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-20 17:16:37 +0000
commit38a97bac830d6afe82fe3f68f3d8a0831bb5b643 (patch)
treeae8f26697caeee74da81c7b87cda0ac90faf5fb7 /src/game.cpp
parentd332272741e8382409453b975c66235d45e66cc7 (diff)
downloadmana-38a97bac830d6afe82fe3f68f3d8a0831bb5b643.tar.gz
mana-38a97bac830d6afe82fe3f68f3d8a0831bb5b643.tar.bz2
mana-38a97bac830d6afe82fe3f68f3d8a0831bb5b643.tar.xz
mana-38a97bac830d6afe82fe3f68f3d8a0831bb5b643.zip
More progress towards loading XML maps.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 01a155a6..be2eacb8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -122,7 +122,8 @@ void game() {
void do_init()
{
- if (!tiledMap.load(map_path)) {
+ tiledMap = Map::load(map_path);
+ if (!tiledMap) {
error("Could not find map file");
}
@@ -310,7 +311,7 @@ void do_input()
if (keys[SDLK_UP] || keys[SDLK_KP8])
{
// UP
- if (tiledMap.getWalk(x, y - 1) != 0)
+ if (tiledMap->getWalk(x, y - 1) != 0)
{
walk(x, y-1, NORTH);
walk_status = 1;
@@ -326,7 +327,7 @@ void do_input()
else if (keys[SDLK_DOWN] || keys[SDLK_KP2])
{
// Down
- if (tiledMap.getWalk(x, y + 1) != 0)
+ if (tiledMap->getWalk(x, y + 1) != 0)
{
walk(x, y + 1, SOUTH);
walk_status = 1;
@@ -341,7 +342,7 @@ void do_input()
}
else if (keys[SDLK_LEFT] || keys[SDLK_KP4])
{
- if (tiledMap.getWalk(x - 1, y) != 0) {
+ if (tiledMap->getWalk(x - 1, y) != 0) {
walk(x - 1, y, WEST);
walk_status = 1;
src_x = x;
@@ -355,7 +356,7 @@ void do_input()
}
else if (keys[SDLK_RIGHT] || keys[SDLK_KP6])
{
- if (tiledMap.getWalk(x + 1, y) != 0) {
+ if (tiledMap->getWalk(x + 1, y) != 0) {
walk(x + 1, y, EAST);
walk_status = 1;
src_x = x;
@@ -552,7 +553,7 @@ void do_parse() {
being->job = RFIFOW(14);
add_node(being);
}
- being->setPath(tiledMap.findPath(
+ being->setPath(tiledMap->findPath(
get_src_x(RFIFOP(50)),
get_src_y(RFIFOP(50)),
get_dest_x(RFIFOP(50)),
@@ -635,7 +636,9 @@ void do_parse() {
memset(map_path, '\0', 480);
strcat(map_path, "./data/map/");
strncat(map_path, RFIFOP(2), 497 - strlen(map_path));
- if (tiledMap.load(map_path)) {
+ if (tiledMap) delete tiledMap;
+ tiledMap = Map::load(map_path);
+ if (tiledMap) {
Being *temp;
temp = new Being();
memcpy(temp, player_node, sizeof(Being));