Began working on the lua API for the map

The basic framework is done.
This commit is contained in:
Kayne Ruse
2014-03-28 03:24:14 +11:00
parent 47684380a9
commit 38b603fc8f
15 changed files with 263 additions and 14 deletions
+23 -2
View File
@@ -21,10 +21,31 @@
*/
#include "map_generator.hpp"
void MapGenerator::Create(Region** const ptr, int width, int height, int depth, int x, int y) {
void BlankGenerator::Create(Region** const ptr, int width, int height, int depth, int x, int y) {
(*ptr) = new Region(width, height, depth, x, y);
}
void MapGenerator::Unload(Region* const ptr) {
void BlankGenerator::Unload(Region* const ptr) {
delete ptr;
}
/*
void PerlinGenerator::Create(Region** const ptr, int width, int height, int depth, int x, int y) {
(*ptr) = new Region(width, height, depth, x, y);
}
void PerlinGenerator::Unload(Region* const ptr) {
delete ptr;
}
*/
void LuaGenerator::Create(Region** const ptr, int width, int height, int depth, int x, int y) {
(*ptr) = new Region(width, height, depth, x, y);
//generate the lua-driven maps
lua_getglobal(state, "CreateRegion");
lua_pushlightuserdata(state, ptr);
lua_pcall(state, 1, 0, 0);
}
void LuaGenerator::Unload(Region* const ptr) {
delete ptr;
}