forked from github/server
Merge branch 'develop' of github.com:ennorehling/eressea into develop
This commit is contained in:
commit
00e39717e1
294 changed files with 1806 additions and 5086 deletions
LICENSELICENSE.mdREADME.mdclibsiniparser
process
res
scripts
src
academy.calchemy.calchemy.h
attributes
attributes.cattributes.hdict.cdict.hfollow.cfollow.hhate.chate.hiceberg.ciceberg.hkey.ckey.hmovement.cmovement.hotherfaction.cotherfaction.hoverrideroads.coverrideroads.hracename.cracename.hraceprefix.craceprefix.hreduceproduction.creduceproduction.hseenspell.ctargetregion.ctargetregion.h
automate.hbattle.cbattle.hbind_building.hbind_faction.cbind_faction.hbind_message.hbind_region.hbind_ship.hbind_storage.hbind_unit.cbind_unit.hbindings.cbindings.hchaos.cchaos.hconsole.hcreport.ccreport.heconomy.ceconomy.heconomy.test.cgive.cgive.hgmtool.cgmtool.hgmtool_structs.hguard.chelpers.chelpers.hitems.hitems
jsonconf.cjsonconf.hjsonconf.test.ckernel
15
LICENSE
15
LICENSE
|
@ -1,15 +0,0 @@
|
|||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
5
LICENSE.md
Normal file
5
LICENSE.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
|
||||
Eressea is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
||||
|
||||
* [](http://creativecommons.org/licenses/by-nc-sa/4.0/)
|
|
@ -21,3 +21,4 @@ If you got this far and all went well, you have built a server (it is linked fro
|
|||
|
||||
* [](https://scan.coverity.com/projects/6742/)
|
||||
* [](https://travis-ci.org/eressea/server)
|
||||
* [](http://creativecommons.org/licenses/by-nc-sa/4.0/)
|
||||
|
|
2
clibs
2
clibs
|
@ -1 +1 @@
|
|||
Subproject commit 6965050165efdae89305a13bff06283229f143f4
|
||||
Subproject commit abe774f70265de14ea7f5e530518ca130562a9c9
|
|
@ -1 +1 @@
|
|||
Subproject commit e3533ac0a45e43e9716c40f6a874bc6f41ddc96d
|
||||
Subproject commit 22741d9ce9d19bf7b5f5a219b6ed0925259a4d1b
|
|
@ -32,7 +32,7 @@ fi
|
|||
|
||||
if [ -e reports/reports.txt ] ; then
|
||||
echo "backup reports $TURN, game $GAME"
|
||||
tar cjf backup/$TURN-reports.tar.bz2 reports
|
||||
tar cjf backup/$TURN-reports.tar.bz2 reports eressea.db
|
||||
upload backup/$TURN-reports.tar.bz2
|
||||
fi
|
||||
files="data/$TURN.dat parteien.full parteien"
|
||||
|
|
|
@ -5291,6 +5291,7 @@
|
|||
<message name="pest" section="events">
|
||||
<type>
|
||||
<arg name="dead" type="int"/>
|
||||
<arg name="peasants" type="resource"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error131" section="errors">
|
||||
|
|
|
@ -8,6 +8,13 @@
|
|||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="galleon" range="5" storm="1.00" damage="1.00" cargo="2000000" cptskill="5" minskill="2" sumskill="250" opensea="yes">
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="5" maxsize="2000">
|
||||
<requirement type="log" quantity="1"/>
|
||||
</construction>
|
||||
</ship>
|
||||
|
||||
<ship name="caravel" range="5" storm="1.00" damage="1.00" cargo="300000" cptskill="3" minskill="1" sumskill="30" opensea="yes">
|
||||
<coast terrain="plain"/>
|
||||
<construction skill="shipcraft" minskill="3" maxsize="250">
|
||||
|
|
|
@ -2370,7 +2370,7 @@ msgid "sp_confusion_effect_0"
|
|||
msgstr "\"$unit($mage) stimmt einen seltsamen Gesang an. Ein plötzlicher Tumult entsteht, der sich jedoch schnell wieder legt.\""
|
||||
|
||||
msgid "pest"
|
||||
msgstr "\"Hier wütete die Pest, und $int($dead) Bauern starben.\""
|
||||
msgstr "\"Hier wütete die Pest, und $int($dead) $resource($peasants,$dead) $if($eq($dead,1), \"starb\", \"starben\").\""
|
||||
|
||||
msgid "wormhole_exit"
|
||||
msgstr "\"$unit($unit) reist durch ein Wurmloch nach $region($region).\""
|
||||
|
|
|
@ -2370,7 +2370,7 @@ msgid "sp_confusion_effect_0"
|
|||
msgstr "\"$unit($mage) intones a mysterious chant. There is a sudden hubbub, but order is restored quickly.\""
|
||||
|
||||
msgid "pest"
|
||||
msgstr "\"The region is visited by the plague and $int($dead) peasants died.\""
|
||||
msgstr "\"The region is visited by the plague and $int($dead) $resource($$peasants,$dead) died.\""
|
||||
|
||||
msgid "wormhole_exit"
|
||||
msgstr "\"$unit($unit) travels through a wormhole to $region($region).\""
|
||||
|
|
|
@ -570,8 +570,20 @@ msgstr "Dieses Ritual, ausgeführt vor einem Kampf, verwirbelt die astralen Ener
|
|||
msgid "balloon"
|
||||
msgstr "Ballon"
|
||||
|
||||
msgid "nr_schemes_postfix"
|
||||
msgstr "sind erkennbar."
|
||||
msgid "nr_schemes_template"
|
||||
msgstr "Schemen von {0} sind erkennbar."
|
||||
|
||||
msgid "list_two"
|
||||
msgstr "{0} und {1}"
|
||||
|
||||
msgid "list_start"
|
||||
msgstr "{0}, {1}"
|
||||
|
||||
msgid "list_middle"
|
||||
msgstr "{0}, {1}"
|
||||
|
||||
msgid "list_end"
|
||||
msgstr "{0} und {1}"
|
||||
|
||||
msgid "SILBER"
|
||||
msgstr "SILBER"
|
||||
|
@ -1707,6 +1719,9 @@ msgstr "Ring der Unsichtbarkeit"
|
|||
msgid "caravel_a"
|
||||
msgstr "eine Karavelle"
|
||||
|
||||
msgid "galleon_a"
|
||||
msgstr "eine Galeone"
|
||||
|
||||
msgctxt "keyword"
|
||||
msgid "describe"
|
||||
msgstr "BESCHREIBE"
|
||||
|
@ -2064,6 +2079,9 @@ msgstr "Wir schreiben %s des Monats %s im Jahre %d %s."
|
|||
msgid "caravel"
|
||||
msgstr "Karavelle"
|
||||
|
||||
msgid "galleon"
|
||||
msgstr "Galeone"
|
||||
|
||||
msgid "dragon_postfix_10"
|
||||
msgstr "der Goldene"
|
||||
|
||||
|
@ -4402,9 +4420,6 @@ msgstr "Magie"
|
|||
msgid "see_lighthouse"
|
||||
msgstr "vom Turm erblickt"
|
||||
|
||||
msgid "nr_schemes_prefix"
|
||||
msgstr "Schemen der Regionen"
|
||||
|
||||
msgid "aoc_p"
|
||||
msgstr "Katzenamulette"
|
||||
|
||||
|
|
|
@ -444,9 +444,6 @@ msgctxt "spellinfo"
|
|||
msgid "draigfumbleshield"
|
||||
msgstr "This ritual, performed before a battle, causes the astral energies on the battlefield to whirl and churn and thereby makes spellcasting more difficult for the enemy mages."
|
||||
|
||||
msgid "nr_schemes_postfix"
|
||||
msgstr "can be discerned."
|
||||
|
||||
msgid "SILBER"
|
||||
msgstr "SILVER"
|
||||
|
||||
|
@ -1458,6 +1455,12 @@ msgstr "DESCRIBE"
|
|||
msgid "roi"
|
||||
msgstr "ring of invisibility"
|
||||
|
||||
msgid "galleon_a"
|
||||
msgstr "a galleon"
|
||||
|
||||
msgid "galleon"
|
||||
msgstr "galleon"
|
||||
|
||||
msgid "caravel_a"
|
||||
msgstr "a caravel"
|
||||
|
||||
|
@ -3931,8 +3934,20 @@ msgstr "magic"
|
|||
msgid "see_lighthouse"
|
||||
msgstr "from lighthouse"
|
||||
|
||||
msgid "nr_schemes_prefix"
|
||||
msgstr "Schemes of "
|
||||
msgid "list_two"
|
||||
msgstr "{0} and {1}"
|
||||
|
||||
msgid "list_start"
|
||||
msgstr "{0}, {1}"
|
||||
|
||||
msgid "list_middle"
|
||||
msgstr "{0}, {1}"
|
||||
|
||||
msgid "list_end"
|
||||
msgstr "{0}, and {1}"
|
||||
|
||||
msgid "nr_schemes_template"
|
||||
msgstr "Schemes of {0} can be discerned."
|
||||
|
||||
msgid "aoc_p"
|
||||
msgstr "amulets of the kitten"
|
||||
|
|
|
@ -37,6 +37,7 @@ function use_snowglobe(u, amount, token, ord)
|
|||
local transform = {
|
||||
ocean = "glacier",
|
||||
firewall = "volcano",
|
||||
activevolcano = "volcano",
|
||||
volcano = "mountain",
|
||||
desert = "plain"
|
||||
}
|
||||
|
|
76
scripts/fix-death.lua
Normal file
76
scripts/fix-death.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
require 'config'
|
||||
|
||||
eressea.read_game('1137.dat')
|
||||
|
||||
local dead = {"cwz", "rama"}
|
||||
|
||||
|
||||
local function list_items(f)
|
||||
local items = {}
|
||||
for u in f.units do
|
||||
local r = u.region
|
||||
for name in u.items do
|
||||
local count = u:get_item(name)
|
||||
if not items[r.id] then
|
||||
items[r.id] = {}
|
||||
end
|
||||
if not items[r.id][name] then
|
||||
items[r.id][name] = count
|
||||
else
|
||||
items[r.id][name] = items[r.id][name] + count
|
||||
end
|
||||
end
|
||||
end
|
||||
return items
|
||||
end
|
||||
|
||||
gifts = {}
|
||||
info = {}
|
||||
|
||||
for _, no in ipairs(dead) do
|
||||
f = get_faction(no)
|
||||
gifts[f.id] = list_items(f)
|
||||
local allies = {}
|
||||
for fno, as in pairs(f.allies) do
|
||||
local f2 = get_faction(fno)
|
||||
if f2:get_ally(f, 'give') then
|
||||
allies[fno] = as
|
||||
end
|
||||
end
|
||||
info[f.id] = {
|
||||
['name'] = f.name,
|
||||
['race'] = f.race,
|
||||
['allies'] = allies
|
||||
}
|
||||
end
|
||||
|
||||
eressea.free_game()
|
||||
eressea.read_game('1138.dat')
|
||||
|
||||
newf = {}
|
||||
|
||||
for fid, rlist in pairs(gifts) do
|
||||
local name = "Erben von " .. info[fid].name
|
||||
local race = info[fid].race
|
||||
local f = faction.create(race, "noreply@eressea.de")
|
||||
f.name = name
|
||||
f.age = 10
|
||||
f.lastturn = 1130
|
||||
table.insert(newf, f)
|
||||
for rid, items in pairs(rlist) do
|
||||
local r = get_region_by_id(rid)
|
||||
local u = unit.create(f, r, 1)
|
||||
for name, count in pairs(items) do
|
||||
u:add_item(name, count)
|
||||
end
|
||||
end
|
||||
for fno, as in pairs(info[fid].allies) do
|
||||
local f2 = get_faction(fno)
|
||||
for _, s in ipairs(as) do
|
||||
f:set_ally(f2, s)
|
||||
end
|
||||
f2:set_ally(f, "give")
|
||||
end
|
||||
end
|
||||
|
||||
eressea.write_game('1138.new.dat')
|
|
@ -37,6 +37,18 @@ function setup()
|
|||
eressea.settings.set("study.random_progress", "0")
|
||||
end
|
||||
|
||||
function test_set_faction()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = create_faction('elf')
|
||||
local f2 = create_faction('elf')
|
||||
local u = one_unit(r, f1)
|
||||
u.group = 'Experten'
|
||||
assert_equal('Experten', u.group)
|
||||
u.faction = f2
|
||||
assert_equal(f2, u.faction)
|
||||
assert_nil(u.group)
|
||||
end
|
||||
|
||||
function test_locales()
|
||||
assert_equal(2, eressea.locale.direction("de", "Ost"))
|
||||
assert_equal(5, eressea.locale.direction("de", "westen"))
|
||||
|
@ -1122,19 +1134,6 @@ function test_route_pause()
|
|||
assert_equal(r1, u.region)
|
||||
end
|
||||
|
||||
function test_bug_2393_cart()
|
||||
local r1 = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local f = faction.create("human", "cart@example.com")
|
||||
local u = unit.create(f, r1, 2)
|
||||
u:add_order("NACH O")
|
||||
u:add_item('stone', 2)
|
||||
u:add_item('horse', 2)
|
||||
u:add_item('cart', 1)
|
||||
process_orders()
|
||||
assert_equal(r1, u.region)
|
||||
end
|
||||
|
||||
function test_immunity_stops_guard()
|
||||
eressea.settings.set("NewbieImmunity", 2)
|
||||
local f = faction.create('human')
|
||||
|
|
30
scripts/tests/e2/allies.lua
Normal file
30
scripts/tests/e2/allies.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "lunit"
|
||||
|
||||
module("tests.e2.allies", package.seeall, lunit.testcase)
|
||||
|
||||
function skip_test_get_set_ally()
|
||||
local f1 = faction.create("human")
|
||||
local f2 = faction.create("human")
|
||||
|
||||
assert_equal(false, f1:get_ally(f2, "guard"))
|
||||
f1:set_ally(f2, "guard", true)
|
||||
assert_equal(true, f1:get_ally(f2, "guard"))
|
||||
assert_equal(false, f1:get_ally(f2, "give"))
|
||||
f1:set_ally(f2, "give", true)
|
||||
assert_equal(true, f1:get_ally(f2, "give"))
|
||||
end
|
||||
|
||||
function test_get_allies()
|
||||
local f1 = faction.create("human")
|
||||
local f2 = faction.create("human")
|
||||
|
||||
local allies = f1.allies
|
||||
assert_equal('table', type(allies))
|
||||
assert_equal(0, #allies)
|
||||
f1:set_ally(f2, "give", true)
|
||||
allies = f1.allies
|
||||
assert_not_nil(allies[f2.id])
|
||||
assert_equal('table', type(allies[f2.id]))
|
||||
assert_equal(1, #allies[f2.id])
|
||||
assert_equal("give", allies[f2.id][1])
|
||||
end
|
234
scripts/tests/e2/carts.lua
Normal file
234
scripts/tests/e2/carts.lua
Normal file
|
@ -0,0 +1,234 @@
|
|||
require "lunit"
|
||||
|
||||
module("tests.e2.carts", package.seeall, lunit.testcase)
|
||||
|
||||
function setup()
|
||||
eressea.free_game()
|
||||
eressea.settings.set("rules.food.flags", "4")
|
||||
eressea.settings.set("nmr.timeout", "0")
|
||||
eressea.settings.set("NewbieImmunity", "0")
|
||||
end
|
||||
|
||||
function test_walk()
|
||||
local r1 = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local f = faction.create("human", "pirate@eressea.de", "de")
|
||||
local u1 = unit.create(f, r1, 1)
|
||||
local u2 = unit.create(f, r1, 2)
|
||||
local u3 = unit.create(f, r1, 1)
|
||||
u1:add_item("money", 540)
|
||||
u1:add_order("NACH O")
|
||||
u2:add_item("money", 1080)
|
||||
u2:add_order("NACH O")
|
||||
u3:add_item("money", 541)
|
||||
u3:add_order("NACH O")
|
||||
process_orders()
|
||||
assert_equal(r2, u1.region)
|
||||
assert_equal(r2, u2.region)
|
||||
assert_equal(r1, u3.region)
|
||||
end
|
||||
|
||||
function test_lead_horses()
|
||||
local r1 = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local r3 = region.create(2, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
-- walk (don't ride) a horse to the next region:
|
||||
local u1 = unit.create(f, r1, 1)
|
||||
u1:add_item("horse", 1)
|
||||
u1:add_item("money", 2540)
|
||||
u1:add_order("NACH O O")
|
||||
-- too heavy to move:
|
||||
local u2 = unit.create(f, r1, 1)
|
||||
u2:add_item("horse", 1)
|
||||
u2:add_item("money", 2541)
|
||||
u2:add_order("NACH O O")
|
||||
-- too many horses:
|
||||
local u3 = unit.create(f, r1, 1)
|
||||
u3:add_item("horse", 2)
|
||||
u3:add_item("money", 2540)
|
||||
u3:add_order("NACH O O")
|
||||
-- riders can lead 4 extra horses per level:
|
||||
local u4 = unit.create(f, r1, 1)
|
||||
u4:set_skill("riding", 1)
|
||||
u4:add_item("horse", 5)
|
||||
u4:add_item("money", 540+2000*5)
|
||||
u4:add_order("NACH O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r2, u1.region)
|
||||
assert_equal(r1, u2.region)
|
||||
assert_equal(r1, u3.region)
|
||||
assert_equal(r2, u4.region)
|
||||
end
|
||||
|
||||
function test_ride_horses()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
-- ride a horse two regions:
|
||||
local u1 = unit.create(f, r0, 1)
|
||||
u1:set_skill("riding", 1)
|
||||
u1:add_item("horse", 1)
|
||||
u1:add_item("money", 1000)
|
||||
u1:add_order("NACH O O O")
|
||||
-- too heavy to ride, walk the horse:
|
||||
local u2 = unit.create(f, r0, 1)
|
||||
u2:set_skill("riding", 1)
|
||||
u2:add_item("horse", 1)
|
||||
u2:add_item("money", 2001)
|
||||
u2:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
-- mit 20 GE beladenes Pferd kommt 2 Regionen weit:
|
||||
assert_equal(r2, u1.region)
|
||||
-- überladenes Pferd kommt nur eine Region weit, zu Fuss:
|
||||
assert_equal(r1, u2.region)
|
||||
end
|
||||
|
||||
function test_rider_leads_horses()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
-- lead 1 extra horse per level while riding:
|
||||
local u1 = unit.create(f, r0, 1)
|
||||
u1:set_skill("riding", 1)
|
||||
u1:add_item("horse", 2)
|
||||
u1:add_order("NACH O O O")
|
||||
-- too heavy to ride, walk the horses:
|
||||
local u2 = unit.create(f, r0, 1)
|
||||
u2:set_skill("riding", 1)
|
||||
u2:add_item("horse", 2)
|
||||
u2:add_item("money", 2000 * 2)
|
||||
u2:add_order("NACH O O")
|
||||
-- too many horses, but can walk:
|
||||
local u3 = unit.create(f, r0, 1)
|
||||
u3:set_skill("riding", 1)
|
||||
u3:add_item("horse", 5)
|
||||
u3:add_order("NACH O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r2, u1.region)
|
||||
assert_equal(r1, u2.region)
|
||||
assert_equal(r1, u3.region)
|
||||
end
|
||||
|
||||
function test_carts()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
-- 1. two walkers, each with two horses and a cart:
|
||||
local u1 = unit.create(f, r0, 2)
|
||||
u1:add_item("horse", 2)
|
||||
u1:add_item("cart", 1)
|
||||
u1:add_order("NACH O O O")
|
||||
-- 2. two riders, each with two horses and a cart:
|
||||
local u2 = unit.create(f, r0, 2)
|
||||
u2:set_skill("riding", 1)
|
||||
u2:add_item("horse", 4)
|
||||
u2:add_item("cart", 2)
|
||||
u2:add_order("NACH O O O")
|
||||
-- 2. two riders, each with five horses, and max carts:
|
||||
local u3 = unit.create(f, r0, 2)
|
||||
u3:set_skill("riding", 1)
|
||||
u3:add_item("horse", 10)
|
||||
u3:add_item("cart", 5)
|
||||
u3:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r1, u1.region)
|
||||
assert_equal(r2, u2.region)
|
||||
assert_equal(r1, u3.region)
|
||||
end
|
||||
|
||||
function test_walking_carts()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
-- 1. ten riders walk with 50 horses and 25 carts, carry 3554 GE:
|
||||
local u1 = unit.create(f, r0, 10)
|
||||
u1:set_skill("riding", 1)
|
||||
u1:add_item("horse", 50)
|
||||
u1:add_item("cart", 25)
|
||||
u1:add_item("money", 355400)
|
||||
u1:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r1, u1.region)
|
||||
end
|
||||
|
||||
function test_trolls_pull_carts()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("troll")
|
||||
-- 1. 20 trolls can pull 5 loaded carts:
|
||||
local u1 = unit.create(f, r0, 20)
|
||||
u1:add_item("cart", 5)
|
||||
-- trolls carry 10.8 GE, carts carry 100 GE:
|
||||
u1:add_item("money", 100 * (5 * 100 + 2 * 108))
|
||||
u1:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r1, u1.region)
|
||||
|
||||
u1:add_item("money", 1) -- just one wafer thin mint
|
||||
process_orders()
|
||||
assert_equal(r1, u1.region)
|
||||
end
|
||||
|
||||
function test_trolls_with_horses()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("troll")
|
||||
-- 1. 20 trolls can pull 5 loaded carts:
|
||||
local u1 = unit.create(f, r0, 20)
|
||||
u1:add_item("cart", 5)
|
||||
-- trolls carry 10.8 GE, carts carry 100 GE:
|
||||
u1:add_item("money", 100 * (5 * 100 + 2 * 108))
|
||||
u1:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r1, u1.region)
|
||||
|
||||
u1:add_item("horse", 20)
|
||||
u1:add_item("money", 100 * 20 * 20)
|
||||
process_orders()
|
||||
assert_equal(r2, u1.region)
|
||||
end
|
||||
|
||||
function test_trolls_ride_carts()
|
||||
local r0 = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local r4 = region.create(4, 0, "plain")
|
||||
local f = faction.create("troll")
|
||||
-- 1. 20 trolls can pull 5 loaded carts:
|
||||
local u1 = unit.create(f, r0, 20)
|
||||
u1:add_item("cart", 5)
|
||||
-- but with 10 or more horses, they should ride in the cart:
|
||||
u1:set_skill("riding", 1, true)
|
||||
u1:add_item("horse", 10)
|
||||
-- trolls weigh 20 GE, horses carry 20, carts carry 100 GE:
|
||||
u1:add_item("money", 100 * (10 * 20 + 5 * 100 - u1.number * 20))
|
||||
u1:add_order("NACH O O O")
|
||||
|
||||
process_orders()
|
||||
assert_equal(r2, u1.region)
|
||||
|
||||
u1:add_item("money", 1) -- just one wafer thin mint
|
||||
process_orders()
|
||||
assert_equal(r3, u1.region) -- can still walk
|
||||
end
|
|
@ -12,6 +12,23 @@ function setup()
|
|||
eressea.settings.set("rules.peasants.growth.factor", "0")
|
||||
end
|
||||
|
||||
function test_give_unit()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create('elf')
|
||||
local f2 = faction.create('elf')
|
||||
local u1 = unit.create(f1, r)
|
||||
local u2 = unit.create(f2, r)
|
||||
assert_equal(f1, u1.faction)
|
||||
assert_equal(f2, u2.faction)
|
||||
u2.group = 'Experten'
|
||||
assert_equal('Experten', u2.group)
|
||||
u1:add_order("HELFE " .. itoa36(f2.id) .. " GIB")
|
||||
u2:add_order("GIB " .. itoa36(u1.id) .. " EINHEIT")
|
||||
process_orders()
|
||||
assert_equal(f1, u2.faction)
|
||||
assert_nil(u2.group)
|
||||
end
|
||||
|
||||
function test_study_auto()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'tests.e2.carts'
|
||||
require 'tests.e2.quit'
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.astral'
|
||||
|
|
|
@ -85,3 +85,30 @@ function test_recruit_in_desert()
|
|||
assert_equal('winter', get_season(get_turn()))
|
||||
assert_equal(2, u.number)
|
||||
end
|
||||
|
||||
function test_ride_through_mountain()
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local r2 = region.create(2, 0, "mountain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r1, 1)
|
||||
u.name="Hercules"
|
||||
u:add_order('NACH O O')
|
||||
u:add_item('horse', 1)
|
||||
u:set_skill('riding', 1, true)
|
||||
process_orders()
|
||||
assert_equal(r3, u.region)
|
||||
end
|
||||
|
||||
function test_ride_from_mountain()
|
||||
local r1 = region.create(1, 0, "mountain")
|
||||
local r2 = region.create(2, 0, "plain")
|
||||
local r3 = region.create(3, 0, "plain")
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r1, 1)
|
||||
u:add_order('NACH O O')
|
||||
u:add_item('horse', 1)
|
||||
u:set_skill('riding', 1, true)
|
||||
process_orders()
|
||||
assert_equal(r2, u.region)
|
||||
end
|
||||
|
|
|
@ -134,63 +134,3 @@ function assert_capacity(text, u, silver, r1, r2, rx)
|
|||
process_orders()
|
||||
assert_equal(rx, u.region, text .. "unit should not move")
|
||||
end
|
||||
|
||||
function test_dwarf_example()
|
||||
local r1 = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
region.create(2, 0, "plain")
|
||||
local f = faction.create("dwarf", "dwarf@example.com", "de")
|
||||
local u = unit.create(f, r1, 5)
|
||||
u:add_item("horse", 5)
|
||||
u:add_item("cart", 2)
|
||||
|
||||
-- 5 dwarves + 5 horse - 2 carts = 27 + 100 - 80 = 47.00
|
||||
assert_capacity("dwarves", u, 4700, r1, r2)
|
||||
|
||||
u:set_skill("riding", 3)
|
||||
assert_equal(1, u:eff_skill("riding"))
|
||||
-- 5 dwarves + 5 horses + 2 carts = 327.00
|
||||
assert_capacity("riding", u, 32700, r1, r2)
|
||||
|
||||
end
|
||||
|
||||
function test_troll_example()
|
||||
local r1 = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local r3 = region.create(2, 0, "plain")
|
||||
local f = faction.create("troll", "troll@example.com", "de")
|
||||
local u1 = unit.create(f, r1, 3)
|
||||
|
||||
u1:add_item("cart", 1)
|
||||
u1:clear_orders()
|
||||
|
||||
-- 3 trolls - 1 cart = 320, but not allowed?
|
||||
u1.name='XXX'
|
||||
assert_nomove("3 trolls", u1)
|
||||
|
||||
u1.number = 4
|
||||
|
||||
-- 4 trolls + 1 cart = 14320
|
||||
assert_capacity("1 cart", u1, 14320, r1, r2)
|
||||
|
||||
|
||||
u1:add_item("horse", 4)
|
||||
-- 4 horses, 4 trolls, 1 cart
|
||||
assert_capacity("4 horses", u1, 22320, r1, r2)
|
||||
|
||||
|
||||
u1:add_item("cart", 1)
|
||||
|
||||
-- 4 horses + 4 trolls + 1 cart - 1 cart
|
||||
assert_capacity("2 carts", u1, 18320, r1, r2)
|
||||
|
||||
u1:set_skill("riding", 3)
|
||||
assert_equal(1, u1:eff_skill("riding"))
|
||||
|
||||
-- 4 horses + 4 trolls + 2 carts = 323.20
|
||||
assert_capacity("walking", u1, 32320, r1, r2)
|
||||
|
||||
-- 4 horses + 2 carts - 4 trolls = 200.00
|
||||
assert_capacity("riding", u1, 20000, r1, r3, r2)
|
||||
|
||||
end
|
||||
|
|
|
@ -36,6 +36,20 @@ function teardown()
|
|||
end
|
||||
end
|
||||
|
||||
function test_new_faction_cannot_give_unit()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create('elf')
|
||||
local f2 = faction.create('elf')
|
||||
local u1 = unit.create(f1, r)
|
||||
local u2 = unit.create(f2, r)
|
||||
assert_equal(f1, u1.faction)
|
||||
assert_equal(f2, u2.faction)
|
||||
u1:add_order("HELFE " .. itoa36(f2.id) .. " GIB")
|
||||
u2:add_order("GIB " .. itoa36(u1.id) .. " EINHEIT")
|
||||
process_orders()
|
||||
assert_equal(f2, u2.faction)
|
||||
end
|
||||
|
||||
function test_calendar()
|
||||
assert_equal("winter", get_season(396))
|
||||
end
|
||||
|
|
|
@ -94,7 +94,9 @@ function test_lighthouse()
|
|||
eressea.free_game()
|
||||
local r = region.create(0, 0, "mountain")
|
||||
local f = faction.create("human", "human@example.com")
|
||||
region.create(1, 0, "mountain")
|
||||
local f2 = faction.create("dwarf")
|
||||
local r2 = region.create(1, 0, "mountain")
|
||||
unit.create(f2, r2, 1).name = 'The Babadook'
|
||||
region.create(2, 0, "ocean")
|
||||
region.create(0, 1, "firewall")
|
||||
region.create(3, 0, "ocean")
|
||||
|
@ -110,12 +112,13 @@ function test_lighthouse()
|
|||
|
||||
init_reports()
|
||||
write_report(f)
|
||||
assert_false(find_in_report(f, " %(1,0%) %(vom Turm erblickt%)"))
|
||||
assert_false(find_in_report(f, "The Babadook"))
|
||||
assert_true(find_in_report(f, " %(1,0%) %(vom Turm erblickt%)"))
|
||||
assert_true(find_in_report(f, " %(2,0%) %(vom Turm erblickt%)"))
|
||||
assert_true(find_in_report(f, " %(3,0%) %(vom Turm erblickt%)"))
|
||||
assert_true(find_in_report(f, " %(0,1%) %(vom Turm erblickt%)"))
|
||||
|
||||
assert_false(find_in_report(f, " %(0,0%) %(vom Turm erblickt%)"))
|
||||
assert_false(find_in_report(f, " %(0,1%) %(vom Turm erblickt%)"))
|
||||
assert_false(find_in_report(f, " %(4,0%) %(vom Turm erblickt%)"))
|
||||
remove_report(f)
|
||||
end
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include "platform.h"
|
||||
#include "kernel/config.h"
|
||||
#include <kernel/unit.h>
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "alchemy.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_KRNL_ALCHEMY_H
|
||||
#define H_KRNL_ALCHEMY_H
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "attributes.h"
|
||||
|
@ -196,7 +178,6 @@ void register_attributes(void)
|
|||
at_register(&at_group);
|
||||
|
||||
at_register(&at_building_generic_type);
|
||||
at_register(&at_npcfaction);
|
||||
|
||||
/* connection-typen */
|
||||
register_bordertype(&bt_noway);
|
||||
|
@ -205,6 +186,7 @@ void register_attributes(void)
|
|||
register_bordertype(&bt_illusionwall);
|
||||
register_bordertype(&bt_road);
|
||||
|
||||
at_deprecate("npcfaction", a_readint);
|
||||
at_deprecate("siege", a_readint);
|
||||
at_deprecate("maxmagicians", a_readint); /* factions with differnt magician limits, probably unused */
|
||||
at_deprecate("hurting", a_readint); /* an old arena attribute */
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_ATTRIBUTES
|
||||
#define H_ATTRIBUTE_ATTRIBUTES
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "dict.h"
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_ATTRIBUTE_OBJECT
|
||||
#define H_ATTRIBUTE_OBJECT
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include "follow.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_FOLLOW
|
||||
#define H_ATTRIBUTE_FOLLOW
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "hate.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_HATE
|
||||
#define H_ATTRIBUTE_HATE
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "iceberg.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_ICEBERG
|
||||
#define H_ATTRIBUTE_ICEBERG
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "key.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_KEY
|
||||
#define H_ATTRIBUTE_KEY
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "movement.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_MOVEMENT
|
||||
#define H_ATTRIBUTE_MOVEMENT
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "otherfaction.h"
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "overrideroads.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_OVERRRIDEROADS
|
||||
#define H_ATTRIBUTE_OVERRRIDEROADS
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "racename.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_RACENAME_H
|
||||
#define H_ATTRIBUTE_RACENAME_H
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "raceprefix.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_RACEPREFIX
|
||||
#define H_ATTRIBUTE_RACEPREFIX
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "reduceproduction.h"
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_REDUCEPRODUCTION
|
||||
#define H_ATTRIBUTE_REDUCEPRODUCTION
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include "targetregion.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ATTRIBUTE_TARGETREGION
|
||||
#define H_ATTRIBUTE_TARGETREGION
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2018, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef H_GC_AUTOMATE
|
||||
|
|
108
src/battle.c
108
src/battle.c
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
@ -1171,7 +1153,8 @@ static void destroy_items(troop dt) {
|
|||
}
|
||||
|
||||
static void calculate_defense_type(troop at, troop dt, int type, bool missile,
|
||||
const weapon_type **dwtype, int *defskill) {
|
||||
const weapon_type **dwtype, int *defskill)
|
||||
{
|
||||
const weapon *weapon;
|
||||
weapon = select_weapon(dt, false, true); /* missile=true to get the unmodified best weapon she has */
|
||||
*defskill = weapon_effskill(dt, at, weapon, false, false);
|
||||
|
@ -1180,9 +1163,9 @@ static void calculate_defense_type(troop at, troop dt, int type, bool missile,
|
|||
}
|
||||
|
||||
static void calculate_attack_type(troop at, troop dt, int type, bool missile,
|
||||
const weapon_type **awtype, int *attskill, bool *magic) {
|
||||
const weapon_type **awtype, int *attskill, bool *magic) {
|
||||
const weapon *weapon;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case AT_STANDARD:
|
||||
weapon = select_weapon(at, true, missile);
|
||||
|
@ -1209,10 +1192,10 @@ static int crit_damage(int attskill, int defskill, const char *damage_formula) {
|
|||
if (rule_damage & DAMAGE_CRITICAL) {
|
||||
double kritchance = ((double)attskill * 3.0 - (double)defskill) / 200.0;
|
||||
int maxk = 4;
|
||||
|
||||
|
||||
kritchance = fmax(kritchance, 0.005);
|
||||
kritchance = fmin(0.9, kritchance);
|
||||
|
||||
|
||||
while (maxk-- && chance(kritchance)) {
|
||||
damage += dice_rand(damage_formula);
|
||||
}
|
||||
|
@ -1221,21 +1204,21 @@ static int crit_damage(int attskill, int defskill, const char *damage_formula) {
|
|||
}
|
||||
|
||||
static int apply_race_resistance(int reduced_damage, fighter *df,
|
||||
const weapon_type *awtype, bool magic) {
|
||||
const weapon_type *awtype, bool magic) {
|
||||
unit *du = df->unit;
|
||||
|
||||
|
||||
if ((u_race(du)->battle_flags & BF_INV_NONMAGIC) && !magic)
|
||||
reduced_damage = 0;
|
||||
else {
|
||||
unsigned int i = 0;
|
||||
|
||||
|
||||
if (u_race(du)->battle_flags & BF_RES_PIERCE)
|
||||
i |= WTF_PIERCE;
|
||||
if (u_race(du)->battle_flags & BF_RES_CUT)
|
||||
i |= WTF_CUT;
|
||||
if (u_race(du)->battle_flags & BF_RES_BASH)
|
||||
i |= WTF_BLUNT;
|
||||
|
||||
|
||||
if (i && awtype && fval(awtype, i))
|
||||
reduced_damage /= 2;
|
||||
}
|
||||
|
@ -1243,21 +1226,21 @@ static int apply_race_resistance(int reduced_damage, fighter *df,
|
|||
}
|
||||
|
||||
static int apply_magicshield(int reduced_damage, fighter *df,
|
||||
const weapon_type *awtype, battle *b, bool magic) {
|
||||
const weapon_type *awtype, battle *b, bool magic) {
|
||||
side *ds = df->side;
|
||||
selist *ql;
|
||||
int qi;
|
||||
|
||||
|
||||
if (reduced_damage <= 0)
|
||||
return 0;
|
||||
|
||||
|
||||
/* Schilde */
|
||||
for (qi = 0, ql = b->meffects; ql; selist_advance(&ql, &qi, 1)) {
|
||||
meffect *me = (meffect *)selist_get(ql, qi);
|
||||
if (meffect_protection(b, me, ds) != 0) {
|
||||
assert(0 <= reduced_damage); /* rda sollte hier immer mindestens 0 sein */
|
||||
/* jeder Schaden wird um effect% reduziert bis der Schild duration
|
||||
* Trefferpunkte aufgefangen hat */
|
||||
/* jeder Schaden wird um effect% reduziert bis der Schild duration
|
||||
* Trefferpunkte aufgefangen hat */
|
||||
if (me->typ == SHIELD_REDUCE) {
|
||||
int hp = reduced_damage * (me->effect / 100);
|
||||
reduced_damage -= hp;
|
||||
|
@ -1283,14 +1266,11 @@ terminate(troop dt, troop at, int type, const char *damage_formula, bool missile
|
|||
unit *au = af->unit;
|
||||
unit *du = df->unit;
|
||||
battle *b = df->side->battle;
|
||||
|
||||
int armor_value;
|
||||
|
||||
const weapon_type *dwtype = NULL;
|
||||
const weapon_type *awtype = NULL;
|
||||
const armor_type *armor = NULL;
|
||||
const armor_type *shield = NULL;
|
||||
|
||||
int reduced_damage, attskill = 0, defskill = 0;
|
||||
bool magic = false;
|
||||
|
||||
|
@ -1303,63 +1283,63 @@ terminate(troop dt, troop at, int type, const char *damage_formula, bool missile
|
|||
calculate_defense_type(at, dt, type, missile, &dwtype, &defskill);
|
||||
|
||||
if (is_riding(at) && (awtype == NULL || (fval(awtype, WTF_HORSEBONUS)
|
||||
&& !fval(awtype, WTF_MISSILE)))) {
|
||||
&& !fval(awtype, WTF_MISSILE)))) {
|
||||
damage += CavalryBonus(au, dt, BONUS_DAMAGE);
|
||||
}
|
||||
|
||||
|
||||
armor = select_armor(dt, false);
|
||||
shield = select_armor(dt, true);
|
||||
|
||||
|
||||
armor_value = calculate_armor(dt, dwtype, awtype, armor, shield, magic);
|
||||
if (armor_value < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
damage = apply_resistance(damage, dt, dwtype, armor, shield, magic);
|
||||
|
||||
|
||||
if (type != AT_COMBATSPELL && type != AT_SPELL) {
|
||||
damage += crit_damage(attskill, defskill, damage_formula);
|
||||
|
||||
|
||||
damage += rc_specialdamage(au, du, awtype);
|
||||
|
||||
|
||||
if (awtype == NULL || !fval(awtype, WTF_MISSILE)) {
|
||||
/* melee bonus */
|
||||
if (rule_damage & DAMAGE_MELEE_BONUS) {
|
||||
damage += af->person[at.index].damage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Skilldifferenzbonus */
|
||||
if (rule_damage & DAMAGE_SKILL_BONUS) {
|
||||
int b = (attskill - defskill) / DAMAGE_QUOTIENT;
|
||||
if (b > 0) damage += b;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
reduced_damage = damage - armor_value;
|
||||
if (reduced_damage < 0) reduced_damage = 0;
|
||||
|
||||
|
||||
reduced_damage = apply_race_resistance(reduced_damage, df, awtype, magic);
|
||||
reduced_damage = apply_magicshield(reduced_damage, df, awtype, b, magic);
|
||||
|
||||
|
||||
assert(dt.index >= 0 && dt.index < du->number);
|
||||
if (reduced_damage > 0) {
|
||||
df->person[dt.index].hp -= reduced_damage;
|
||||
|
||||
|
||||
vampirism(at, reduced_damage);
|
||||
|
||||
|
||||
ship_damage(b->turn, du);
|
||||
}
|
||||
|
||||
|
||||
if (survives(af, dt, b))
|
||||
return false;
|
||||
|
||||
|
||||
++at.fighter->kills;
|
||||
|
||||
|
||||
destroy_items(dt);
|
||||
|
||||
|
||||
kill_troop(dt);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1369,13 +1349,13 @@ count_side(const side * s, const side * vs, int minrow, int maxrow, int select)
|
|||
fighter *fig;
|
||||
int people = 0;
|
||||
int unitrow[NUMROWS];
|
||||
|
||||
|
||||
if (maxrow < FIGHT_ROW)
|
||||
return 0;
|
||||
if (select & SELECT_ADVANCE) {
|
||||
memset(unitrow, -1, sizeof(unitrow));
|
||||
}
|
||||
|
||||
|
||||
for (fig = s->fighters; fig; fig = fig->next) {
|
||||
if (fig->alive - fig->removed > 0) {
|
||||
int row = statusrow(fig->status);
|
||||
|
@ -1396,18 +1376,18 @@ count_side(const side * s, const side * vs, int minrow, int maxrow, int select)
|
|||
}
|
||||
|
||||
/* return the number of live allies warning: this function only considers
|
||||
* troops that are still alive, not those that are still fighting although
|
||||
* dead. */
|
||||
* troops that are still alive, not those that are still fighting although
|
||||
* dead. */
|
||||
int
|
||||
count_allies(const side * as, int minrow, int maxrow, int select, int allytype)
|
||||
{
|
||||
battle *b = as->battle;
|
||||
side *ds;
|
||||
int count = 0;
|
||||
|
||||
|
||||
for (ds = b->sides; ds != b->sides + b->nsides; ++ds) {
|
||||
if ((allytype == ALLY_ANY && helping(as, ds)) || (allytype == ALLY_SELF
|
||||
&& as->faction == ds->faction)) {
|
||||
&& as->faction == ds->faction)) {
|
||||
count += count_side(ds, NULL, minrow, maxrow, select);
|
||||
if (count > 0 && (select & SELECT_FIND))
|
||||
break;
|
||||
|
@ -1418,11 +1398,11 @@ count_allies(const side * as, int minrow, int maxrow, int select, int allytype)
|
|||
|
||||
static int
|
||||
count_enemies_i(battle * b, const fighter * af, int minrow, int maxrow,
|
||||
int select)
|
||||
int select)
|
||||
{
|
||||
side *es, *as = af->side;
|
||||
int i = 0;
|
||||
|
||||
|
||||
for (es = b->sides; es != b->sides + b->nsides; ++es) {
|
||||
if (as == NULL || enemy(es, as)) {
|
||||
int offset = 0;
|
||||
|
@ -1438,8 +1418,8 @@ count_enemies_i(battle * b, const fighter * af, int minrow, int maxrow,
|
|||
}
|
||||
|
||||
int
|
||||
count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
|
||||
int select)
|
||||
count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
|
||||
int select)
|
||||
{
|
||||
int sr = statusrow(af->status);
|
||||
side *as = af->side;
|
||||
|
@ -3261,7 +3241,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
|
|||
/* hand out missile weapons (from back to front, in case of mixed troops). */
|
||||
for (di = 0, i = fig->alive; i-- != 0;) {
|
||||
while (di != w && (wused[dwp[di]] == wcount[dwp[di]]
|
||||
|| !fval(fig->weapons[dwp[di]].type, WTF_MISSILE))) {
|
||||
|| !fval(fig->weapons[dwp[di]].type, WTF_MISSILE))) {
|
||||
++di;
|
||||
}
|
||||
if (di == w)
|
||||
|
|
18
src/battle.h
18
src/battle.h
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_KRNL_BATTLE
|
||||
#define H_KRNL_BATTLE
|
||||
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
@ -19,6 +7,7 @@ without prior permission by the authors of Eressea.
|
|||
#include "bindings.h"
|
||||
#include "magic.h"
|
||||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/unit.h>
|
||||
|
@ -34,6 +23,7 @@ without prior permission by the authors of Eressea.
|
|||
#include <util/log.h>
|
||||
#include <util/macros.h>
|
||||
#include <util/message.h>
|
||||
#include <util/nrmessage.h>
|
||||
#include <util/password.h>
|
||||
|
||||
#include "attributes/key.h"
|
||||
|
@ -42,7 +32,10 @@ without prior permission by the authors of Eressea.
|
|||
#include <lauxlib.h>
|
||||
#include <tolua.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h> // for bool
|
||||
#include <stdio.h> // for puts
|
||||
|
||||
struct allies;
|
||||
|
||||
int tolua_factionlist_next(lua_State * L)
|
||||
{
|
||||
|
@ -59,13 +52,13 @@ int tolua_factionlist_next(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_units(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
|
||||
|
||||
luaL_getmetatable(L, TOLUA_CAST "unit");
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
*unit_ptr = self->units;
|
||||
*unit_ptr = f->units;
|
||||
|
||||
lua_pushcclosure(L, tolua_unitlist_nextf, 1);
|
||||
return 1;
|
||||
|
@ -73,7 +66,7 @@ static int tolua_faction_get_units(lua_State * L)
|
|||
|
||||
int tolua_faction_add_item(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *iname = tolua_tostring(L, 2, NULL);
|
||||
int number = (int)tolua_tonumber(L, 3, 0);
|
||||
int result = -1;
|
||||
|
@ -81,7 +74,7 @@ int tolua_faction_add_item(lua_State * L)
|
|||
if (iname != NULL) {
|
||||
const resource_type *rtype = rt_find(iname);
|
||||
if (rtype && rtype->itype) {
|
||||
item *i = i_change(&self->items, rtype->itype, number);
|
||||
item *i = i_change(&f->items, rtype->itype, number);
|
||||
result = i ? i->number : 0;
|
||||
} /* if (itype!=NULL) */
|
||||
}
|
||||
|
@ -91,38 +84,38 @@ int tolua_faction_add_item(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_maxheroes(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, maxheroes(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, maxheroes(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_heroes(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, countheroes(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, countheroes(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_score(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushnumber(L, (lua_Number)self->score);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushnumber(L, (lua_Number)f->score);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_id(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->no);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, f->no);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_id(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int id = (int)tolua_tonumber(L, 2, 0);
|
||||
if (findfaction(id) == NULL) {
|
||||
renumber_faction(self, id);
|
||||
renumber_faction(f, id);
|
||||
lua_pushboolean(L, 1);
|
||||
}
|
||||
else {
|
||||
|
@ -133,20 +126,20 @@ static int tolua_faction_set_id(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_magic(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, magic_school[self->magiegebiet]);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, magic_school[f->magiegebiet]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_magic(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *type = tolua_tostring(L, 2, NULL);
|
||||
int mtype;
|
||||
|
||||
for (mtype = 0; mtype != MAXMAGIETYP; ++mtype) {
|
||||
if (strcmp(magic_school[mtype], type) == 0) {
|
||||
self->magiegebiet = (magic_t)mtype;
|
||||
f->magiegebiet = (magic_t)mtype;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -155,89 +148,89 @@ static int tolua_faction_set_magic(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_age(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->age);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, f->age);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_age(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int age = (int)tolua_tonumber(L, 2, 0);
|
||||
self->age = age;
|
||||
f->age = age;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_flags(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->flags);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, f->flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_flags(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int flags = (int)tolua_tonumber(L, 2, self->flags);
|
||||
self->flags = flags;
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int flags = (int)tolua_tonumber(L, 2, f->flags);
|
||||
f->flags = flags;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_options(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->options);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, f->options);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_options(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int options = (int)tolua_tonumber(L, 2, self->options);
|
||||
self->options = options;
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int options = (int)tolua_tonumber(L, 2, f->options);
|
||||
f->options = options;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_lastturn(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->lastorders);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, f->lastorders);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_lastturn(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
if (self) {
|
||||
self->lastorders = (int)tolua_tonumber(L, 2, self->lastorders);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
if (f) {
|
||||
f->lastorders = (int)tolua_tonumber(L, 2, f->lastorders);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_renumber(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int no = (int)tolua_tonumber(L, 2, 0);
|
||||
|
||||
renumber_faction(self, no);
|
||||
renumber_faction(f, no);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_addnotice(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *str = tolua_tostring(L, 2, NULL);
|
||||
|
||||
addmessage(NULL, self, str, MSG_MESSAGE, ML_IMPORTANT);
|
||||
addmessage(NULL, f, str, MSG_MESSAGE, ML_IMPORTANT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_getkey(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
int flag = atoi36(name);
|
||||
int value = key_get(self->attribs, flag);
|
||||
int value = key_get(f->attribs, flag);
|
||||
if (value != 0) {
|
||||
lua_pushinteger(L, value);
|
||||
return 1;
|
||||
|
@ -247,43 +240,59 @@ static int tolua_faction_getkey(lua_State * L)
|
|||
|
||||
static int tolua_faction_setkey(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
int value = (int)tolua_tonumber(L, 3, 1);
|
||||
int flag = atoi36(name);
|
||||
|
||||
if (value) {
|
||||
key_set(&self->attribs, flag, value);
|
||||
key_set(&f->attribs, flag, value);
|
||||
}
|
||||
else {
|
||||
key_unset(&self->attribs, flag);
|
||||
key_unset(&f->attribs, flag);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_debug_messages(lua_State * L)
|
||||
{
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int i = 1;
|
||||
if (f->msgs) {
|
||||
mlist *ml;
|
||||
for (ml = self->msgs->begin; ml; ml = ml->next, ++i) {
|
||||
char buf[120];
|
||||
nr_render(ml->msg, default_locale, buf, sizeof(buf), NULL);
|
||||
puts(buf);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_messages(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int i = 1;
|
||||
mlist *ml;
|
||||
if (!self->msgs) {
|
||||
return 0;
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
|
||||
if (f->msgs) {
|
||||
int i = 1;
|
||||
mlist *ml;
|
||||
lua_newtable(L);
|
||||
for (ml = f->msgs->begin; ml; ml = ml->next, ++i) {
|
||||
lua_pushnumber(L, i);
|
||||
lua_pushstring(L, ml->msg->type->name);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
lua_newtable(L);
|
||||
for (ml = self->msgs->begin; ml; ml = ml->next, ++i) {
|
||||
lua_pushnumber(L, i);
|
||||
lua_pushstring(L, ml->msg->type->name);
|
||||
lua_rawset(L, -3);
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_count_msg_type(lua_State *L) {
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *str = tolua_tostring(L, 2, NULL);
|
||||
int n = 0;
|
||||
if (self->msgs) {
|
||||
mlist * ml = self->msgs->begin;
|
||||
if (f->msgs) {
|
||||
mlist * ml = f->msgs->begin;
|
||||
while (ml) {
|
||||
if (strcmp(str, ml->msg->type->name) == 0) {
|
||||
++n;
|
||||
|
@ -324,9 +333,9 @@ static int tolua_faction_set_origin(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_origin(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int x = 0, y = 0;
|
||||
faction_getorigin(self, 0, &x, &y);
|
||||
faction_getorigin(f, 0, &x, &y);
|
||||
|
||||
lua_pushinteger(L, x);
|
||||
lua_pushinteger(L, y);
|
||||
|
@ -374,48 +383,48 @@ static int tolua_faction_create(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_password(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getpassword(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getpassword(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_password(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char * passw = tolua_tostring(L, 2, NULL);
|
||||
faction_setpassword(self,
|
||||
faction_setpassword(f,
|
||||
passw ? password_hash(passw, PASSWORD_DEFAULT) : NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_email(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getemail(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getemail(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_email(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setemail(self, tolua_tostring(L, 2, NULL));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setemail(f, tolua_tostring(L, 2, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_locale(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, locale_name(self->locale));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, locale_name(f->locale));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_locale(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
const struct locale *loc = get_locale(name);
|
||||
if (loc) {
|
||||
self->locale = loc;
|
||||
f->locale = loc;
|
||||
}
|
||||
else {
|
||||
tolua_pushstring(L, "invalid locale");
|
||||
|
@ -426,18 +435,18 @@ static int tolua_faction_set_locale(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_race(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, self->race->_name);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, f->race->_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_race(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
const race *rc = rc_find(name);
|
||||
if (rc != NULL) {
|
||||
self->race = rc;
|
||||
f->race = rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -445,15 +454,15 @@ static int tolua_faction_set_race(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_name(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getname(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getname(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_name(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setname(self, tolua_tostring(L, 2, NULL));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setname(f, tolua_tostring(L, 2, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -473,44 +482,108 @@ static int tolua_faction_set_uid(lua_State * L)
|
|||
|
||||
static int tolua_faction_get_info(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getbanner(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, faction_getbanner(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_info(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setbanner(self, tolua_tostring(L, 2, NULL));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction_setbanner(f, tolua_tostring(L, 2, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_alliance(lua_State * L)
|
||||
/* TODO: this is probably useful elsewhere */
|
||||
static const char *status_names[] = {
|
||||
"money", "fight", "observe", "give", "guard", "stealth", "travel", NULL
|
||||
};
|
||||
|
||||
static int cb_ally_push(struct allies *af, struct faction *f, int status, void *udata) {
|
||||
struct lua_State *L = (struct lua_State *)udata;
|
||||
int len = 1;
|
||||
int i;
|
||||
|
||||
lua_pushnumber(L, f->no);
|
||||
lua_newtable(L);
|
||||
for (i = 0; status_names[i]; ++i) {
|
||||
int flag = 1 << i;
|
||||
if (status & flag) {
|
||||
lua_pushstring(L, status_names[i]);
|
||||
lua_rawseti(L, -2, len++);
|
||||
}
|
||||
}
|
||||
|
||||
lua_rawset(L, -3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_allies(lua_State * L) {
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_newtable(L);
|
||||
allies_walk(f->allies, cb_ally_push, L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_ally(lua_State * L) {
|
||||
faction *f1 = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f2 = (faction *)tolua_tousertype(L, 2, NULL);
|
||||
const char *status = tolua_tostring(L, 3, NULL);
|
||||
bool value = tolua_toboolean(L, 4, 1);
|
||||
if (status) {
|
||||
int flag = ally_status(status);
|
||||
int flags = ally_get(f1->allies, f2);
|
||||
if (value) {
|
||||
flags |= flag;
|
||||
}
|
||||
else {
|
||||
flags &= ~flag;
|
||||
}
|
||||
ally_set(&f1->allies, f2, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_ally(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushusertype(L, f_get_alliance(self), TOLUA_CAST "alliance");
|
||||
faction *f1 = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f2 = (faction *)tolua_tousertype(L, 2, NULL);
|
||||
const char *status = tolua_tostring(L, 3, NULL);
|
||||
if (f1 && f2 && status) {
|
||||
int test = ally_status(status);
|
||||
int flags = ally_get(f1->allies, f2);
|
||||
lua_pushboolean(L, (test & flags) == test);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_alliances(lua_State * L)
|
||||
{
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushusertype(L, f_get_alliance(f), TOLUA_CAST "alliance");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_faction_set_alliance(lua_State * L)
|
||||
{
|
||||
struct faction *self = (struct faction *)tolua_tousertype(L, 1, NULL);
|
||||
struct faction *f = (struct faction *)tolua_tousertype(L, 1, NULL);
|
||||
struct alliance *alli = (struct alliance *) tolua_tousertype(L, 2, NULL);
|
||||
|
||||
setalliance(self, alli);
|
||||
setalliance(f, alli);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_items(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
item **item_ptr = (item **)lua_newuserdata(L, sizeof(item *));
|
||||
|
||||
luaL_getmetatable(L, TOLUA_CAST "item");
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
*item_ptr = self->items;
|
||||
*item_ptr = f->items;
|
||||
|
||||
lua_pushcclosure(L, tolua_itemlist_next, 1);
|
||||
|
||||
|
@ -519,8 +592,8 @@ static int tolua_faction_get_items(lua_State * L)
|
|||
|
||||
static int tolua_faction_tostring(lua_State * L)
|
||||
{
|
||||
faction *self = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, factionname(self));
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, factionname(f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -563,8 +636,6 @@ void tolua_faction_open(lua_State * L)
|
|||
tolua_faction_set_locale);
|
||||
tolua_variable(L, TOLUA_CAST "race", tolua_faction_get_race,
|
||||
tolua_faction_set_race);
|
||||
tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliance,
|
||||
tolua_faction_set_alliance);
|
||||
tolua_variable(L, TOLUA_CAST "score", tolua_faction_get_score, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "magic", tolua_faction_get_magic,
|
||||
tolua_faction_set_magic);
|
||||
|
@ -576,6 +647,13 @@ void tolua_faction_open(lua_State * L)
|
|||
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
|
||||
tolua_faction_set_lastturn);
|
||||
|
||||
tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliances,
|
||||
tolua_faction_set_alliance);
|
||||
|
||||
tolua_variable(L, TOLUA_CAST "allies", tolua_faction_get_allies, NULL);
|
||||
tolua_function(L, TOLUA_CAST "set_ally", tolua_faction_set_ally);
|
||||
tolua_function(L, TOLUA_CAST "get_ally", tolua_faction_get_ally);
|
||||
|
||||
tolua_function(L, TOLUA_CAST "get_origin", tolua_faction_get_origin);
|
||||
tolua_function(L, TOLUA_CAST "set_origin", tolua_faction_set_origin);
|
||||
tolua_function(L, TOLUA_CAST "normalize", tolua_faction_normalize);
|
||||
|
@ -592,6 +670,7 @@ void tolua_faction_open(lua_State * L)
|
|||
/* tech debt hack, siehe https://paper.dropbox.com/doc/Weihnachten-2015-5tOx5r1xsgGDBpb0gILrv#:h=Probleme-mit-Tests-(Nachtrag-0 */
|
||||
tolua_function(L, TOLUA_CAST "count_msg_type", tolua_faction_count_msg_type);
|
||||
tolua_variable(L, TOLUA_CAST "messages", tolua_faction_get_messages, NULL);
|
||||
tolua_function(L, TOLUA_CAST "debug_messages", tolua_faction_debug_messages);
|
||||
|
||||
tolua_function(L, TOLUA_CAST "get_key", tolua_faction_getkey);
|
||||
tolua_function(L, TOLUA_CAST "set_key", tolua_faction_setkey);
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
303
src/bind_unit.c
303
src/bind_unit.c
|
@ -147,129 +147,129 @@ static int tolua_unit_get_group(lua_State * L)
|
|||
|
||||
static int tolua_unit_set_group(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
group *g = join_group(self, tolua_tostring(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
group *g = join_group(u, tolua_tostring(L, 2, 0));
|
||||
lua_pushboolean(L, g!=NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_name(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, unit_getname(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, unit_getname(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_name(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setname(self, tolua_tostring(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setname(u, tolua_tostring(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_info(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, unit_getinfo(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, unit_getinfo(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_info(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setinfo(self, tolua_tostring(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setinfo(u, tolua_tostring(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_id(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getid(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getid(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_id(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setid(self, (int)tolua_tonumber(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setid(u, (int)tolua_tonumber(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_auramax(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, max_spellpoints_depr(self->region, self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, max_spellpoints_depr(u->region, u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_hpmax(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_max_hp(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_max_hp(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_hp(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_gethp(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_gethp(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_hp(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_sethp(self, (int)tolua_tonumber(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_sethp(u, (int)tolua_tonumber(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_number(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, self->number);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, u->number);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_number(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
int number = (int)tolua_tonumber(L, 2, 0);
|
||||
if (self->number == 0) {
|
||||
set_number(self, number);
|
||||
self->hp = unit_max_hp(self) * number;
|
||||
if (u->number == 0) {
|
||||
set_number(u, number);
|
||||
u->hp = unit_max_hp(u) * number;
|
||||
}
|
||||
else {
|
||||
scale_number(self, number);
|
||||
scale_number(u, number);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_flags(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, self->flags);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, u->flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_flags(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
self->flags = (int)tolua_tonumber(L, 2, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
u->flags = (int)tolua_tonumber(L, 2, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_guard(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushboolean(L, is_guard(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushboolean(L, is_guard(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_guard(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unsigned int flags = (unsigned int)tolua_tonumber(L, 2, 0);
|
||||
setguard(self, flags!=0);
|
||||
setguard(u, flags!=0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -285,8 +285,8 @@ static const char *unit_getmagic(const unit * u)
|
|||
|
||||
static int tolua_unit_get_magic(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushstring(L, unit_getmagic(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushstring(L, unit_getmagic(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -306,64 +306,64 @@ static void unit_setmagic(unit * u, const char *type)
|
|||
|
||||
static int tolua_unit_set_magic(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *type = tolua_tostring(L, 2, 0);
|
||||
unit_setmagic(self, type);
|
||||
unit_setmagic(u, type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_aura(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, get_spellpoints(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, get_spellpoints(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_aura(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
set_spellpoints(self, (int)tolua_tonumber(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
set_spellpoints(u, (int)tolua_tonumber(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_age(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, self->age);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, u->age);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_age(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
self->age = (int)tolua_tonumber(L, 2, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
u->age = (int)tolua_tonumber(L, 2, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_status(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getstatus(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getstatus(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_status(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setstatus(self, (status_t)tolua_tonumber(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setstatus(u, (status_t)tolua_tonumber(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_item(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *iname = tolua_tostring(L, 2, 0);
|
||||
int result = -1;
|
||||
|
||||
if (iname != NULL) {
|
||||
const item_type *itype = it_find(iname);
|
||||
if (itype != NULL) {
|
||||
result = i_get(self->items, itype);
|
||||
result = i_get(u->items, itype);
|
||||
}
|
||||
}
|
||||
lua_pushinteger(L, result);
|
||||
|
@ -372,13 +372,13 @@ static int tolua_unit_get_item(lua_State * L)
|
|||
|
||||
static int tolua_unit_get_effect(lua_State * L)
|
||||
{
|
||||
const unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *potion_name = tolua_tostring(L, 2, 0);
|
||||
int result = -1;
|
||||
const item_type *it_potion = it_find(potion_name);
|
||||
|
||||
if (it_potion != NULL) {
|
||||
result = get_effect(self, it_potion);
|
||||
result = get_effect(u, it_potion);
|
||||
}
|
||||
|
||||
lua_pushinteger(L, result);
|
||||
|
@ -387,7 +387,7 @@ static int tolua_unit_get_effect(lua_State * L)
|
|||
|
||||
static int tolua_unit_add_item(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *iname = tolua_tostring(L, 2, 0);
|
||||
int number = (int)tolua_tonumber(L, 3, 0);
|
||||
int result = -1;
|
||||
|
@ -395,7 +395,7 @@ static int tolua_unit_add_item(lua_State * L)
|
|||
if (iname != NULL) {
|
||||
const item_type *itype = it_find(iname);
|
||||
if (itype != NULL) {
|
||||
item *i = i_change(&self->items, itype, number);
|
||||
item *i = i_change(&u->items, itype, number);
|
||||
result = i ? i->number : 0;
|
||||
}
|
||||
}
|
||||
|
@ -405,12 +405,12 @@ static int tolua_unit_add_item(lua_State * L)
|
|||
|
||||
static int tolua_unit_getskill(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *skname = tolua_tostring(L, 2, 0);
|
||||
skill_t sk = findskill(skname);
|
||||
int value = -1;
|
||||
if (sk != NOSKILL) {
|
||||
skill *sv = unit_skill(self, sk);
|
||||
skill *sv = unit_skill(u, sk);
|
||||
if (sv) {
|
||||
value = sv->level;
|
||||
}
|
||||
|
@ -423,10 +423,10 @@ static int tolua_unit_getskill(lua_State * L)
|
|||
|
||||
static int tolua_unit_effskill(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *skname = tolua_tostring(L, 2, 0);
|
||||
skill_t sk = findskill(skname);
|
||||
int value = (sk == NOSKILL) ? -1 : effskill(self, sk, NULL);
|
||||
int value = (sk == NOSKILL) ? -1 : effskill(u, sk, NULL);
|
||||
lua_pushinteger(L, value);
|
||||
return 1;
|
||||
}
|
||||
|
@ -438,10 +438,10 @@ typedef struct event {
|
|||
|
||||
static int tolua_unit_addnotice(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *str = tolua_tostring(L, 2, 0);
|
||||
|
||||
addmessage(self->region, self->faction, str, MSG_MESSAGE, ML_IMPORTANT);
|
||||
addmessage(u->region, u->faction, str, MSG_MESSAGE, ML_IMPORTANT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -475,11 +475,11 @@ static void unit_castspell(unit * u, const char *name, int level)
|
|||
|
||||
static int tolua_unit_castspell(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *str = tolua_tostring(L, 2, 0);
|
||||
int level = (int)tolua_tonumber(L, 3, 1);
|
||||
|
||||
unit_castspell(self, str, level);
|
||||
unit_castspell(u, str, level);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -505,17 +505,17 @@ static int tolua_unit_addspell(lua_State * L)
|
|||
|
||||
static int tolua_unit_set_racename(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *str = tolua_tostring(L, 2, 0);
|
||||
|
||||
set_racename(&self->attribs, str);
|
||||
set_racename(&u->attribs, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_racename(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
attrib *a = a_find(self->attribs, &at_racename);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
attrib *a = a_find(u->attribs, &at_racename);
|
||||
if (a) {
|
||||
tolua_pushstring(L, get_racename(a));
|
||||
return 1;
|
||||
|
@ -525,29 +525,30 @@ static int tolua_unit_get_racename(lua_State * L)
|
|||
|
||||
static int tolua_unit_setskill(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *skname = tolua_tostring(L, 2, 0);
|
||||
int level = (int)tolua_tonumber(L, 3, 0);
|
||||
bool rcmod = tolua_toboolean(L, 4, 0);
|
||||
skill_t sk = findskill(skname);
|
||||
|
||||
if (sk != NOSKILL) {
|
||||
set_level(self, sk, level);
|
||||
if (rcmod) level -= u_race(u)->bonus[sk];
|
||||
set_level(u, sk, level);
|
||||
lua_pushinteger(L, level);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
level = -1;
|
||||
}
|
||||
lua_pushinteger(L, level);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_use_pooled(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *iname = tolua_tostring(L, 2, 0);
|
||||
int number = (int)tolua_tonumber(L, 3, 0);
|
||||
const resource_type *rtype = rt_find(iname);
|
||||
int result = -1;
|
||||
if (rtype != NULL) {
|
||||
result = use_pooled(self, rtype, GET_DEFAULT, number);
|
||||
result = use_pooled(u, rtype, GET_DEFAULT, number);
|
||||
}
|
||||
lua_pushinteger(L, result);
|
||||
return 1;
|
||||
|
@ -555,12 +556,12 @@ static int tolua_unit_use_pooled(lua_State * L)
|
|||
|
||||
static int tolua_unit_get_pooled(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *iname = tolua_tostring(L, 2, 0);
|
||||
const resource_type *rtype = rt_find(iname);
|
||||
int result = -1;
|
||||
if (rtype != NULL) {
|
||||
result = get_pooled(self, rtype, GET_DEFAULT, INT_MAX);
|
||||
result = get_pooled(u, rtype, GET_DEFAULT, INT_MAX);
|
||||
}
|
||||
lua_pushinteger(L, result);
|
||||
return 1;
|
||||
|
@ -577,8 +578,8 @@ static unit *unit_getfamiliar(const unit * u)
|
|||
|
||||
static int tolua_unit_get_familiar(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, unit_getfamiliar(self), TOLUA_CAST "unit");
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, unit_getfamiliar(u), TOLUA_CAST "unit");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -597,8 +598,8 @@ static int tolua_unit_set_familiar(lua_State * L)
|
|||
|
||||
static int tolua_unit_get_building(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, self->building, TOLUA_CAST "building");
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, u->building, TOLUA_CAST "building");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -622,8 +623,8 @@ static int tolua_unit_set_building(lua_State * L)
|
|||
|
||||
static int tolua_unit_get_ship(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, self->ship, TOLUA_CAST "ship");
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, u->ship, TOLUA_CAST "ship");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -638,17 +639,17 @@ static void unit_setship(unit * u, ship * s)
|
|||
|
||||
static int tolua_unit_set_ship(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
if (self->faction) {
|
||||
unit_setship(self, (ship *)tolua_tousertype(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
if (u->faction) {
|
||||
unit_setship(u, (ship *)tolua_tousertype(L, 2, 0));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_region(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, self->region, TOLUA_CAST "region");
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, u->region, TOLUA_CAST "region");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -659,29 +660,29 @@ static void unit_setregion(unit * u, region * r)
|
|||
|
||||
static int tolua_unit_set_region(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setregion(self, (region *)tolua_tousertype(L, 2, 0));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit_setregion(u, (region *)tolua_tousertype(L, 2, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_order(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
int index = (int)tolua_tonumber(L, 2, -1);
|
||||
order *ord = NULL;
|
||||
if (index < 0) {
|
||||
ord = self->thisorder;
|
||||
ord = u->thisorder;
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
ord = self->orders;
|
||||
ord = u->orders;
|
||||
for (i = 0; ord && i != index; ++i) {
|
||||
ord = ord->next;
|
||||
}
|
||||
}
|
||||
if (ord) {
|
||||
char buffer[1024];
|
||||
get_command(ord, self->faction->locale, buffer, sizeof(buffer));
|
||||
get_command(ord, u->faction->locale, buffer, sizeof(buffer));
|
||||
lua_pushstring(L, buffer);
|
||||
return 1;
|
||||
}
|
||||
|
@ -690,30 +691,30 @@ static int tolua_unit_get_order(lua_State * L)
|
|||
|
||||
static int tolua_unit_add_order(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *str = tolua_tostring(L, 2, 0);
|
||||
order *ord = parse_order(str, self->faction->locale);
|
||||
unit_addorder(self, ord);
|
||||
order *ord = parse_order(str, u->faction->locale);
|
||||
unit_addorder(u, ord);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_clear_orders(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
free_orders(&self->orders);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
free_orders(&u->orders);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_items(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
|
||||
item **item_ptr = (item **)lua_newuserdata(L, sizeof(item *));
|
||||
|
||||
luaL_getmetatable(L, TOLUA_CAST "item");
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
*item_ptr = self->items;
|
||||
*item_ptr = u->items;
|
||||
|
||||
lua_pushcclosure(L, tolua_itemlist_next, 1);
|
||||
|
||||
|
@ -722,8 +723,8 @@ static int tolua_unit_get_items(lua_State * L)
|
|||
|
||||
static int tolua_unit_get_spells(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
||||
struct sc_mage *mage = self ? get_mage(self) : NULL;
|
||||
unit *u = (unit *) tolua_tousertype(L, 1, 0);
|
||||
struct sc_mage *mage = u ? get_mage(u) : NULL;
|
||||
spellbook *sb = mage_get_spellbook(mage);
|
||||
selist *slist = 0;
|
||||
if (sb) {
|
||||
|
@ -734,10 +735,10 @@ static int tolua_unit_get_spells(lua_State * L)
|
|||
}
|
||||
|
||||
static int tolua_unit_get_curse(lua_State *L) {
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
if (self->attribs) {
|
||||
curse * c = get_curse(self->attribs, ct_find(name));
|
||||
if (u->attribs) {
|
||||
curse * c = get_curse(u->attribs, ct_find(name));
|
||||
if (c) {
|
||||
lua_pushnumber(L, curse_geteffect(c));
|
||||
return 1;
|
||||
|
@ -746,10 +747,19 @@ static int tolua_unit_get_curse(lua_State *L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_clear_attribs(lua_State *L) {
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
const attrib_type *at = name ? at_find(name) : NULL;
|
||||
|
||||
a_removeall(&u->attribs, at);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_has_attrib(lua_State *L) {
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
attrib * a = self->attribs;
|
||||
attrib * a = u->attribs;
|
||||
while (a) {
|
||||
if (strcmp(a->type->name, name) == 0) {
|
||||
break;
|
||||
|
@ -762,105 +772,105 @@ static int tolua_unit_has_attrib(lua_State *L) {
|
|||
|
||||
static int tolua_unit_get_key(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
int flag = atoi36(name);
|
||||
lua_pushboolean(L, key_get(self->attribs, flag));
|
||||
lua_pushboolean(L, key_get(u->attribs, flag));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_key(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
int value = (int)tolua_tonumber(L, 3, 0);
|
||||
int flag = atoi36(name);
|
||||
if (value) {
|
||||
key_set(&self->attribs, flag, value);
|
||||
key_set(&u->attribs, flag, value);
|
||||
}
|
||||
else {
|
||||
key_unset(&self->attribs, flag);
|
||||
key_unset(&u->attribs, flag);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_flag(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
int bit = (int)tolua_tonumber(L, 2, 0);
|
||||
|
||||
lua_pushboolean(L, (self->flags & (1 << bit)));
|
||||
lua_pushboolean(L, (u->flags & (1 << bit)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_flag(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
int bit = (int)tolua_tonumber(L, 2, 0);
|
||||
int set = tolua_toboolean(L, 3, 1);
|
||||
|
||||
if (set)
|
||||
self->flags |= (1 << bit);
|
||||
u->flags |= (1 << bit);
|
||||
else
|
||||
self->flags &= ~(1 << bit);
|
||||
u->flags &= ~(1 << bit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_weight(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getweight(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getweight(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_capacity(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getcapacity(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushinteger(L, unit_getcapacity(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_faction(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, (void *)self->faction, TOLUA_CAST "faction");
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushusertype(L, (void *)u->faction, TOLUA_CAST "faction");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_faction(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
faction *f = (faction *)tolua_tousertype(L, 2, 0);
|
||||
u_setfaction(self, f);
|
||||
u_setfaction(u, f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_race(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, u_race(self)->_name);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
tolua_pushstring(L, u_race(u)->_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_race(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *rcname = tolua_tostring(L, 2, 0);
|
||||
const race *rc = rc_find(rcname);
|
||||
if (rc != NULL) {
|
||||
if (self->irace == u_race(self)) {
|
||||
self->irace = NULL;
|
||||
if (u->irace == u_race(u)) {
|
||||
u->irace = NULL;
|
||||
}
|
||||
u_setrace(self, rc);
|
||||
u_setrace(u, rc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_destroy(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
if (self) {
|
||||
remove_unit(&self->region->units, self);
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
if (u) {
|
||||
remove_unit(&u->region->units, u);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -884,25 +894,25 @@ static int tolua_unit_create(lua_State * L)
|
|||
|
||||
static int tolua_unit_tostring(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushstring(L, unitname(self));
|
||||
unit *u = (unit *)tolua_tousertype(L, 1, 0);
|
||||
lua_pushstring(L, unitname(u));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_event_gettype(lua_State * L)
|
||||
{
|
||||
event *self = (event *)tolua_tousertype(L, 1, 0);
|
||||
event *u = (event *)tolua_tousertype(L, 1, 0);
|
||||
int index = (int)tolua_tonumber(L, 2, 0);
|
||||
lua_pushstring(L, self->args[index].type);
|
||||
lua_pushstring(L, u->args[index].type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_event_get(lua_State * L)
|
||||
{
|
||||
struct event *self = (struct event *)tolua_tousertype(L, 1, 0);
|
||||
struct event *u = (struct event *)tolua_tousertype(L, 1, 0);
|
||||
int index = (int)tolua_tonumber(L, 2, 0);
|
||||
|
||||
event_arg *arg = self->args + index;
|
||||
event_arg *arg = u->args + index;
|
||||
|
||||
if (arg->type) {
|
||||
if (strcmp(arg->type, "string") == 0) {
|
||||
|
@ -978,6 +988,7 @@ void tolua_unit_open(lua_State * L)
|
|||
tolua_function(L, TOLUA_CAST "add_order", tolua_unit_add_order);
|
||||
tolua_function(L, TOLUA_CAST "clear_orders", tolua_unit_clear_orders);
|
||||
tolua_function(L, TOLUA_CAST "get_curse", tolua_unit_get_curse);
|
||||
tolua_function(L, TOLUA_CAST "clear_attribs", tolua_unit_clear_attribs);
|
||||
tolua_function(L, TOLUA_CAST "has_attrib", tolua_unit_has_attrib);
|
||||
|
||||
/* key-attributes for named flags: */
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -259,10 +259,9 @@ static int tolua_dice_rand(lua_State * L)
|
|||
|
||||
static int tolua_get_season(lua_State * L)
|
||||
{
|
||||
int turnno = (int)tolua_tonumber(L, 1, 0);
|
||||
gamedate gd;
|
||||
get_gamedate(turnno, &gd);
|
||||
tolua_pushstring(L, seasonnames[gd.season]);
|
||||
int turn_no = (int)tolua_tonumber(L, 1, 0);
|
||||
season_t season = calendar_season(turn_no);
|
||||
tolua_pushstring(L, seasonnames[season]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
18
src/chaos.c
18
src/chaos.c
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "chaos.h"
|
||||
|
|
18
src/chaos.h
18
src/chaos.h
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_GC_CHAOS
|
||||
#define H_GC_CHAOS
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_LUA_CONSOLE
|
||||
#define H_LUA_CONSOLE
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
+-------------------+
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/version.h>
|
||||
|
@ -1473,14 +1464,16 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
|
|||
cr_output_curses_compat(F, f, r, TYP_REGION);
|
||||
cr_borders(r, f, r->seen.mode, F);
|
||||
if (r->seen.mode >= seen_unit && is_astral(r)
|
||||
&& !is_cursed(r->attribs, &ct_astralblock)) {
|
||||
&& !is_cursed(r->attribs, &ct_astralblock))
|
||||
{
|
||||
/* Sonderbehandlung Teleport-Ebene */
|
||||
region_list *rl = astralregions(r, inhabitable);
|
||||
region *rl[MAX_SCHEMES];
|
||||
int num = get_astralregions(r, inhabitable, rl);
|
||||
|
||||
if (rl) {
|
||||
region_list *rl2 = rl;
|
||||
while (rl2) {
|
||||
region *r2 = rl2->data;
|
||||
if (num > 0) {
|
||||
int i;
|
||||
for (i = 0; i != num; ++i) {
|
||||
region *r2 = rl[i];
|
||||
plane *plx = rplane(r2);
|
||||
|
||||
nx = r2->x;
|
||||
|
@ -1489,9 +1482,7 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
|
|||
adjust_coordinates(f, &nx, &ny, plx);
|
||||
fprintf(F, "SCHEMEN %d %d\n", nx, ny);
|
||||
fprintf(F, "\"%s\";Name\n", rname(r2, f->locale));
|
||||
rl2 = rl2->next;
|
||||
}
|
||||
free_regionlist(rl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1503,33 +1494,34 @@ static void cr_output_region(FILE * F, report_context * ctx, region * r)
|
|||
cr_output_messages(F, mlist, f);
|
||||
}
|
||||
}
|
||||
/* buildings */
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
int fno = -1;
|
||||
u = building_owner(b);
|
||||
if (u && !fval(u, UFL_ANON_FACTION)) {
|
||||
const faction *sf = visible_faction(f, u);
|
||||
fno = sf->no;
|
||||
}
|
||||
cr_output_building_compat(F, b, u, fno, f);
|
||||
}
|
||||
|
||||
/* ships */
|
||||
for (sh = r->ships; sh; sh = sh->next) {
|
||||
int fno = -1;
|
||||
u = ship_owner(sh);
|
||||
if (u && !fval(u, UFL_ANON_FACTION)) {
|
||||
const faction *sf = visible_faction(f, u);
|
||||
fno = sf->no;
|
||||
if (r->seen.mode >= seen_lighthouse) {
|
||||
/* buildings */
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
int fno = -1;
|
||||
u = building_owner(b);
|
||||
if (u && !fval(u, UFL_ANON_FACTION)) {
|
||||
const faction *sf = visible_faction(f, u);
|
||||
fno = sf->no;
|
||||
}
|
||||
cr_output_building_compat(F, b, u, fno, f);
|
||||
}
|
||||
|
||||
cr_output_ship_compat(F, sh, u, fno, f, r);
|
||||
}
|
||||
/* ships */
|
||||
for (sh = r->ships; sh; sh = sh->next) {
|
||||
int fno = -1;
|
||||
u = ship_owner(sh);
|
||||
if (u && !fval(u, UFL_ANON_FACTION)) {
|
||||
const faction *sf = visible_faction(f, u);
|
||||
fno = sf->no;
|
||||
}
|
||||
|
||||
/* visible units */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (visible_unit(u, f, stealthmod, r->seen.mode)) {
|
||||
cr_output_unit_compat(F, f, u, r->seen.mode);
|
||||
cr_output_ship_compat(F, sh, u, fno, f, r);
|
||||
}
|
||||
/* visible units */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (visible_unit(u, f, stealthmod, r->seen.mode)) {
|
||||
cr_output_unit_compat(F, f, u, r->seen.mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
#ifndef H_GC_CREPORT
|
||||
#define H_GC_CREPORT
|
||||
|
||||
|
|
102
src/economy.c
102
src/economy.c
|
@ -1,22 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019,
|
||||
Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
@ -301,9 +282,21 @@ static int forget_cmd(unit * u, order * ord)
|
|||
|
||||
sk = get_skill(s, u->faction->locale);
|
||||
if (sk != NOSKILL) {
|
||||
if (sk == SK_MAGIC && is_familiar(u)) {
|
||||
/* some units cannot forget their innate magical abilities */
|
||||
return 0;
|
||||
if (sk == SK_MAGIC) {
|
||||
if (is_familiar(u)) {
|
||||
/* some units cannot forget their innate magical abilities */
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
unit *ufam = get_familiar(u);
|
||||
if (ufam) {
|
||||
a_removeall(&ufam->attribs, NULL);
|
||||
u_setfaction(ufam, get_monsters());
|
||||
unit_convert_race(ufam, NULL, "ghost");
|
||||
}
|
||||
a_removeall(&u->attribs, &at_mage);
|
||||
a_removeall(&u->attribs, &at_familiar);
|
||||
}
|
||||
}
|
||||
ADDMSG(&u->faction->msgs, msg_message("forget", "unit skill", u, sk));
|
||||
set_level(u, sk, 0);
|
||||
|
@ -1174,7 +1167,8 @@ attrib_type at_trades = {
|
|||
NO_READ
|
||||
};
|
||||
|
||||
static bool trade_needs_castle(const region *r, const race *rc) {
|
||||
bool trade_needs_castle(const terrain_type *terrain, const race *rc)
|
||||
{
|
||||
static int rc_change, terrain_change;
|
||||
static const race *rc_insect;
|
||||
static const terrain_type *t_desert, *t_swamp;
|
||||
|
@ -1185,7 +1179,19 @@ static bool trade_needs_castle(const region *r, const race *rc) {
|
|||
t_swamp = newterrain(T_SWAMP);
|
||||
t_desert = newterrain(T_DESERT);
|
||||
}
|
||||
return rc != rc_insect && (r->terrain == t_swamp || r->terrain == t_desert);
|
||||
return rc != rc_insect && (terrain == t_swamp || terrain == t_desert);
|
||||
}
|
||||
|
||||
static building * first_building(region *r, const struct building_type *btype, int minsize) {
|
||||
building *b = NULL;
|
||||
if (r->buildings) {
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (b->type == btype && b->size >= minsize) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void buy(unit * u, econ_request ** buyorders, struct order *ord)
|
||||
|
@ -1221,22 +1227,13 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord)
|
|||
|
||||
/* Entweder man ist Insekt in Sumpf/Wueste, oder es muss
|
||||
* einen Handelsposten in der Region geben: */
|
||||
if (trade_needs_castle(r, u_race(u))) {
|
||||
building *b = NULL;
|
||||
if (r->buildings) {
|
||||
static int cache;
|
||||
static const struct building_type *bt_castle;
|
||||
if (bt_changed(&cache)) {
|
||||
bt_castle = bt_find("castle");
|
||||
}
|
||||
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (b->type == bt_castle && b->size >= 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (trade_needs_castle(r->terrain, u_race(u))) {
|
||||
static int cache;
|
||||
static const struct building_type *castle_bt;
|
||||
if (bt_changed(&cache)) {
|
||||
castle_bt = bt_find("castle");
|
||||
}
|
||||
if (b == NULL) {
|
||||
if (first_building(r, castle_bt, 2) == NULL) {
|
||||
cmistake(u, ord, 119, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
@ -1539,29 +1536,14 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
/* In der Region muss es eine Burg geben. */
|
||||
|
||||
if (u_race(u) == get_race(RC_INSECT)) {
|
||||
if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
|
||||
&& !rbuildings(r)) {
|
||||
if (trade_needs_castle(r->terrain, u_race(u))) {
|
||||
/* In der Region muss es eine Burg geben. */
|
||||
if (first_building(r, castle_bt, 2) == NULL) {
|
||||
cmistake(u, ord, 119, MSG_COMMERCE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* ...oder in der Region muss es eine Burg geben. */
|
||||
building *b = 0;
|
||||
if (r->buildings) {
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (b->type == castle_bt && b->size >= 2) break;
|
||||
}
|
||||
}
|
||||
if (!b) {
|
||||
cmistake(u, ord, 119, MSG_COMMERCE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ein Haendler kann nur 10 Gueter pro Talentpunkt verkaufen. */
|
||||
|
||||
i = u->number * 10 * effskill(u, SK_TRADE, NULL);
|
||||
|
@ -1758,12 +1740,8 @@ static void breedtrees(unit * u, int raw)
|
|||
{
|
||||
int n, i, skill, planted = 0;
|
||||
const resource_type *rtype;
|
||||
int current_season;
|
||||
season_t current_season = calendar_season(turn);
|
||||
region *r = u->region;
|
||||
gamedate date;
|
||||
|
||||
get_gamedate(turn, &date);
|
||||
current_season = date.season;
|
||||
|
||||
/* Baeume zuechten geht nur im Fruehling */
|
||||
if (current_season != SEASON_SPRING) {
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_GC_ECONOMY
|
||||
#define H_GC_ECONOMY
|
||||
|
||||
|
@ -49,6 +31,7 @@ extern "C" {
|
|||
struct faction;
|
||||
struct order;
|
||||
struct message;
|
||||
struct terrain_type;
|
||||
struct item_type;
|
||||
|
||||
typedef struct econ_request {
|
||||
|
@ -85,6 +68,8 @@ extern "C" {
|
|||
void destroy(struct region *r);
|
||||
void produce(struct region *r);
|
||||
void auto_work(struct region *r);
|
||||
|
||||
bool trade_needs_castle(const struct terrain_type *terrain, const struct race *rc);
|
||||
|
||||
typedef enum income_t { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC, IC_LOOT } income_t;
|
||||
void add_income(struct unit * u, income_t type, int want, int qty);
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
#include "economy.h"
|
||||
#include "recruit.h"
|
||||
|
||||
#include <util/message.h>
|
||||
#include <kernel/attrib.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/calendar.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/pool.h>
|
||||
|
@ -20,9 +21,9 @@
|
|||
#include <kernel/terrainid.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <kernel/attrib.h>
|
||||
#include <util/language.h>
|
||||
#include <util/macros.h>
|
||||
#include <util/message.h>
|
||||
|
||||
#include <CuTest.h>
|
||||
#include <tests.h>
|
||||
|
@ -232,37 +233,78 @@ static unit *setup_trade_unit(CuTest *tc, region *r, const struct race *rc) {
|
|||
return u;
|
||||
}
|
||||
|
||||
static void test_trade_insect(CuTest *tc) {
|
||||
/* Insekten koennen in Wuesten und Suempfen auch ohne Burgen handeln. */
|
||||
unit *u;
|
||||
static void test_trade_needs_castle(CuTest *tc) {
|
||||
/* Handeln ist nur in Regionen mit Burgen möglich. */
|
||||
race *rc;
|
||||
region *r;
|
||||
unit *u;
|
||||
building *b;
|
||||
const terrain_type *t_swamp;
|
||||
const item_type *it_luxury;
|
||||
const item_type *it_silver;
|
||||
|
||||
test_setup();
|
||||
setup_production();
|
||||
test_create_locale();
|
||||
setup_terrains(tc);
|
||||
r = setup_trade_region(tc, get_terrain("swamp"));
|
||||
init_terrains();
|
||||
|
||||
t_swamp = get_terrain("swamp");
|
||||
r = setup_trade_region(tc, t_swamp);
|
||||
it_luxury = r_luxury(r);
|
||||
CuAssertPtrNotNull(tc, it_luxury);
|
||||
it_silver = get_resourcetype(R_SILVER)->itype;
|
||||
|
||||
u = setup_trade_unit(tc, r, test_create_race("insect"));
|
||||
rc = test_create_race(NULL);
|
||||
CuAssertTrue(tc, trade_needs_castle(t_swamp, rc));
|
||||
|
||||
u = test_create_unit(test_create_faction(rc), r);
|
||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, "1 %s",
|
||||
LOC(u->faction->locale, resourcename(it_luxury->rtype, 0))));
|
||||
unit_addorder(u, create_order(K_SELL, u->faction->locale, "1 %s",
|
||||
LOC(u->faction->locale, resourcename(it_luxury->rtype, 0))));
|
||||
produce(r);
|
||||
CuAssertIntEquals(tc, 2, test_count_messagetype(u->faction->msgs, "error119"));
|
||||
|
||||
test_set_item(u, it_silver, 10);
|
||||
CuAssertPtrEquals(tc, r, u->region);
|
||||
CuAssertPtrEquals(tc, (void *)it_luxury, (void *)r_luxury(u->region));
|
||||
test_clear_messages(u->faction);
|
||||
freset(u, UFL_LONGACTION);
|
||||
b = test_create_building(r, test_create_buildingtype("castle"));
|
||||
b->size = 1;
|
||||
produce(r);
|
||||
CuAssertIntEquals(tc, 2, test_count_messagetype(u->faction->msgs, "error119"));
|
||||
|
||||
test_clear_messages(u->faction);
|
||||
freset(u, UFL_LONGACTION);
|
||||
b->size = 2;
|
||||
test_clear_messages(u->faction);
|
||||
produce(r);
|
||||
CuAssertIntEquals(tc, 0, test_count_messagetype(u->faction->msgs, "error119"));
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_trade_insect(CuTest *tc) {
|
||||
/* Insekten koennen in Wuesten und Suempfen auch ohne Burgen handeln. */
|
||||
unit *u;
|
||||
region *r;
|
||||
race *rc;
|
||||
const terrain_type *t_swamp;
|
||||
const item_type *it_luxury;
|
||||
|
||||
test_setup();
|
||||
setup_production();
|
||||
test_create_locale();
|
||||
setup_terrains(tc);
|
||||
init_terrains();
|
||||
t_swamp = get_terrain("swamp");
|
||||
rc = test_create_race("insect");
|
||||
|
||||
r = setup_trade_region(tc, t_swamp);
|
||||
it_luxury = r_luxury(r);
|
||||
CuAssertTrue(tc, !trade_needs_castle(t_swamp, rc));
|
||||
CuAssertPtrNotNull(tc, it_luxury);
|
||||
u = setup_trade_unit(tc, r, rc);
|
||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, "1 %s",
|
||||
LOC(u->faction->locale, resourcename(it_luxury->rtype, 0))));
|
||||
unit_addorder(u, create_order(K_SELL, u->faction->locale, "1 %s",
|
||||
LOC(u->faction->locale, resourcename(it_luxury->rtype, 0))));
|
||||
produce(u->region);
|
||||
CuAssertPtrEquals(tc, NULL, test_find_messagetype(u->faction->msgs, "error119"));
|
||||
CuAssertIntEquals(tc, 1, get_item(u, it_luxury));
|
||||
CuAssertIntEquals(tc, 5, get_item(u, it_silver));
|
||||
|
||||
terraform_region(r, get_terrain("swamp"));
|
||||
CuAssertIntEquals(tc, 0, test_count_messagetype(u->faction->msgs, "error119"));
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
|
@ -494,6 +536,7 @@ static void test_recruit_insect(CuTest *tc) {
|
|||
u = test_create_unit(f, test_create_region(0, 0, NULL));
|
||||
u->thisorder = create_order(K_RECRUIT, f->locale, "%d", 1);
|
||||
|
||||
CuAssertIntEquals(tc, SEASON_AUTUMN, calendar_season(1083));
|
||||
msg = can_recruit(u, f->race, u->thisorder, 1083); /* Autumn */
|
||||
CuAssertPtrEquals(tc, NULL, msg);
|
||||
|
||||
|
@ -794,6 +837,7 @@ CuSuite *get_economy_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_heroes_dont_recruit);
|
||||
SUITE_ADD_TEST(suite, test_tax_cmd);
|
||||
SUITE_ADD_TEST(suite, test_buy_cmd);
|
||||
SUITE_ADD_TEST(suite, test_trade_needs_castle);
|
||||
SUITE_ADD_TEST(suite, test_trade_insect);
|
||||
SUITE_ADD_TEST(suite, test_maintain_buildings);
|
||||
SUITE_ADD_TEST(suite, test_recruit);
|
||||
|
|
12
src/give.c
12
src/give.c
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2014 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
|
12
src/give.h
12
src/give.h
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
|
||||
*/
|
||||
#ifndef H_GC_GIVE
|
||||
#define H_GC_GIVE
|
||||
|
||||
|
|
90
src/gmtool.c
90
src/gmtool.c
|
@ -1,13 +1,3 @@
|
|||
/*
|
||||
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
* | | Enno Rehling <enno@eressea.de>
|
||||
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
* | (c) 1998 - 2006 |
|
||||
* | | This program may not be used, modified or distributed
|
||||
* +-------------------+ without prior permission by the authors of Eressea.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
@ -451,16 +441,6 @@ static void paint_info_region(window * wnd, const state * st)
|
|||
r->land->trees[1] + r->land->trees[2]);
|
||||
}
|
||||
line++;
|
||||
if (r->ships && (st->info_flags & IFL_SHIPS)) {
|
||||
ship *sh;
|
||||
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||
mvwaddnstr(win, line++, 1, "* ships:", size - 5);
|
||||
wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||
for (sh = r->ships; sh && line < maxline; sh = sh->next) {
|
||||
mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
|
||||
umvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
|
||||
}
|
||||
}
|
||||
if (r->units && (st->info_flags & IFL_FACTIONS)) {
|
||||
unit *u;
|
||||
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||
|
@ -487,6 +467,16 @@ static void paint_info_region(window * wnd, const state * st)
|
|||
umvwaddnstr(win, line++, 6, unit_getname(u), size - 5);
|
||||
}
|
||||
}
|
||||
if (r->ships && (st->info_flags & IFL_SHIPS)) {
|
||||
ship *sh;
|
||||
wattron(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||
mvwaddnstr(win, line++, 1, "* ships:", size - 5);
|
||||
wattroff(win, A_BOLD | COLOR_PAIR(COLOR_YELLOW));
|
||||
for (sh = r->ships; sh && line < maxline; sh = sh->next) {
|
||||
mvwprintw(win, line, 1, "%.4s ", itoa36(sh->no));
|
||||
umvwaddnstr(win, line++, 6, (char *)sh->type->_name, size - 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,12 +570,49 @@ static void reset_region(region *r) {
|
|||
}
|
||||
}
|
||||
|
||||
static void reset_cursor(state *st) {
|
||||
static region * state_region(state *st) {
|
||||
int nx = st->cursor.x;
|
||||
int ny = st->cursor.y;
|
||||
region *r;
|
||||
pnormalize(&nx, &ny, st->cursor.pl);
|
||||
if ((r = findregion(nx, ny)) != NULL) {
|
||||
return findregion(nx, ny);
|
||||
}
|
||||
|
||||
static void reset_area_cb(void *arg) {
|
||||
region *r = (region *)arg;
|
||||
r->age = 0;
|
||||
freset(r, RF_MARK);
|
||||
}
|
||||
|
||||
static void reset_area(state *st) {
|
||||
region * r = state_region(st);
|
||||
if (r != NULL) {
|
||||
selist * ql = NULL;
|
||||
int qi = 0, qlen = 0;
|
||||
fset(r, RF_MARK);
|
||||
selist_insert(&ql, qlen++, r);
|
||||
while (qi != qlen) {
|
||||
int i;
|
||||
region *adj[MAXDIRECTIONS];
|
||||
r = selist_get(ql, qi++);
|
||||
get_neighbours(r, adj);
|
||||
for (i = 0; i != MAXDIRECTIONS; ++i) {
|
||||
region *rn = adj[i];
|
||||
if (rn && !fval(rn, RF_MARK)) {
|
||||
if ((rn->terrain->flags & FORBIDDEN_REGION) == 0) {
|
||||
fset(rn, RF_MARK);
|
||||
selist_insert(&ql, qlen++, rn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
selist_foreach(ql, reset_area_cb);
|
||||
selist_free(ql);
|
||||
}
|
||||
}
|
||||
|
||||
static void reset_cursor(state *st) {
|
||||
region * r = state_region(st);
|
||||
if (r != NULL) {
|
||||
reset_region(r);
|
||||
}
|
||||
}
|
||||
|
@ -1072,6 +1099,16 @@ static void seed_player(state *st, const newfaction *player) {
|
|||
}
|
||||
}
|
||||
|
||||
static bool confirm(WINDOW * win, const char *q) {
|
||||
int ch;
|
||||
werase(win);
|
||||
mvwaddstr(win, 0, 0, (char *)q);
|
||||
wmove(win, 0, (int)(strlen(q) + 1));
|
||||
ch = wgetch(win);
|
||||
return (ch == 'y') || (ch == 'Y');
|
||||
}
|
||||
|
||||
|
||||
static void handlekey(state * st, int c)
|
||||
{
|
||||
window *wnd;
|
||||
|
@ -1157,6 +1194,13 @@ static void handlekey(state * st, int c)
|
|||
st->wnd_status->update |= 1;
|
||||
st->wnd_map->update |= 1;
|
||||
break;
|
||||
case 'A': /* clear/reset area */
|
||||
if (confirm(st->wnd_status->handle, "Are you sure you want to reset this entire area?")) {
|
||||
reset_area(st);
|
||||
st->modified = 1;
|
||||
st->wnd_map->update |= 1;
|
||||
}
|
||||
break;
|
||||
case 'c': /* clear/reset */
|
||||
reset_cursor(st);
|
||||
st->modified = 1;
|
||||
|
|
10
src/gmtool.h
10
src/gmtool.h
|
@ -1,13 +1,3 @@
|
|||
/*
|
||||
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
* | | Enno Rehling <enno@eressea.de>
|
||||
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
* | (c) 1998 - 2006 |
|
||||
* | | This program may not be used, modified or distributed
|
||||
* +-------------------+ without prior permission by the authors of Eressea.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef H_GMTOOL
|
||||
#define H_GMTOOL
|
||||
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
/*
|
||||
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
* | | Enno Rehling <enno@eressea.de>
|
||||
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
* | (c) 1998 - 2006 |
|
||||
* | | This program may not be used, modified or distributed
|
||||
* +-------------------+ without prior permission by the authors of Eressea.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef H_GMTOOL_STRUCTS
|
||||
#define H_GMTOOL_STRUCTS
|
||||
|
||||
|
|
18
src/guard.c
18
src/guard.c
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "guard.h"
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,4 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2008 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
12
src/items.h
12
src/items.h
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_KRNL_ITEMS
|
||||
#define H_KRNL_ITEMS
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include "speedsail.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ITM_SPEEDVIAL
|
||||
#define H_ITM_SPEEDVIAL
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <platform.h>
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_ITM_WEAPONS
|
||||
#define H_ITM_WEAPONS
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include "xerewards.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_ITM_XEREWARDS
|
||||
#define H_ITM_XEREWARDS
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2004 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include "jsonconf.h"
|
||||
|
||||
|
@ -792,7 +780,7 @@ static void json_calendar(cJSON *json) {
|
|||
for (i = 0, jmonth = child->child; jmonth; jmonth = jmonth->next, ++i) {
|
||||
if (jmonth->type == cJSON_Object) {
|
||||
storms[i] = cJSON_GetObjectItem(jmonth, "storm")->valueint;
|
||||
month_season[i] = cJSON_GetObjectItem(jmonth, "season")->valueint;
|
||||
month_season[i] = (season_t) cJSON_GetObjectItem(jmonth, "season")->valueint;
|
||||
}
|
||||
else {
|
||||
log_error("calendar.months[%d] is not an object: %d", i, json->type);
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| (c) 1998 - 2007 | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_JSONCONF_H
|
||||
#define H_JSONCONF_H
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -160,8 +160,8 @@ static void test_calendar(CuTest * tc)
|
|||
CuAssertIntEquals(tc, 99, storms[0]);
|
||||
CuAssertIntEquals(tc, 22, storms[1]);
|
||||
CuAssertPtrNotNull(tc, month_season);
|
||||
CuAssertIntEquals(tc, 1, month_season[0]);
|
||||
CuAssertIntEquals(tc, 2, month_season[1]);
|
||||
CuAssertIntEquals(tc, SEASON_SPRING, month_season[0]);
|
||||
CuAssertIntEquals(tc, SEASON_SUMMER, month_season[1]);
|
||||
cJSON_Delete(json);
|
||||
test_teardown();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,3 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include "alliance.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef H_KRNL_ALLIANCE
|
||||
#define H_KRNL_ALLIANCE
|
||||
|
||||
|
|
|
@ -185,6 +185,29 @@ static int ally_flag(const char *s, int help_mask)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ally_status(const char *s)
|
||||
{
|
||||
if (strcmp(s, "give") == 0) {
|
||||
return HELP_GIVE;
|
||||
}
|
||||
else if (strcmp(s, "fight") == 0) {
|
||||
return HELP_FIGHT;
|
||||
}
|
||||
else if (strcmp(s, "money") == 0) {
|
||||
return HELP_MONEY;
|
||||
}
|
||||
else if (strcmp(s, "travel") == 0) {
|
||||
return HELP_TRAVEL;
|
||||
}
|
||||
else if (strcmp(s, "guard") == 0) {
|
||||
return HELP_GUARD;
|
||||
}
|
||||
else if (strcmp(s, "all") == 0) {
|
||||
return HELP_ALL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Specifies automatic alliance modes.
|
||||
* If this returns a value then the bits set are immutable between alliance
|
||||
* partners (faction::alliance) and cannot be changed with the HELP command.
|
||||
|
@ -215,22 +238,6 @@ autoalliance(const faction * sf, const faction * f2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void init_npcfaction(variant *var)
|
||||
{
|
||||
var->i = 1;
|
||||
}
|
||||
|
||||
attrib_type at_npcfaction = {
|
||||
"npcfaction",
|
||||
init_npcfaction,
|
||||
NULL,
|
||||
NULL,
|
||||
a_writeint,
|
||||
a_readint,
|
||||
NULL,
|
||||
ATF_UNIQUE
|
||||
};
|
||||
|
||||
/** Limits the available help modes
|
||||
* The bitfield returned by this function specifies the available help modes
|
||||
* in this game (so you can, for example, disable HELP GIVE globally).
|
||||
|
@ -284,12 +291,6 @@ int alliance_status(const faction *f, const faction *f2, int status) {
|
|||
if (status > 0) {
|
||||
int mask = AllianceRestricted();
|
||||
if (mask) {
|
||||
if (a_find(f->attribs, &at_npcfaction)) {
|
||||
return status;
|
||||
}
|
||||
if (a_find(f2->attribs, &at_npcfaction)) {
|
||||
return status;
|
||||
}
|
||||
if (f->alliance != f2->alliance) {
|
||||
status &= ~mask;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef ALLY_H
|
||||
#define ALLY_H
|
||||
|
||||
|
@ -32,6 +14,7 @@ struct allies;
|
|||
|
||||
extern struct attrib_type at_npcfaction;
|
||||
|
||||
int ally_status(const char *s);
|
||||
int ally_get(struct allies *al, const struct faction *f);
|
||||
void ally_set(struct allies **p_al, struct faction *f, int status);
|
||||
void write_allies(struct gamedata * data, const struct allies *alist);
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include "attrib.h"
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef ATTRIB_H
|
||||
#define ATTRIB_H
|
||||
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
/*
|
||||
Copyright (c) 1998-2019, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <platform.h>
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue