fix preview crash in embassies.lua.

the "objects" dictionary is no longer of type hashtable, that usertype has been renamed to dict.
This commit is contained in:
Enno Rehling 2015-02-01 10:03:30 +01:00
parent a567fe9ed0
commit da9c33268c
8 changed files with 17 additions and 10 deletions

View File

@ -13,6 +13,7 @@ without prior permission by the authors of Eressea.
#include <platform.h> #include <platform.h>
#include "bind_building.h" #include "bind_building.h"
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_dict.h"
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/unit.h> #include <kernel/unit.h>
@ -42,7 +43,7 @@ int tolua_buildinglist_next(lua_State * L)
static int tolua_building_get_objects(lua_State * L) static int tolua_building_get_objects(lua_State * L)
{ {
building *self = (building *)tolua_tousertype(L, 1, 0); building *self = (building *)tolua_tousertype(L, 1, 0);
tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable"); tolua_pushusertype(L, (void *)&self->attribs, USERTYPE_DICT);
return 1; return 1;
} }

View File

@ -167,14 +167,14 @@ static int tolua_dict_set(lua_State * L)
void tolua_dict_open(lua_State * L) void tolua_dict_open(lua_State * L)
{ {
/* register user types */ /* register user types */
tolua_usertype(L, TOLUA_CAST "dict"); tolua_usertype(L, USERTYPE_DICT);
tolua_module(L, NULL, 0); tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL); tolua_beginmodule(L, NULL);
{ {
tolua_cclass(L, TOLUA_CAST "dict", TOLUA_CAST "dict", tolua_cclass(L, USERTYPE_DICT, USERTYPE_DICT,
TOLUA_CAST "", NULL); TOLUA_CAST "", NULL);
tolua_beginmodule(L, TOLUA_CAST "dict"); tolua_beginmodule(L, USERTYPE_DICT);
{ {
tolua_function(L, TOLUA_CAST "get", tolua_dict_get); tolua_function(L, TOLUA_CAST "get", tolua_dict_get);
tolua_function(L, TOLUA_CAST "set", tolua_dict_set); tolua_function(L, TOLUA_CAST "set", tolua_dict_set);

View File

@ -14,6 +14,8 @@ without prior permission by the authors of Eressea.
extern "C" { extern "C" {
#endif #endif
#define USERTYPE_DICT ((char *)"dict")
struct lua_State; struct lua_State;
void tolua_dict_open(struct lua_State *L); void tolua_dict_open(struct lua_State *L);

View File

@ -13,6 +13,7 @@ without prior permission by the authors of Eressea.
#include <platform.h> #include <platform.h>
#include "bind_faction.h" #include "bind_faction.h"
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_dict.h"
#include "bindings.h" #include "bindings.h"
#include "helpers.h" #include "helpers.h"
@ -226,7 +227,7 @@ static int tolua_faction_addnotice(lua_State * L)
static int tolua_faction_get_objects(lua_State * L) static int tolua_faction_get_objects(lua_State * L)
{ {
faction *self = (faction *)tolua_tousertype(L, 1, 0); faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable"); tolua_pushusertype(L, (void *)&self->attribs, USERTYPE_DICT);
return 1; return 1;
} }

View File

@ -14,6 +14,7 @@ without prior permission by the authors of Eressea.
#include "bind_region.h" #include "bind_region.h"
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_ship.h" #include "bind_ship.h"
#include "bind_dict.h"
#include "bind_building.h" #include "bind_building.h"
#include "chaos.h" #include "chaos.h"
@ -428,7 +429,7 @@ static int tolua_region_set_resource(lua_State * L)
static int tolua_region_get_objects(lua_State * L) static int tolua_region_get_objects(lua_State * L)
{ {
region *self = (region *)tolua_tousertype(L, 1, 0); region *self = (region *)tolua_tousertype(L, 1, 0);
tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable"); tolua_pushusertype(L, (void *)&self->attribs, USERTYPE_DICT);
return 1; return 1;
} }

View File

@ -13,6 +13,7 @@ without prior permission by the authors of Eressea.
#include <platform.h> #include <platform.h>
#include "bind_ship.h" #include "bind_ship.h"
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_dict.h"
#include "move.h" #include "move.h"
@ -117,7 +118,7 @@ static int tolua_ship_get_units(lua_State * L)
static int tolua_ship_get_objects(lua_State * L) static int tolua_ship_get_objects(lua_State * L)
{ {
ship *self = (ship *)tolua_tousertype(L, 1, 0); ship *self = (ship *)tolua_tousertype(L, 1, 0);
tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable"); tolua_pushusertype(L, (void *)&self->attribs, USERTYPE_DICT);
return 1; return 1;
} }

View File

@ -13,6 +13,7 @@ without prior permission by the authors of Eressea.
#include <platform.h> #include <platform.h>
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_dict.h"
#ifdef BSON_ATTRIB #ifdef BSON_ATTRIB
# include "bind_attrib.h" # include "bind_attrib.h"
#endif #endif
@ -59,7 +60,7 @@ without prior permission by the authors of Eressea.
static int tolua_unit_get_objects(lua_State * L) static int tolua_unit_get_objects(lua_State * L)
{ {
unit *self = (unit *)tolua_tousertype(L, 1, 0); unit *self = (unit *)tolua_tousertype(L, 1, 0);
tolua_pushusertype(L, (void *)&self->attribs, TOLUA_CAST "hashtable"); tolua_pushusertype(L, (void *)&self->attribs, USERTYPE_DICT);
return 1; return 1;
} }

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 5 #define VERSION_MINOR 4
#define VERSION_BUILD 697 #define VERSION_BUILD 698