diff --git a/src/common/modules/autoseed.c b/src/common/modules/autoseed.c index e3de3f055..ea3400dfc 100644 --- a/src/common/modules/autoseed.c +++ b/src/common/modules/autoseed.c @@ -51,7 +51,7 @@ random_terrain(boolean distribution) } } - n = rand() % distribution?ndistribution:nterrains; + n = rand() % (distribution?ndistribution:nterrains); for (terrain=terrains();terrain;terrain=terrain->next) { n -= distribution?terrain->distribution:1; if (n<0) break; diff --git a/src/eressea/lua/objects.cpp b/src/eressea/lua/objects.cpp index 5ca80a8f5..7845ad597 100644 --- a/src/eressea/lua/objects.cpp +++ b/src/eressea/lua/objects.cpp @@ -22,10 +22,10 @@ namespace eressea { object objects::get(const char * name) { + lua_State * L = (lua_State *)global.vm_state; attrib * a = a_find(*mAttribPtr, &at_object); for (;a;a=a->nexttype) { if (strcmp(object_name(a), name)==0) { - lua_State * L = (lua_State *)global.vm_state; variant val; object_type type; @@ -52,7 +52,7 @@ namespace eressea { } } } - return object(); // nil + return object(L); // nil } static void set_object(attrib **attribs, const char * name, object_type type, variant val) {