From cfe4fa83d3c9185f3a784bbedb36d650d6904f25 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Wed, 30 Jun 2010 08:15:01 +0000
Subject: [PATCH] load fix
---
stead/stead.lua | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/stead/stead.lua b/stead/stead.lua
index 97b92f9..5040c0d 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -1320,7 +1320,7 @@ function for_everything(f, ...)
for_each(_G, '_G', f, is_ok, unpack(arg))
end
-function do_ini(self)
+function do_ini(self, load)
local v='',vv
local function call_key(k, o)
o.key_name = k;
@@ -1335,18 +1335,17 @@ function do_ini(self)
math.randomseed(tonumber(os.date("%m%d%H%M%S")))
rnd(1); rnd(1); rnd(1); -- Lua bug?
- for_each_object(call_key);
- for_each_codeblock(call_codekey);
- for_each_object(check_object);
- call_key("game", game);
-
game.pl = deref(game.pl);
game.where = deref(game.where);
- for_each(game, "game", check_list, isList, deref(game))
-
+ if not load then
+ for_each_object(call_key);
+ for_each_codeblock(call_codekey);
+ for_each_object(check_object);
+ call_key("game", game);
+ for_each(game, "game", check_list, isList, deref(game))
+ end
for_each_object(call_ini);
-
me():tag();
if not self.showlast then
self._lastdisp = nil;
@@ -1603,7 +1602,7 @@ function game_load(self, name)
if r then
return nil, false
end
- return do_ini(self);
+ return do_ini(self, true);
end
return nil, false
end
@@ -1928,6 +1927,9 @@ allocator = obj {
nam = 'allocator',
get = function(s, n, c)
local v = ref(c);
+ if not v then
+ error ("Null object in allocator: "..tostring(c));
+ end
v.key_name = n;
v.save = allocator_save;
v.constructor = c;