Small bug fixes

develop
Warmist 2012-03-18 16:23:31 +02:00
parent 3383aa7f6d
commit fe211acb71
3 changed files with 20 additions and 8 deletions

@ -512,6 +512,14 @@ function Allocate(size)
engine.poked(ptr,curptr) engine.poked(ptr,curptr)
return curptr-size+ptr return curptr-size+ptr
end end
function initType(object,...)
local m=getmetatable(object)
if m~=nil and m.__setup~=nil then
m.__setup(object,...)
else
error("This object does not have __setup function")
end
end
dofile("dfusion/patterns.lua") dofile("dfusion/patterns.lua")
dofile("dfusion/patterns2.lua") dofile("dfusion/patterns2.lua")
dofile("dfusion/itempatterns.lua") dofile("dfusion/itempatterns.lua")

@ -45,6 +45,14 @@ function mainmenu(t1)
end end
end end
end end
function RunSaved()
print("Locating saves...")
local str=df.world.cur_savegame.save_dir
print("Current region:"..str)
str="data/save/"..str.."/dfusion/init.lua"
print("Trying to run:"..str)
dofile_silent(str)
end
dofile("dfusion/common.lua") dofile("dfusion/common.lua")
dofile("dfusion/utils.lua") dofile("dfusion/utils.lua")
dofile("dfusion/offsets_misc.lua") dofile("dfusion/offsets_misc.lua")
@ -70,14 +78,7 @@ table.insert(plugins,{"saves","run current worlds's init.lua",RunSaved})
loadall(plugins) loadall(plugins)
dofile_silent("dfusion/initcustom.lua") dofile_silent("dfusion/initcustom.lua")
function RunSaved()
print("Locating saves...")
local str=df.world.cur_savegame.save_dir
print("Current region:"..str)
str="data/save/"..str.."/dfusion/init.lua"
print("Trying to run:"..str)
dofile_silent(str)
end
if not INIT then if not INIT then
mainmenu(plugins) mainmenu(plugins)
end end

@ -1,3 +1,6 @@
--<angavrilov> otherwise you just maintain alignment granularity in addition to size for all fields,
-- round up current offset to field alignment,
-- assign structs the max alignment of any field, and round up struct size to its alignment
function type_read(valtype,address) function type_read(valtype,address)
if valtype.issimple then if valtype.issimple then
--print("Simple read:"..tostring(valtype.ctype)) --print("Simple read:"..tostring(valtype.ctype))