diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 32843ba..14e1631 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -24,6 +24,8 @@ #include "gamelog.h" #include "typeconvert.h" +const int MAP_CELL_WIDTH = 64 * 8; +const int MAP_GRID_WIDTH = 64; const int ROOM_MAX_PLAYER_NUM = 50; static long long RoomXGetTickCount(void* context) @@ -39,19 +41,21 @@ Room::~Room() void Room::Init() { -const int MAP_HEIGHT = 8192; -const int MAP_WIDTH = 8192; -const int MAP_CELL_WIDTH = 64 * 8; -const int MAP_GRID_WIDTH = 64; - #if 1 - ((metatable::Map*)map_meta->i)->set_map_width(MAP_WIDTH); - ((metatable::Map*)map_meta->i)->set_map_height(MAP_HEIGHT); - #endif + if (map_meta->i->map_width() < 1) { + abort(); + } + if (map_meta->i->map_height() < 1) { + abort(); + } xtimer.Init(RoomXGetTickCount, this, 100, 100); xtimer_attacher.xtimer = &xtimer; - grid_service.Init(MAP_WIDTH, MAP_HEIGHT, MAP_CELL_WIDTH); - map_service.Init(MAP_WIDTH / MAP_GRID_WIDTH, MAP_HEIGHT / MAP_GRID_WIDTH, MAP_GRID_WIDTH); + grid_service.Init(map_meta->i->map_width(), + map_meta->i->map_height(), + MAP_CELL_WIDTH); + map_service.Init(map_meta->i->map_width() / MAP_GRID_WIDTH, + map_meta->i->map_height() / MAP_GRID_WIDTH, + MAP_GRID_WIDTH); CreateThings(); if (App::Instance()->HasFlag(1)) {