From cc830bb124306304a13ec97279220055b75ac90b Mon Sep 17 00:00:00 2001 From: Thomas Troeger Date: Fri, 7 Feb 2014 19:35:30 +0100 Subject: [PATCH 1/2] - added `build.lua' script published by Enno. --- support/build.lua | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 support/build.lua diff --git a/support/build.lua b/support/build.lua new file mode 100644 index 000000000..2f50f6679 --- /dev/null +++ b/support/build.lua @@ -0,0 +1,74 @@ +function size() + return 16 +end + +function island(pl, x, y, r) + gmtool.make_block(pl, x, y, r) + gmtool.make_island(pl, x+r/2+2, y+r/2, size() * 3) + gmtool.make_island(pl, x-r-2, y+r/2, size() * 3) + gmtool.make_island(pl, x-r/2-2, y-r/2, size() * 3) + gmtool.make_island(pl, x+r+2, y-r/2, size() * 3) + gmtool.make_island(pl, x+r/2+2, y-r-2, size() * 3) + gmtool.make_island(pl, x-r/2-2, y+r+2, size() * 3) +end + +function cross(pl, x, y, r) + gmtool.make_block(pl, x-r, y+r*2, r) + gmtool.make_block(pl, x+r*4/3, y, r) + gmtool.make_block(pl, x-r*4/3, y, r) + gmtool.make_block(pl, x+r, y-r*2, r) + + gmtool.make_island(pl, x, y, size() * 3) + gmtool.make_island(pl, x, y-r*4/3, size() * 3) + gmtool.make_island(pl, x, y+r*4/3, size() * 3) + gmtool.make_island(pl, x+r*4/3, y-r*4/3, size() * 3) + gmtool.make_island(pl, x-r*4/3, y+r*4/3, size() * 3) +end + +function count() + local i = 0 + for f in factions() do i = i + 1 end + print(i) +end + +function line(pl) + local m = 0 + local x, y + local i = 0 + x = 0 + y = i + local r = get_region(x, y, pl) + while true do + if r==nil then + if m==0 and (i>=0 or i<-10) then + local s = size() + gmtool.make_island(pl, x, y, s*3, s) + else + gmtool.make_block(pl, x, y, 6) + end + r = get_region(x, y, pl) + if r==nil then + r = region.create(x, y, "ocean", pl) + end + m = 1 - m + end + i = r.y + 1 + x = 0 + y = i + r = get_region(x, y, pl) + if r~=nil and r.y==0 then break end + end +end + +function build(pl) + cross(pl, -28, -20, 6) + island(pl, 28, -20, 11) + island(pl, -28, 20, 11) + island(pl, 28, 20, 11) + -- line(pl) +end + +eressea.free_game() +pl = plane.create(0, -50, -40, 90, 80) + +build(pl) From 59d5c1e94f7e4337b9d6636e0addc71206625bd0 Mon Sep 17 00:00:00 2001 From: Thomas Troeger Date: Sun, 16 Feb 2014 04:12:31 +0100 Subject: [PATCH 2/2] added missing case for `AT_DRAIN_EXP' (bug 1514). added assert that triggers if a unit has no faction. --- core/src/gamecode/laws.c | 1 + core/src/kernel/unit.c | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/gamecode/laws.c b/core/src/gamecode/laws.c index 7259612b3..c3c395f8b 100755 --- a/core/src/gamecode/laws.c +++ b/core/src/gamecode/laws.c @@ -2616,6 +2616,7 @@ static bool display_race(faction * f, unit * u, const race * rc) case AT_SPELL: case AT_COMBATSPELL: case AT_DRAIN_ST: + case AT_DRAIN_EXP: case AT_DAZZLE: bytes = snprintf(bufp, size, "%s", LOC(f->locale, "attack_magical")); break; diff --git a/core/src/kernel/unit.c b/core/src/kernel/unit.c index 256338325..8d304251d 100644 --- a/core/src/kernel/unit.c +++ b/core/src/kernel/unit.c @@ -225,6 +225,7 @@ int gift_items(unit * u, int flags) int rule = rule_give(); assert(u->region); + assert(u->faction); if ((u->faction->flags & FFL_QUIT) == 0 || (rule & GIVE_ONDEATH) == 0) { if ((rule & GIVE_ALLITEMS) == 0 && (flags & GIFT_FRIENDS))