Replaced a block of code in setup_server.lua with one line
This commit is contained in:
@@ -589,8 +589,6 @@ void InWorld::HandleCharacterDelete(CharacterPacket* const argPacket) {
|
||||
//ignore if this character doesn't exist
|
||||
std::map<int, BaseCharacter>::iterator characterIt = characterMap.find(argPacket->characterIndex);
|
||||
if (characterIt == characterMap.end()) {
|
||||
//debug
|
||||
std::cout << "Ignoring character deletion" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ mapSystem = require "map_system"
|
||||
mapMaker = require "map_maker"
|
||||
mapSaver = require "map_saver"
|
||||
roomSystem = require "room_system"
|
||||
waypointSystem = require "waypoint_system"
|
||||
|
||||
local function dumpTable(t)
|
||||
print(t)
|
||||
@@ -15,68 +14,6 @@ end
|
||||
|
||||
--NOTE: room 0 is the first that the client asks for, therefore it must exist
|
||||
local overworld, uid = roomSystem.RoomManager.CreateRoom("overworld", "overworld.bmp")
|
||||
|
||||
--NOTE: This is horrible; room initialization is important
|
||||
mapSystem.RegionPager.SetOnLoad(roomSystem.Room.GetPager(overworld), mapSaver.Load)
|
||||
mapSystem.RegionPager.SetOnSave(roomSystem.Room.GetPager(overworld), mapSaver.Save)
|
||||
mapSystem.RegionPager.SetOnCreate(roomSystem.Room.GetPager(overworld), mapMaker.debugIsland)
|
||||
mapSystem.RegionPager.SetOnUnload(roomSystem.Room.GetPager(overworld), mapSaver.Save)
|
||||
|
||||
--check the entity-monster cloning...
|
||||
print("Checking monster-entity stuff")
|
||||
|
||||
monsterSystem = require "monster_system"
|
||||
entities = require "entity"
|
||||
|
||||
dumpTable(entities)
|
||||
dumpTable(monsterSystem)
|
||||
dumpTable(monsterSystem.Monster)
|
||||
|
||||
monsterSystem.Monster.GetRoomIndex = -1
|
||||
|
||||
dumpTable(entities)
|
||||
dumpTable(monsterSystem.Monster)
|
||||
roomSystem.Room.Initialize(overworld, mapSaver.Load, mapSaver.Save, mapMaker.debugIsland, mapSaver.Save)
|
||||
|
||||
print("Finished the lua script")
|
||||
|
||||
--[[
|
||||
debugging test
|
||||
|
||||
Ideal output:
|
||||
|
||||
-------------------------
|
||||
pager: userdata: [memory location]
|
||||
Size 0: 0
|
||||
[debug output from load]
|
||||
Size 1: 1
|
||||
[debug output from save]
|
||||
Size 2: 0
|
||||
[debug output from load]
|
||||
Size 3: 1
|
||||
[debug output from save]
|
||||
Size 4: 0
|
||||
-------------------------
|
||||
|
||||
--]-]
|
||||
|
||||
print("-------------------------")
|
||||
local pager = roomSystem.Room.GetPager(overworld)
|
||||
|
||||
print("pager:", pager)
|
||||
|
||||
print("Size 0:", mapSystem.RegionPager.ContainerSize(pager))
|
||||
|
||||
local regionFoo = mapSystem.RegionPager.GetRegion(pager, 0, 0)
|
||||
print("Size 1:", mapSystem.RegionPager.ContainerSize(pager))
|
||||
|
||||
mapSystem.RegionPager.UnloadRegion(pager, regionFoo)
|
||||
print("Size 2:", mapSystem.RegionPager.ContainerSize(pager))
|
||||
|
||||
local regionFoo = mapSystem.RegionPager.GetRegion(pager, 0, 0)
|
||||
print("Size 3:", mapSystem.RegionPager.ContainerSize(pager))
|
||||
|
||||
mapSystem.RegionPager.UnloadRegion(pager, 0, 0)
|
||||
print("Size 4:", mapSystem.RegionPager.ContainerSize(pager))
|
||||
|
||||
print("-------------------------")
|
||||
--]]
|
||||
+2
-3
@@ -37,9 +37,8 @@
|
||||
#include "lua.hpp"
|
||||
|
||||
#include "entity_api.hpp"
|
||||
#include "monster_system_api.hpp"
|
||||
|
||||
#include "map_system_api.hpp"
|
||||
#include "monster_system_api.hpp"
|
||||
#include "room_system_api.hpp"
|
||||
#include "waypoint_system_api.hpp"
|
||||
|
||||
@@ -63,8 +62,8 @@ static const luaL_Reg loadedlibs[] = {
|
||||
//these libs are preloaded and must be required before used
|
||||
static const luaL_Reg preloadedlibs[] = {
|
||||
{TORTUGA_ENTITY_API, openEntityAPI},
|
||||
{TORTUGA_MONSTER_SYSTEM_API, openMonsterSystemAPI},
|
||||
{TORTUGA_MAP_SYSTEM_API, openMapSystemAPI},
|
||||
{TORTUGA_MONSTER_SYSTEM_API, openMonsterSystemAPI},
|
||||
{TORTUGA_ROOM_SYSTEM_API, openRoomSystemAPI},
|
||||
{TORTUGA_WAYPOINT_SYSTEM_API, openWaypointSystemAPI},
|
||||
{NULL, NULL}
|
||||
|
||||
@@ -66,10 +66,8 @@ static int getWaypointMgr(lua_State* L) {
|
||||
}
|
||||
|
||||
static int initialize(lua_State* L) {
|
||||
//set the members of the given room
|
||||
//TODO: This could fit into the room system's globals
|
||||
RoomData* room = static_cast<RoomData*>(lua_touserdata(L, 1));
|
||||
room->SetName(lua_tostring(L, 2));
|
||||
room->SetTileset(lua_tostring(L, 3));
|
||||
|
||||
//set the refs of these parameters (backwards, since it pops from the top of the stack)
|
||||
room->GetPager()->SetUnloadReference(luaL_ref(L, LUA_REGISTRYINDEX));
|
||||
|
||||
Reference in New Issue
Block a user