Skip to content

Commit

Permalink
More Lua stuff to lua/
Browse files Browse the repository at this point in the history
Hopefully the last time we need to move things around. Of course, by
saying that, I just guaranteed it won't be. Oh, well.
  • Loading branch information
narc0tiq committed Nov 18, 2013
1 parent d7041eb commit 834d0c1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bindist/
cataclysmdda-*
objwin/
src/version.h
src/lib/catalua/catabindings.cpp
lua/catabindings.cpp
CataclysmWin.cscope_file_list
CataclysmWin.depend
CataclysmWin.layout
Expand Down
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ W32TARGET = cataclysm.exe
BINDIST_DIR = bindist
BUILD_DIR = $(CURDIR)
SRC_DIR = src
LIB_DIR = src/lib
LUA_DIR = lua
LOCALIZE = 1

# tiles object directories are because gcc gets confused
Expand Down Expand Up @@ -187,9 +187,9 @@ ifdef LUA
endif

CXXFLAGS += -DLUA
LUA_DEPENDENCIES = $(LIB_DIR)/catalua/catabindings.cpp
BINDIST_EXTRAS += $(LIB_DIR)/catalua/catalua.lua
BINDIST_EXTRAS += $(LIB_DIR)/catalua/class_definitions.lua
LUA_DEPENDENCIES = $(LUA_DIR)/catabindings.cpp
BINDIST_EXTRAS += $(LUA_DIR)/autoexec.lua
BINDIST_EXTRAS += $(LUA_DIR)/class_definitions.lua
endif

ifdef TILES
Expand Down Expand Up @@ -324,8 +324,8 @@ $(ODIR)/SDLMain.o: $(SRC_DIR)/SDLMain.m

version.cpp: version

$(LIB_DIR)/catalua/catabindings.cpp: $(LIB_DIR)/catalua/class_definitions.lua $(LIB_DIR)/catalua/generate_bindings.lua
cd $(LIB_DIR)/catalua && lua generate_bindings.lua
$(LUA_DIR)/catabindings.cpp: $(LUA_DIR)/class_definitions.lua $(LUA_DIR)/generate_bindings.lua
cd $(LUA_DIR) && lua generate_bindings.lua

$(SRC_DIR)/catalua.cpp: $(LUA_DEPENDENCIES)

Expand All @@ -336,8 +336,7 @@ clean: clean-tests
rm -rf $(TARGET) $(TILESTARGET) $(W32TILESTARGET) $(W32TARGET)
rm -rf $(ODIR) $(W32ODIR) $(W32ODIRTILES)
rm -rf $(BINDIST) $(W32BINDIST) $(BINDIST_DIR)
rm -f $(SRC_DIR)/version.h $(LIB_DIR)/catalua/catabindings.cpp
rm -f version.h catalua/catabindings.cpp # old files
rm -f $(SRC_DIR)/version.h $(LUA_DIR)/catabindings.cpp

distclean:
rm -rf $(BINDIST_DIR)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/catalua/catalua.lua → lua/autoexec.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dofile("catalua/class_definitions.lua")
dofile("lua/class_definitions.lua")

function generate_metatable(name, class)
return {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ end

-- Generate our C++ source file with all wrappers for accessing variables and functions from lua.
-------------------------------------------------------------------------------------------------
local cpp_output = "// This file was automatically generated by catalua/generate_bindings.lua"..br
local cpp_output = "// This file was automatically generated by lua/generate_bindings.lua"..br

local lua_output = ""

Expand Down
8 changes: 4 additions & 4 deletions src/catalua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ ter_t* get_terrain_type(int id) {

// Manually implemented lua functions
//
// Most lua functions are generated by lib/catalua/generate_bindings.lua,
// these generated functions can be found in lib/catalua/catabindings.cpp
// Most lua functions are generated by lua/generate_bindings.lua,
// these generated functions can be found in lua/catabindings.cpp

/*
This function is commented out until I find a way to get a list of all
Expand Down Expand Up @@ -227,7 +227,7 @@ static int game_register_iuse(lua_State *L) {
return 0; // 0 return values
}

#include "lib/catalua/catabindings.cpp"
#include "../lua/catabindings.cpp"

// Registry containing all the game functions exported to lua.
// -----------------------------------------------------------
Expand All @@ -249,7 +249,7 @@ void game::init_lua() {
luaL_register(lua_state, "game", global_funcs);

// Load lua-side metatables etc.
luaL_dofile(lua_state,"lib/catalua/catalua.lua");
luaL_dofile(lua_state, "lua/autoexec.lua");

// Load main lua mod
int err = luaL_dofile(lua_state,"data/main.lua");
Expand Down

0 comments on commit 834d0c1

Please sign in to comment.