Expaneded the lua API for Regions

I've added lua hooks for both pager functor classes. Hopefully, I haven't
missed any corner cases, because it took me a while to hunt everything
down. One issue is that the map's save directory needs to be set in the
Format class, but it'll do for now. I'll review this again when I've got
more than one map running at one time.

There should be enough here for a lua-driven map generator to be
implemented, even if it's a bit rough. I think I'll test this out in the
editor eventually, but getting the base branch's network map code going
comes first.

The current process is extremely convulted, so I need to document
everything that I've done so far, including C++ and lua functions.
This commit is contained in:
Kayne Ruse
2014-03-31 01:26:45 +11:00
parent 4cff57fe71
commit a5b68cf1fd
8 changed files with 145 additions and 25 deletions
+4 -2
View File
@@ -101,6 +101,8 @@ void ServerApplication::Init(int argc, char** argv) {
mapPager.SetRegionHeight(REGION_HEIGHT);
mapPager.SetRegionDepth(REGION_DEPTH);
mapPager.GetGenerator()->SetLuaState(luaState);
mapPager.GetFormat()->SetLuaState(luaState);
mapPager.GetFormat()->SetSaveDir("save/mapname/");
//TODO: pass args to the generator & format as needed
//NOTE: I might need to rearrange the init process so that lua & SQL can interact
// with the map system as needed.
@@ -112,8 +114,7 @@ void ServerApplication::Init(int argc, char** argv) {
cout << "Startup completed successfully" << endl;
//debugging
mapPager.GetRegion(0,0);
mapPager.GetRegion(128,256);
//
}
void ServerApplication::Loop() {
@@ -136,6 +137,7 @@ void ServerApplication::Loop() {
void ServerApplication::Quit() {
cout << "Shutting down" << endl;
//empty the members
mapPager.UnloadAll();
//TODO: player manager
//TODO: client manager
+1 -1
View File
@@ -85,7 +85,7 @@ private:
void PumpPacket(NetworkPacket);
//maps
RegionPager<LuaGenerator, DummyFormat> mapPager;
RegionPager<LuaGenerator, LuaFormat> mapPager;
//networking
UDPNetworkUtility network;