diff --git a/s/git-reset b/s/git-reset new file mode 100755 index 000000000..df84d9bef --- /dev/null +++ b/s/git-reset @@ -0,0 +1,8 @@ +#/bin/sh +if [ ! -d .git ] ; then + echo "please run this script from the repository's top-level directory" + exit 1 +fi + +git submodule sync +git submodule update --init diff --git a/scripts/tests/e3a.lua b/scripts/tests/e3a.lua index f7123e328..7bfbf1619 100644 --- a/scripts/tests/e3a.lua +++ b/scripts/tests/e3a.lua @@ -240,7 +240,7 @@ function test_taxes() assert_equal(25, u:get_item("money")) end -function test_leave() +function test_region_owner_cannot_leave_castle() local r = region.create(0, 0, "plain") local f = faction.create("noreply@eressea.de", "human", "de") f.id = 42 diff --git a/src/eressea.pkg.c b/src/eressea.pkg.c index 612f30fcb..86691bb7f 100644 --- a/src/eressea.pkg.c +++ b/src/eressea.pkg.c @@ -1,6 +1,5 @@ /* ** Lua binding: eressea -** Generated automatically by tolua 5.1.3 on Sat Mar 15 19:26:36 2014. */ #include "tolua.h" @@ -160,6 +159,33 @@ static int tolua_eressea_eressea_export00(lua_State* tolua_S) #endif } +/* function: eressea_import_json */ +static int tolua_eressea_eressea_import00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const char* filename = ((const char*) tolua_tostring(tolua_S,1,0)); + { + int tolua_ret = (int) eressea_import_json(filename); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'import'.",&tolua_err); + return 0; +#endif +} + /* Open lib function */ LUALIB_API int luaopen_eressea (lua_State* tolua_S) { @@ -174,6 +200,7 @@ LUALIB_API int luaopen_eressea (lua_State* tolua_S) tolua_function(tolua_S,"write_game",tolua_eressea_eressea_write_game00); tolua_function(tolua_S,"read_orders",tolua_eressea_eressea_read_orders00); tolua_function(tolua_S,"export",tolua_eressea_eressea_export00); + tolua_function(tolua_S,"import",tolua_eressea_eressea_import00); tolua_endmodule(tolua_S); tolua_endmodule(tolua_S); return 1; diff --git a/src/json.c b/src/json.c index cd82847a3..40ad20c8c 100644 --- a/src/json.c +++ b/src/json.c @@ -83,7 +83,7 @@ int json_export(stream * out, unsigned int flags) { } if (flags) { char *tok, *output; - output = cJSON_Print(json); + output = cJSON_Print(root); tok = strtok(output, "\n\r"); while (tok) { if (tok[0]) {