Conflicts:
	plugins/Dfusion/luafiles/init.lua
develop
Petr Mrázek 2012-03-30 20:32:57 +02:00
commit 5d8415c8d9
3 changed files with 13 additions and 21 deletions

@ -1 +1 @@
Subproject commit 5651ab46643b87ad678e0b01b9376959d7a6745b Subproject commit 31e91326eb01e002f525cb48bba1cda0dab68977

@ -1,3 +1,6 @@
function print(msg)
Console.print(tostring(msg).."\n")
end
function err(msg) --make local maybe... function err(msg) --make local maybe...
print(msg) print(msg)
print(debug.traceback()) print(debug.traceback())

@ -290,39 +290,28 @@ function tools.empregnate(unit)
unit.curse.add_tags2.STERILE=false unit.curse.add_tags2.STERILE=false
end end
local arr1=unit.appearance.unk_51c local arr1=unit.appearance.unk_51c
local arr2=unit.appearance.unk_51c local arr2=unit.appearance.unk_524
local created=false
if unit.relations.pregnancy_ptr == nil then if unit.relations.pregnancy_ptr == nil then
print("creating preg ptr.") print("creating preg ptr.")
if false then if false then
print(string.format("%x %x",df.sizeof(unit.relations:_field("pregnancy_ptr")))) print(string.format("%x %x",df.sizeof(unit.relations:_field("pregnancy_ptr"))))
return return
end end
local size,offset=df.sizeof(unit.relations:_field("pregnancy_ptr")) unit.relations.pregnancy_ptr={ new = true, anon_1 = { assign = arr1 }, anon_2 = { assign = arr2 } }
local s1=df.sizeof(arr1)
local s2=df.sizeof(arr2)
engine.poked(offset,engine.alloc(s1+s2))
created=true
end end
local tarr1=unit.relations.pregnancy_ptr.anon_1 local tarr1=unit.relations.pregnancy_ptr.anon_1
local tarr2=unit.relations.pregnancy_ptr.anon_2 local tarr2=unit.relations.pregnancy_ptr.anon_2
if created or #tarr1~= #arr1 then if #tarr1~= #arr1 then
print("First array incorrect, fixing.")
print(string.format("Before: %d vs %d",#tarr1,#arr1)) print(string.format("Before: %d vs %d",#tarr1,#arr1))
print("Setting up arr1") tarr1:assign(arr1)
print(string.format("%x %x",df.sizeof(tarr1)))
--tarr1=arr1:new()
local size,offset=df.sizeof(tarr1)
engine.poked(offset,engine.alloc(#arr1))
engine.poked(offset+4,#arr1)
print(string.format("after: %d vs %d",#tarr1,#arr1)) print(string.format("after: %d vs %d",#tarr1,#arr1))
end end
if created or #tarr2~= #arr2 then if created or #tarr2~= #arr2 then
print("Setting up arr2") print("Second array incorrect, fixing.")
--tarr2=arr2:new() print(string.format("Before: %d vs %d",#tarr2,#arr2))
local size,offset=df.sizeof(tarr2) tarr2:assign(arr2)
print(string.format("after: %d vs %d",#tarr2,#arr2))
engine.poked(offset,engine.alloc(#arr2*2))
engine.poked(offset+4,#arr2)
end end
print("Setting preg timer.") print("Setting preg timer.")
unit.relations.pregnancy_timer=10 unit.relations.pregnancy_timer=10