forked from github/server
commit
017f2c4e75
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.
|
|
@ -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.
|
||||
|
||||
* [![License Text](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](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
|
|||
|
||||
* [![Static Analysis](https://scan.coverity.com/projects/6742/badge.svg?flat=1)](https://scan.coverity.com/projects/6742/)
|
||||
* [![Build Status](https://api.travis-ci.org/eressea/server.svg?branch=develop)](https://travis-ci.org/eressea/server)
|
||||
* [![License: CC BY-NC-SA 4.0](https://licensebuttons.net/l/by-nc-sa/4.0/80x15.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/)
|
||||
|
|
2
clibs
2
clibs
|
@ -1 +1 @@
|
|||
Subproject commit f8969f44de1ec413cfee82b23c9f4b3c32d49b56
|
||||
Subproject commit abe774f70265de14ea7f5e530518ca130562a9c9
|
|
@ -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">
|
||||
|
|
|
@ -703,8 +703,8 @@
|
|||
<race name="undead" maxaura="1" regaura="1" weight="1000"
|
||||
capacity="540" speed="1.0" hp="20" damage="1d7" unarmedattack="0"
|
||||
unarmeddefense="0" attackmodifier="1" defensemodifier="1"
|
||||
walk="yes" learn="no" teach="no" noheal="yes"
|
||||
undead="yes" equipment="yes" giveperson="yes">
|
||||
walk="yes" learn="no" teach="no" noheal="yes" desert="yes"
|
||||
undead="yes" equipment="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="20000" moverandom="yes" scarepeasants="yes"/>
|
||||
<attack type="4" damage="1d7"/>
|
||||
<attack type="5"/>
|
||||
|
@ -801,7 +801,7 @@
|
|||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
|
||||
<race name="skeletonlord" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<race name="skeletonlord" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" walk="yes" learn="no" teach="no" noheal="yes" desert="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" scarepeasants="yes" moverandom="yes" absorbpeasants="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -816,7 +816,7 @@
|
|||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
|
||||
<race name="skeleton" magres="10" maxaura="1.0" regaura="1.0" weight="500" capacity="540" speed="1.0" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<race name="skeleton" magres="10" maxaura="1.0" regaura="1.0" weight="500" capacity="540" speed="1.0" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="10000" killpeasants="yes" scarepeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
|
|
@ -732,7 +732,7 @@
|
|||
<attack type="4" damage="1d30"/>
|
||||
<attack type="6" spell="fiery_dragonbreath" level="3" />
|
||||
</race>
|
||||
<race name="undead" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d7" unarmedattack="0" unarmeddefense="0" attackmodifier="1" defensemodifier="1" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" giveperson="yes">
|
||||
<race name="undead" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d7" unarmedattack="0" unarmeddefense="0" attackmodifier="1" defensemodifier="1" walk="yes" learn="no" teach="no" noheal="yes" desert="yes" undead="yes" equipment="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="20000" moverandom="yes" scarepeasants="yes"/>
|
||||
<attack type="4" damage="1d7"/>
|
||||
<attack type="5"/>
|
||||
|
@ -1044,7 +1044,7 @@
|
|||
<skill name="unarmed" modifier="1"/>
|
||||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
<race name="skeletonlord" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<race name="skeletonlord" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="2000" absorbpeasants="yes" killpeasants="yes" moverandom="yes" scarepeasants="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -1058,7 +1058,7 @@
|
|||
<attack type="1" damage="1d7"/>
|
||||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
<race name="skeleton" magres="10" maxaura="1.000000" regaura="1.000000" weight="500" capacity="540" speed="1.000000" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<race name="skeleton" magres="10" maxaura="1.000000" regaura="1.000000" weight="500" capacity="540" speed="1.000000" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" walk="yes" learn="no" teach="no" noheal="yes" undead="yes" desert="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes" unarmedguard="yes">
|
||||
<ai splitsize="10000" killpeasants="yes" moverandom="yes" scarepeasants="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
|
|
@ -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).\""
|
||||
|
@ -2768,6 +2768,24 @@ msgstr "\"$unit($unit) verspeiste $int($amount) Bauern.\""
|
|||
msgid "error320"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit kann nicht bewachen, da sie versucht zu fliehen.\""
|
||||
|
||||
msgid "error325"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Zauber kann nur auf ein einzelnes Schiff gewirkt werden.\""
|
||||
|
||||
msgid "error324"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit gehört nicht zu unserer Partei.\""
|
||||
|
||||
msgid "error322"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit ist bereits auf einem Schiff.\""
|
||||
|
||||
msgid "error323"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Das Schiff ist verzaubert.\""
|
||||
|
||||
msgid "error327"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - So viele Schiffe kann die Einheit nicht übergeben.\""
|
||||
|
||||
msgid "error326"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Diese Schiffe können keinen Konvoi bilden.\""
|
||||
|
||||
msgid "dissolve_units_2"
|
||||
msgstr "\"$unit($unit) in $region($region): $int($number) $race($race,$number) $if($eq($number,1),\"wurde zum Baum\", \"wurden zu Bäumen\").\""
|
||||
|
||||
|
|
|
@ -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).\""
|
||||
|
@ -2768,6 +2768,24 @@ msgstr "\"$unit($unit) ate $int($amount) peasants.\""
|
|||
msgid "error320"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit cannot guard the region because it is trying to flee.\""
|
||||
|
||||
msgid "error325"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Spells can only be cast on a single ship.\""
|
||||
|
||||
msgid "error326"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - These ships cannot form a convoy.\""
|
||||
|
||||
msgid "error327"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit must keep at least one ship.\""
|
||||
|
||||
msgid "error324"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is not one of ours.\""
|
||||
|
||||
msgid "error322"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is already on a ship.\""
|
||||
|
||||
msgid "error323"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship is under a spell.\""
|
||||
|
||||
msgid "dissolve_units_2"
|
||||
msgstr "\"$unit($unit) in $region($region): $int($number) $race($race,$number) turned into $if($eq($number,1),\"a tree\", \"trees\").\""
|
||||
|
||||
|
|
|
@ -389,6 +389,9 @@ msgstr "Schaffenstrunk"
|
|||
msgid "balloon_a"
|
||||
msgstr "ein Ballon"
|
||||
|
||||
msgid "balloon_p"
|
||||
msgstr "Ballons"
|
||||
|
||||
msgid "undead_name_8"
|
||||
msgstr "Monster"
|
||||
|
||||
|
@ -570,8 +573,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"
|
||||
|
@ -1103,6 +1118,9 @@ msgstr "Orks"
|
|||
msgid "boat_a"
|
||||
msgstr "ein Boot"
|
||||
|
||||
msgid "boat_p"
|
||||
msgstr "Boote"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "nymph"
|
||||
msgstr "Nymphe"
|
||||
|
@ -1707,9 +1725,15 @@ msgstr "Ring der Unsichtbarkeit"
|
|||
msgid "caravel_a"
|
||||
msgstr "eine Karavelle"
|
||||
|
||||
msgid "caravel_p"
|
||||
msgstr "Karavellen"
|
||||
|
||||
msgid "galleon_a"
|
||||
msgstr "eine Galeone"
|
||||
|
||||
msgid "galleon_p"
|
||||
msgstr "Galeonen"
|
||||
|
||||
msgctxt "keyword"
|
||||
msgid "describe"
|
||||
msgstr "BESCHREIBE"
|
||||
|
@ -1883,6 +1907,9 @@ msgstr "Untoten"
|
|||
msgid "flyingcarpet_a"
|
||||
msgstr "ein fliegender Teppich"
|
||||
|
||||
msgid "flyingcarpet_p"
|
||||
msgstr "fliegende Teppiche"
|
||||
|
||||
msgid "mallorntree_p"
|
||||
msgstr "Mallorn"
|
||||
|
||||
|
@ -2794,6 +2821,9 @@ msgstr "Fjordwuchs"
|
|||
msgid "trireme_a"
|
||||
msgstr "eine Trireme"
|
||||
|
||||
msgid "trireme_p"
|
||||
msgstr "Triremen"
|
||||
|
||||
msgctxt "prefix"
|
||||
msgid "Dunkel"
|
||||
msgstr "Dunkel"
|
||||
|
@ -4100,6 +4130,9 @@ msgstr "Luchs"
|
|||
msgid "longboat_a"
|
||||
msgstr "ein Langboot"
|
||||
|
||||
msgid "longboat_p"
|
||||
msgstr "Langboote"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "human_d"
|
||||
msgstr "Menschen"
|
||||
|
@ -4408,9 +4441,6 @@ msgstr "Magie"
|
|||
msgid "see_lighthouse"
|
||||
msgstr "vom Turm erblickt"
|
||||
|
||||
msgid "nr_schemes_prefix"
|
||||
msgstr "Schemen der Regionen"
|
||||
|
||||
msgid "aoc_p"
|
||||
msgstr "Katzenamulette"
|
||||
|
||||
|
@ -5849,6 +5879,9 @@ msgstr "Tiger"
|
|||
msgid "dragonship_a"
|
||||
msgstr "ein Drachenschiff"
|
||||
|
||||
msgid "dragonship_p"
|
||||
msgstr "Drachenschiffe"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "mountainguard_x"
|
||||
msgstr "Bergwächter"
|
||||
|
|
|
@ -303,6 +303,9 @@ msgstr "busybeer"
|
|||
msgid "balloon_a"
|
||||
msgstr "a balloon"
|
||||
|
||||
msgid "balloon_p"
|
||||
msgstr "balloons"
|
||||
|
||||
msgid "jadee_ring"
|
||||
msgstr "Jadee's wedding ring"
|
||||
|
||||
|
@ -444,9 +447,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"
|
||||
|
||||
|
@ -882,6 +882,9 @@ msgstr "gems"
|
|||
msgid "boat_a"
|
||||
msgstr "a boat"
|
||||
|
||||
msgid "boat_p"
|
||||
msgstr "boats"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "orc_p"
|
||||
msgstr "orcs"
|
||||
|
@ -1461,12 +1464,18 @@ msgstr "ring of invisibility"
|
|||
msgid "galleon_a"
|
||||
msgstr "a galleon"
|
||||
|
||||
msgid "galleon_p"
|
||||
msgstr "galleons"
|
||||
|
||||
msgid "galleon"
|
||||
msgstr "galleon"
|
||||
|
||||
msgid "caravel_a"
|
||||
msgstr "a caravel"
|
||||
|
||||
msgid "caravel_p"
|
||||
msgstr "caravels"
|
||||
|
||||
msgid "mallornspear_p"
|
||||
msgstr "mallorn spear"
|
||||
|
||||
|
@ -2442,6 +2451,9 @@ msgstr "fjord fungus"
|
|||
msgid "trireme_a"
|
||||
msgstr "a trireme"
|
||||
|
||||
msgid "trireme_p"
|
||||
msgstr "triremes"
|
||||
|
||||
msgctxt "spell"
|
||||
msgid "healing"
|
||||
msgstr "Heal"
|
||||
|
@ -3642,6 +3654,9 @@ msgstr "goblin head"
|
|||
msgid "longboat_a"
|
||||
msgstr "a longboat"
|
||||
|
||||
msgid "longboat_p"
|
||||
msgstr "longboats"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "lynx"
|
||||
msgstr "lynx"
|
||||
|
@ -3937,8 +3952,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"
|
||||
|
@ -5162,6 +5189,9 @@ msgstr "tiger"
|
|||
msgid "dragonship_a"
|
||||
msgstr "a dragonship"
|
||||
|
||||
msgid "dragonship_p"
|
||||
msgstr "dragonships"
|
||||
|
||||
msgctxt "race"
|
||||
msgid "mountainguard_x"
|
||||
msgstr "mountainguard"
|
||||
|
|
|
@ -1134,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')
|
||||
|
|
|
@ -15,16 +15,20 @@ end
|
|||
|
||||
function test_fetch_astral()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local ra = r:get_astral('fog')
|
||||
local rb = region.create(ra.x + 1, ra.y, 'fog')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
local u3 = unit.create(f, rb, 1)
|
||||
rb.plane = ra.plane
|
||||
u1.magic = "gray"
|
||||
u1:set_skill("magic", 6)
|
||||
u1.aura = 0
|
||||
u1:add_spell("fetch_astral")
|
||||
|
||||
u1:clear_orders()
|
||||
u1:add_order("ZAUBERE Ruf~der~Realitaet " .. itoa36(u2.id))
|
||||
u1:add_order("ZAUBERE Ruf~der~Realitaet " .. itoa36(u2.id) .. " " .. itoa36(u3.id))
|
||||
process_orders()
|
||||
assert_equal(1, f:count_msg_type('missing_components_list'), 'no components')
|
||||
|
||||
|
@ -33,10 +37,11 @@ function test_fetch_astral()
|
|||
assert_equal(12, u1.aura)
|
||||
assert_equal(1, f:count_msg_type('spellfail_astralonly'), 'astral space')
|
||||
|
||||
u2.region = u2.region:get_astral('fog')
|
||||
u2.region = ra
|
||||
process_orders()
|
||||
assert_equal(0, u1.aura)
|
||||
assert_equal(u1.region, u2.region)
|
||||
assert_equal(r, u2.region)
|
||||
assert_equal(rb, u3.region)
|
||||
end
|
||||
|
||||
function test_pull_astral()
|
||||
|
|
|
@ -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
|
|
@ -1,6 +1,6 @@
|
|||
require 'tests.e2.allies'
|
||||
require 'tests.e2.quit'
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.carts'
|
||||
require 'tests.e2.quit'
|
||||
require 'tests.e2.astral'
|
||||
require 'tests.e2.spells'
|
||||
require 'tests.e2.e2features'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,11 +5,40 @@ module("tests.e2.movement", package.seeall, lunit.testcase)
|
|||
function setup()
|
||||
eressea.free_game()
|
||||
eressea.settings.set("rules.food.flags", "4")
|
||||
eressea.settings.set("rules.ship.damage.nocrewocean", "0")
|
||||
eressea.settings.set("rules.ship.damage.nocrew", "0")
|
||||
eressea.settings.set("rules.ship.drifting", "0")
|
||||
eressea.settings.set("rules.ship.storms", "0")
|
||||
eressea.settings.set("nmr.timeout", "0")
|
||||
eressea.settings.set("NewbieImmunity", "0")
|
||||
end
|
||||
|
||||
function test_piracy()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "ocean")
|
||||
local r3 = region.create(-1, 0, "ocean")
|
||||
local f = faction.create("human", "pirate@eressea.de", "de")
|
||||
local f2 = faction.create("human", "elf@eressea.de", "de")
|
||||
local u1 = unit.create(f, r2, 1)
|
||||
local u2 = unit.create(f2, r3, 1)
|
||||
|
||||
u1.ship = ship.create(r2, "longboat")
|
||||
u2.ship = ship.create(r3, "longboat")
|
||||
u1:set_skill("sailing", 10)
|
||||
u2:set_skill("sailing", 10)
|
||||
|
||||
u1:clear_orders()
|
||||
u1:add_order("PIRATERIE")
|
||||
u2:clear_orders()
|
||||
u2:add_order("NACH o")
|
||||
|
||||
process_orders()
|
||||
|
||||
assert_equal(r, u2.region) -- Nach Osten
|
||||
assert_equal(r, u1.region) -- Entern!
|
||||
end
|
||||
|
||||
function test_piracy_to_land()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local r3 = region.create(-1, 0, "ocean")
|
||||
|
@ -30,10 +59,8 @@ function test_piracy()
|
|||
|
||||
process_orders()
|
||||
|
||||
if r2~=u1.region then
|
||||
write_reports()
|
||||
end
|
||||
assert_equal(r2, u1.region) -- should pass, but fails!!!
|
||||
assert_equal(r, u2.region) -- Nach Osten
|
||||
assert_equal(r2, u1.region) -- bewegt sich nicht
|
||||
end
|
||||
|
||||
function test_dolphin_on_land()
|
||||
|
@ -134,63 +161,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
|
||||
|
|
|
@ -75,3 +75,443 @@ function test_speedy_ship_fast()
|
|||
process_orders()
|
||||
assert_equal(8, u1.region.x)
|
||||
end
|
||||
|
||||
function test_ship_convoy_capacity()
|
||||
local r1 = region.create(1, 0, 'ocean')
|
||||
local r2 = region.create(2, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r1, 1)
|
||||
|
||||
u:add_order('NACH O')
|
||||
u:set_skill('sailing', 10, true)
|
||||
u:add_item('jewel', 490)
|
||||
u.ship = ship.create(r1, 'longboat')
|
||||
assert_equal(1, u.ship.number)
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r2, u.region)
|
||||
|
||||
u:add_order('NACH W')
|
||||
u:add_item('jewel', 1)
|
||||
u:set_skill('sailing', 2, true)
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r2, u.region) -- too heavy
|
||||
|
||||
u:add_order('NACH W')
|
||||
u:add_item('jewel', 489)
|
||||
u.ship.number = 2
|
||||
u.number = 2
|
||||
u:set_skill('sailing', 10, true)
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r1, u.region) -- double capacity
|
||||
|
||||
u:add_order('NACH O')
|
||||
u.ship.number = 2
|
||||
u:add_item('jewel', 1) -- too heavy again
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r1, u.region)
|
||||
end
|
||||
|
||||
function test_ship_convoy_crew()
|
||||
local r1 = region.create(1, 0, 'ocean')
|
||||
local r2 = region.create(2, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r1, 1)
|
||||
u.ship = ship.create(r1, 'longboat')
|
||||
u.ship.number = 2
|
||||
|
||||
u.number = 2
|
||||
u:set_skill('sailing', 5, true)
|
||||
u:add_order('NACH O')
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r1, u.region) -- not enough captains
|
||||
|
||||
u:set_skill('sailing', 10, true)
|
||||
u:add_order('NACH O')
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(r2, u.region)
|
||||
end
|
||||
|
||||
function test_ship_convoy_skill()
|
||||
local r1 = region.create(1, 0, 'ocean')
|
||||
local r2 = region.create(2, 0, 'ocean')
|
||||
local r3 = region.create(3, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r1, 1)
|
||||
|
||||
u:set_skill('sailing', 10, true)
|
||||
u.ship = ship.create(r1, 'longboat')
|
||||
assert_equal(1, u.ship.number)
|
||||
u:add_order('NACH O')
|
||||
process_orders()
|
||||
assert_equal(r2, u.region)
|
||||
|
||||
u.ship.number = 2
|
||||
u:set_skill('sailing', 20, true)
|
||||
process_orders()
|
||||
assert_equal(r2, u.region) -- not enough captains
|
||||
|
||||
u.number = 2
|
||||
u:set_skill('sailing', 10, true)
|
||||
process_orders()
|
||||
assert_equal(r3, u.region)
|
||||
end
|
||||
|
||||
function test_give_ship()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_new_unit()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_same_ship()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u2.ship = u1.ship
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
assert_not_equal(u1.ship, u2.ship)
|
||||
end
|
||||
|
||||
function test_give_ship_all_on_ocean()
|
||||
local r = region.create(0, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB 0 2 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_all_on_land()
|
||||
local r = region.create(0, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB 0 2 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(nil, u1.ship)
|
||||
assert_not_equal(nil, r.ships())
|
||||
end
|
||||
|
||||
function test_give_ship_no_boat()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'boat')
|
||||
u1.ship.number = 1
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(nil, u2.ship)
|
||||
end
|
||||
|
||||
function test_give_ship_away()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB 0 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
local count = 0
|
||||
for sh in r.ships do
|
||||
assert_equal(1, sh.number)
|
||||
count = count + 1
|
||||
end
|
||||
assert_equal(2, count)
|
||||
end
|
||||
|
||||
function test_give_ship_only_to_captain()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
local u3 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
u3.ship = u2.ship
|
||||
u1:add_order("GIB " .. itoa36(u3.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_compatible_coasts()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 4
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
|
||||
-- cannot give a ship with different coast:
|
||||
u1.ship.coast = 1
|
||||
u2.ship.coast = 2
|
||||
process_orders()
|
||||
assert_equal(4, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
|
||||
-- can give a ship with no coast:
|
||||
u1.ship.coast = -1
|
||||
u2.ship.coast = 2
|
||||
process_orders()
|
||||
assert_equal(3, u1.ship.number)
|
||||
assert_equal(2, u2.ship.number)
|
||||
assert_equal(2, u2.ship.coast)
|
||||
|
||||
-- can give a ship with same coast:
|
||||
u1.ship.coast = 2
|
||||
u2.ship.coast = 2
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
assert_equal(3, u2.ship.number)
|
||||
assert_equal(2, u2.ship.coast)
|
||||
|
||||
-- giving to a ship with no coast:
|
||||
u1.ship.coast = 2
|
||||
u2.ship.coast = -1
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(4, u2.ship.number)
|
||||
assert_equal(2, u2.ship.coast)
|
||||
end
|
||||
|
||||
function test_give_ship_only_from_captain()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
local u3 = unit.create(f, r, 1)
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u3.ship = u1.ship
|
||||
u3:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_merge()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(2, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_only_same()
|
||||
local r = region.create(1, 0, 'ocean')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
u1.ship = ship.create(r, 'caravel')
|
||||
u1.ship.number = 2
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
assert_equal(1, u2.ship.number)
|
||||
end
|
||||
|
||||
function test_give_ship_scale()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
sh.number = 3
|
||||
sh.damage = 9
|
||||
sh.size = 12
|
||||
u1.ship = sh
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 2 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(1, u1.ship.number)
|
||||
assert_equal(3, u1.ship.damage)
|
||||
assert_equal(4, u1.ship.size)
|
||||
assert_equal(2, u2.ship.number)
|
||||
assert_equal(6, u2.ship.damage)
|
||||
assert_equal(8, u2.ship.size)
|
||||
end
|
||||
|
||||
function test_give_ship_all_ships()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human", 'noreply@vg.no')
|
||||
local u1 = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u1.ship = ship.create(r, 'longboat')
|
||||
u1.ship.damage = 2
|
||||
u1.ship.number = 2
|
||||
u2.ship = ship.create(r, 'longboat')
|
||||
u2.ship.number = 1
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 2 SCHIFF")
|
||||
process_orders()
|
||||
write_reports()
|
||||
assert_equal(3, u2.ship.number)
|
||||
assert_equal(u2.ship, u1.ship)
|
||||
end
|
||||
|
||||
function test_give_ship_self_only()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f1 = faction.create("human")
|
||||
local f2 = faction.create("human")
|
||||
local u1 = unit.create(f1, r, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
sh.number = 2
|
||||
u1.ship = sh
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(2, u1.ship.number)
|
||||
assert_equal(nil, u2.ship)
|
||||
end
|
||||
|
||||
function test_give_ship_not_cursed()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
u:add_item("speedsail", 1)
|
||||
u:add_order("BENUTZE 1 Sonnensegel")
|
||||
process_orders()
|
||||
u:clear_orders()
|
||||
assert_equal(1, sh:get_curse('shipspeedup'))
|
||||
|
||||
u:add_order("GIB " .. itoa36(u2.id) .. " 1 SCHIFF")
|
||||
process_orders()
|
||||
assert_equal(nil, u2.ship)
|
||||
end
|
||||
|
||||
function test_speedsail_on_ship()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r, 1)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
u:add_item("speedsail", 1)
|
||||
u:add_order("BENUTZE 1 Sonnensegel")
|
||||
process_orders()
|
||||
assert_equal(1, sh:get_curse('shipspeedup'))
|
||||
end
|
||||
|
||||
function test_no_speedsail_on_convoy()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r, 1)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
sh.number = 2
|
||||
u:add_item("speedsail", 2)
|
||||
u:add_order("BENUTZE 2 Sonnensegel")
|
||||
process_orders()
|
||||
assert_equal(nil, sh:get_curse('shipspeedup'))
|
||||
end
|
||||
|
||||
function test_build_ship()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r, 25)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
sh.size = 25
|
||||
u:set_skill('shipcraft', 1)
|
||||
u:add_item("log", 50)
|
||||
u:add_order("MACHE SCHIFF " .. itoa36(sh.id))
|
||||
process_orders()
|
||||
assert_equal(50, sh.size)
|
||||
assert_equal(25, u:get_item('log'))
|
||||
end
|
||||
|
||||
function test_build_convoy()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r, 50)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
sh.number = 2
|
||||
sh.size = 25
|
||||
u:set_skill('shipcraft', 1)
|
||||
u:add_item("log", 100)
|
||||
u:add_order("MACHE SCHIFF " .. itoa36(sh.id))
|
||||
process_orders()
|
||||
assert_equal(75, sh.size)
|
||||
assert_equal(50, u:get_item('log'))
|
||||
end
|
||||
|
||||
function test_repair_convoy()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r, 50)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
sh.number = 2
|
||||
sh.damage = 7500 -- 75 Holz
|
||||
u:set_skill('shipcraft', 1)
|
||||
u:add_item("log", 100)
|
||||
u:add_order("MACHE SCHIFF " .. itoa36(sh.id))
|
||||
process_orders()
|
||||
assert_equal(2500, sh.damage)
|
||||
assert_equal(50, u:get_item('log'))
|
||||
end
|
||||
|
||||
function test_build_convoy_max()
|
||||
local r = region.create(1, 0, 'plain')
|
||||
local f = faction.create("insect")
|
||||
local u = unit.create(f, r, 100)
|
||||
local sh = ship.create(r, 'longboat')
|
||||
u.ship = sh
|
||||
sh.number = 2
|
||||
sh.size = 25
|
||||
u:set_skill('shipcraft', 1)
|
||||
u:add_item("log", 100)
|
||||
u:add_order("MACHE SCHIFF " .. itoa36(sh.id))
|
||||
process_orders()
|
||||
assert_equal(100, sh.size)
|
||||
assert_equal(25, u:get_item('log'))
|
||||
end
|
||||
|
|
|
@ -9,6 +9,7 @@ function setup()
|
|||
eressea.settings.set("NewbieImmunity", "0")
|
||||
eressea.settings.set("rules.food.flags", "4")
|
||||
eressea.settings.set("rules.peasants.growth.factor", "0")
|
||||
eressea.settings.set("magic.resist.enable", "0")
|
||||
eressea.settings.set("magic.fumble.enable", "0")
|
||||
eressea.settings.set("magic.regeneration.enable", "0")
|
||||
end
|
||||
|
@ -234,8 +235,6 @@ function test_familiar_school()
|
|||
local u = unit.create(f, r)
|
||||
u.magic = "draig"
|
||||
u:set_skill("magic", 10)
|
||||
u.aura = 200
|
||||
u:add_spell("fireball")
|
||||
local uf = unit.create(f, r)
|
||||
uf.race = "lynx"
|
||||
u.familiar = uf
|
||||
|
@ -247,3 +246,19 @@ function test_familiar_school()
|
|||
assert_equal(0, uf.aura)
|
||||
assert_nil(uf.magic)
|
||||
end
|
||||
|
||||
function test_astral_disruption()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = r:get_astral('fog')
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r)
|
||||
local uh = unit.create(get_monsters(), r2, 1, "braineater")
|
||||
u.magic = "draig"
|
||||
u:set_skill("magic", 100) -- level 100 should beat magic resistance
|
||||
u.aura = 200
|
||||
u:add_spell("astral_disruption")
|
||||
u:add_order('ZAUBERE STUFE 1 "Stoere Astrale Integritaet"')
|
||||
process_orders()
|
||||
assert_not_nil(r2:get_curse("astralblock"))
|
||||
assert_equal(r, uh.region)
|
||||
end
|
||||
|
|
|
@ -28,8 +28,6 @@ function test_work()
|
|||
end
|
||||
|
||||
function test_bug_2361_forget_magic()
|
||||
-- https://bugs.eressea.de/view.php?id=2361
|
||||
-- familiars cannot forget magic
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r, 1)
|
||||
|
@ -38,12 +36,30 @@ function test_bug_2361_forget_magic()
|
|||
u:add_order("VERGESSE Magie")
|
||||
u:set_skill('magic', 5)
|
||||
uf.race = 'unicorn'
|
||||
u.familiar = uf
|
||||
process_orders()
|
||||
assert_equal(0, u:get_skill('magic'))
|
||||
assert_nil(u.familiar)
|
||||
-- without a mage, familiars become ghosts:
|
||||
assert_equal('ghost', uf.race_name)
|
||||
assert_equal(0, uf:get_skill('magic'))
|
||||
end
|
||||
|
||||
function test_bug_2361_familiar_cannot_forget_magic_()
|
||||
-- https://bugs.eressea.de/view.php?id=2361
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u = unit.create(f, r, 1)
|
||||
local uf = unit.create(f, r, 1)
|
||||
u:clear_orders()
|
||||
u:set_skill('magic', 5)
|
||||
uf.race = 'unicorn'
|
||||
uf:clear_orders()
|
||||
uf:add_order("VERGESSE Magie")
|
||||
uf:set_skill('magic', 5)
|
||||
u.familiar = uf
|
||||
process_orders()
|
||||
assert_equal(0, u:get_skill('magic'))
|
||||
-- familiars cannot forget magic:
|
||||
assert_equal(5, uf:get_skill('magic'))
|
||||
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"
|
||||
|
|
|
@ -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
|
||||
|
|
5550
src/battle.c
5550
src/battle.c
File diff suppressed because it is too large
Load Diff
34
src/battle.h
34
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
|
||||
|
||||
|
@ -99,9 +81,9 @@ extern "C" {
|
|||
int nsides;
|
||||
struct selist *meffects;
|
||||
int max_tactics;
|
||||
int turn;
|
||||
unsigned char turn;
|
||||
signed char keeploot; /* keep (50 + keeploot) percent of items as loot */
|
||||
bool has_tactics_turn;
|
||||
int keeploot;
|
||||
bool reelarrow;
|
||||
int alive;
|
||||
struct {
|
||||
|
@ -171,13 +153,13 @@ extern "C" {
|
|||
int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */
|
||||
struct person {
|
||||
int hp; /* Trefferpunkte der Personen */
|
||||
int attack;
|
||||
int defense;
|
||||
int damage;
|
||||
int flags;
|
||||
int speed;
|
||||
int reload;
|
||||
int last_action;
|
||||
int attack; /* weapon skill bonus for attacker */
|
||||
int defense; /* weapon skill bonus for defender */
|
||||
char damage; /* bonus damage for melee attacks (e.g. troll belt) */
|
||||
unsigned char speed;
|
||||
unsigned char reload;
|
||||
unsigned char last_action;
|
||||
struct weapon *missile; /* missile weapon */
|
||||
struct weapon *melee; /* melee weapon */
|
||||
} *person;
|
||||
|
|
|
@ -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
|
||||
|
@ -35,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"
|
||||
|
@ -265,21 +254,37 @@ static int tolua_faction_setkey(lua_State * L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_messages(lua_State * L)
|
||||
static int tolua_faction_debug_messages(lua_State * L)
|
||||
{
|
||||
faction *f = (faction *)tolua_tousertype(L, 1, NULL);
|
||||
int i = 1;
|
||||
mlist *ml;
|
||||
if (!f->msgs) {
|
||||
return 0;
|
||||
if (f->msgs) {
|
||||
mlist *ml;
|
||||
for (ml = f->msgs->begin; ml; ml = ml->next, ++i) {
|
||||
char buf[120];
|
||||
nr_render(ml->msg, default_locale, buf, sizeof(buf), NULL);
|
||||
puts(buf);
|
||||
}
|
||||
}
|
||||
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 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_get_messages(lua_State * L)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_faction_count_msg_type(lua_State *L) {
|
||||
|
@ -665,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,20 +1,11 @@
|
|||
/*
|
||||
+-------------------+
|
||||
| | 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>
|
||||
+-------------------+
|
||||
#pragma once
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
struct lua_State;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct lua_State;
|
||||
int tolua_factionlist_next(struct lua_State *L);
|
||||
void tolua_faction_open(struct lua_State *L);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -114,6 +114,14 @@ static int tolua_region_get_plane(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_region_set_plane(lua_State * L)
|
||||
{
|
||||
region *r = (region *)tolua_tousertype(L, 1, NULL);
|
||||
plane *pl = (plane *)tolua_tousertype(L, 2, NULL);
|
||||
r->_plane = pl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_region_get_terrain(lua_State * L)
|
||||
{
|
||||
region *self = (region *)tolua_tousertype(L, 1, NULL);
|
||||
|
@ -579,10 +587,10 @@ static int tolua_region_getastral(lua_State * L)
|
|||
|
||||
if (!rt) {
|
||||
const char *tname = tolua_tostring(L, 2, NULL);
|
||||
const terrain_type *terrain = get_terrain(tname ? tname : "fog");
|
||||
plane *pl = get_astralplane();
|
||||
rt = new_region(real2tp(r->x), real2tp(r->y), pl, 0);
|
||||
if (tname) {
|
||||
const terrain_type *terrain = get_terrain(tname);
|
||||
if (terrain) {
|
||||
terraform_region(rt, terrain);
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +776,8 @@ void tolua_region_open(lua_State * L)
|
|||
tolua_variable(L, TOLUA_CAST "id", tolua_region_get_id, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "x", tolua_region_get_x, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "y", tolua_region_get_y, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "plane", tolua_region_get_plane, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "plane", tolua_region_get_plane,
|
||||
tolua_region_set_plane);
|
||||
tolua_variable(L, TOLUA_CAST "name", tolua_region_get_name,
|
||||
tolua_region_set_name);
|
||||
tolua_variable(L, TOLUA_CAST "morale", tolua_region_get_morale,
|
||||
|
|
|
@ -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
|
||||
|
|
110
src/bind_ship.c
110
src/bind_ship.c
|
@ -38,39 +38,54 @@ int tolua_shiplist_next(lua_State * L)
|
|||
return 0; /* no more values to return */
|
||||
}
|
||||
|
||||
static int tolua_ship_get_number(lua_State * L)
|
||||
{
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, sh->number);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_number(lua_State * L)
|
||||
{
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
int n = (int)tolua_tonumber(L, 2, 0);
|
||||
scale_ship(sh, n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_id(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->no);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, sh->no);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_name(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, ship_getname(self));
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, ship_getname(sh));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_size(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->size);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, sh->size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_display(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, self->display);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, sh->display);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_region(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
if (self) {
|
||||
tolua_pushusertype(L, self->region, TOLUA_CAST "region");
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
if (sh) {
|
||||
tolua_pushusertype(L, sh->region, TOLUA_CAST "region");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -78,43 +93,43 @@ static int tolua_ship_get_region(lua_State * L)
|
|||
|
||||
static int tolua_ship_set_region(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
region *r = (region *)tolua_tousertype(L, 2, NULL);
|
||||
if (self) {
|
||||
move_ship(self, self->region, r, NULL);
|
||||
if (sh) {
|
||||
move_ship(sh, sh->region, r, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_name(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship_setname(self, tolua_tostring(L, 2, NULL));
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship_setname(sh, tolua_tostring(L, 2, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_size(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
self->size = lua_tointeger(L, 2);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
sh->size = lua_tointeger(L, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_display(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
free(self->display);
|
||||
self->display = str_strdup(tolua_tostring(L, 2, NULL));
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
free(sh->display);
|
||||
sh->display = str_strdup(tolua_tostring(L, 2, NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_units(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
unit **unit_ptr = (unit **)lua_newuserdata(L, sizeof(unit *));
|
||||
unit *u = self->region->units;
|
||||
unit *u = sh->region->units;
|
||||
|
||||
while (u && u->ship != self)
|
||||
while (u && u->ship != sh)
|
||||
u = u->next;
|
||||
luaL_getmetatable(L, TOLUA_CAST "unit");
|
||||
lua_setmetatable(L, -2);
|
||||
|
@ -147,42 +162,42 @@ static int tolua_ship_create(lua_State * L)
|
|||
static int
|
||||
tolua_ship_tostring(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, shipname(self));
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushstring(L, shipname(sh));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_flags(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->flags);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, sh->flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_flags(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
self->flags = (int)lua_tointeger(L, 2);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
sh->flags = (int)lua_tointeger(L, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_coast(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
if (lua_isnil(L, 2)) {
|
||||
self->coast = NODIRECTION;
|
||||
sh->coast = NODIRECTION;
|
||||
}
|
||||
else if (lua_isnumber(L, 2)) {
|
||||
self->coast = (direction_t)lua_tointeger(L, 2);
|
||||
sh->coast = (direction_t)lua_tointeger(L, 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_coast(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
if (self->coast) {
|
||||
lua_pushinteger(L, self->coast);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
if (sh->coast) {
|
||||
lua_pushinteger(L, sh->coast);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -190,30 +205,30 @@ static int tolua_ship_get_coast(lua_State * L)
|
|||
|
||||
static int tolua_ship_get_type(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, self->type->_name);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
tolua_pushstring(L, sh->type->_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_damage(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, self->damage);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
lua_pushinteger(L, sh->damage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_ship_set_damage(lua_State * L)
|
||||
{
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
self->damage = (int)lua_tointeger(L, 2);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
sh->damage = (int)lua_tointeger(L, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_ship_get_curse(lua_State *L) {
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
if (self->attribs) {
|
||||
curse * c = get_curse(self->attribs, ct_find(name));
|
||||
if (sh->attribs) {
|
||||
curse * c = get_curse(sh->attribs, ct_find(name));
|
||||
if (c) {
|
||||
lua_pushnumber(L, curse_geteffect(c));
|
||||
return 1;
|
||||
|
@ -223,9 +238,9 @@ static int tolua_ship_get_curse(lua_State *L) {
|
|||
}
|
||||
|
||||
static int tolua_ship_has_attrib(lua_State *L) {
|
||||
ship *self = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
ship *sh = (ship *)tolua_tousertype(L, 1, NULL);
|
||||
const char *name = tolua_tostring(L, 2, NULL);
|
||||
attrib * a = a_find(self->attribs, at_find(name));
|
||||
attrib * a = a_find(sh->attribs, at_find(name));
|
||||
lua_pushboolean(L, a != NULL);
|
||||
return 1;
|
||||
}
|
||||
|
@ -243,6 +258,7 @@ void tolua_ship_open(lua_State * L)
|
|||
{
|
||||
tolua_function(L, TOLUA_CAST "__tostring", tolua_ship_tostring);
|
||||
tolua_variable(L, TOLUA_CAST "id", tolua_ship_get_id, NULL);
|
||||
tolua_variable(L, TOLUA_CAST "number", tolua_ship_get_number, tolua_ship_set_number);
|
||||
tolua_variable(L, TOLUA_CAST "name", tolua_ship_get_name,
|
||||
tolua_ship_set_name);
|
||||
tolua_variable(L, TOLUA_CAST "size", tolua_ship_get_size,
|
||||
|
|
|
@ -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
|
||||
|
|
317
src/bind_unit.c
317
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;
|
||||
}
|
||||
|
@ -874,9 +884,19 @@ static int tolua_unit_create(lua_State * L)
|
|||
const char *rcname = tolua_tostring(L, 4, NULL);
|
||||
const race *rc;
|
||||
|
||||
assert(f && r);
|
||||
if (!r) {
|
||||
log_warning("unit.create: arg(2) is not a region");
|
||||
return 0;
|
||||
}
|
||||
if (!f) {
|
||||
log_warning("unit.create: arg(1) is not a faction");
|
||||
return 0;
|
||||
}
|
||||
rc = rcname ? rc_find(rcname) : f->race;
|
||||
assert(rc);
|
||||
if (!rc) {
|
||||
log_warning("unit.create: unknown race %s", rcname);
|
||||
return 0;
|
||||
}
|
||||
u = create_unit(r, f, num, rc, 0, NULL, NULL);
|
||||
tolua_pushusertype(L, u, TOLUA_CAST "unit");
|
||||
return 1;
|
||||
|
@ -884,25 +904,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 +998,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
|
||||
|
|
|
@ -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
|
||||
|
|
19
src/chaos.c
19
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"
|
||||
|
@ -104,6 +86,7 @@ static void chaos(region * r)
|
|||
if (u && playerrace(u_race(u))) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
||||
u_setfaction(u, get_monsters());
|
||||
u_freeorders(u);
|
||||
u_setrace(u, get_race(RC_GHOUL));
|
||||
}
|
||||
}
|
||||
|
|
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>
|
||||
|
@ -93,7 +84,7 @@ static char g_bigbuf[BUFFERSIZE];
|
|||
bool opt_cr_absolute_coords = false;
|
||||
|
||||
/* globals */
|
||||
#define C_REPORT_VERSION 66
|
||||
#define C_REPORT_VERSION 67
|
||||
|
||||
struct locale *crtag_locale(void) {
|
||||
static struct locale * lang;
|
||||
|
@ -524,7 +515,9 @@ static void report_crtypes(FILE * F, const struct locale *lang)
|
|||
fputc('\"', F);
|
||||
fputs(crescape(nrt_string(kmt->mtype, lang), buffer, sizeof(buffer)), F);
|
||||
fputs("\";text\n", F);
|
||||
fprintf(F, "\"%s\";section\n", kmt->mtype->section);
|
||||
if (kmt->mtype->section) {
|
||||
fprintf(F, "\"%s\";section\n", kmt->mtype->section);
|
||||
}
|
||||
}
|
||||
while (mtypehash[i]) {
|
||||
kmt = mtypehash[i];
|
||||
|
@ -704,10 +697,10 @@ static void cr_output_ship(struct stream *out, const ship *sh, const unit *u,
|
|||
stream_printf(out, "\"%s\";Beschr\n", sh->display);
|
||||
stream_printf(out, "\"%s\";Typ\n", translate(sh->type->_name,
|
||||
LOC(f->locale, sh->type->_name)));
|
||||
stream_printf(out, "%d;Anzahl\n", sh->number);
|
||||
stream_printf(out, "%d;Groesse\n", sh->size);
|
||||
if (sh->damage) {
|
||||
int percent =
|
||||
(sh->damage * 100 + DAMAGE_SCALE - 1) / (sh->size * DAMAGE_SCALE);
|
||||
int percent = ship_damage_percent(sh);
|
||||
stream_printf(out, "%d;Schaden\n", percent);
|
||||
}
|
||||
if (u) {
|
||||
|
@ -719,7 +712,7 @@ static void cr_output_ship(struct stream *out, const ship *sh, const unit *u,
|
|||
/* calculate cargo */
|
||||
if (u && (u->faction == f || omniscient(f))) {
|
||||
int n = 0, p = 0;
|
||||
int mweight = shipcapacity(sh);
|
||||
int mweight = ship_capacity(sh);
|
||||
getshipweight(sh, &n, &p);
|
||||
|
||||
stream_printf(out, "%d;capacity\n", mweight);
|
||||
|
@ -1473,14 +1466,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 +1484,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
106
src/economy.c
106
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,22 @@ 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());
|
||||
u_freeorders(ufam);
|
||||
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);
|
||||
|
@ -516,7 +510,7 @@ static void manufacture(unit * u, const item_type * itype, int want)
|
|||
if (want == 0) {
|
||||
want = maxbuild(u, itype->construction);
|
||||
}
|
||||
n = build(u, itype->construction, 0, want, skill_mod);
|
||||
n = build(u, 1, itype->construction, 0, want, skill_mod);
|
||||
switch (n) {
|
||||
case ENEEDSKILL:
|
||||
ADDMSG(&u->faction->msgs,
|
||||
|
@ -614,9 +608,8 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
|
|||
if (itype->rtype && (itype->rtype == get_resourcetype(R_IRON) || itype->rtype == rt_find("laen"))) {
|
||||
unit *u2;
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (is_guard(u)
|
||||
&& !fval(u2, UFL_ISNEW)
|
||||
&& u2->number && !alliedunit(u2, u->faction, HELP_GUARD)) {
|
||||
if (!fval(u2, UFL_ISNEW) && u2->number
|
||||
&& is_guard(u2) && !alliedunit(u2, u->faction, HELP_GUARD)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));
|
||||
return;
|
||||
|
@ -858,7 +851,7 @@ static void create_potion(unit * u, const item_type * itype, int want)
|
|||
if (want == 0) {
|
||||
want = maxbuild(u, itype->construction);
|
||||
}
|
||||
built = build(u, itype->construction, 0, want, 0);
|
||||
built = build(u, 1, itype->construction, 0, want, 0);
|
||||
switch (built) {
|
||||
case ELOWSKILL:
|
||||
case ENEEDSKILL:
|
||||
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -233,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();
|
||||
}
|
||||
|
||||
|
@ -796,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);
|
||||
|
|
|
@ -280,7 +280,7 @@ static void handle_weapon(parseinfo *pi, const XML_Char *el, const XML_Char **at
|
|||
wtype->defmod = xml_int(attr[i + 1]);
|
||||
}
|
||||
else if (xml_strequal(attr[i], "reload")) {
|
||||
wtype->reload = xml_int(attr[i + 1]);
|
||||
wtype->reload = (unsigned char) xml_int(attr[i + 1]);
|
||||
}
|
||||
else if (xml_strequal(attr[i], "skill")) {
|
||||
wtype->skill = findskill(attr[i + 1]);
|
||||
|
|
146
src/give.c
146
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
|
||||
|
@ -305,6 +293,117 @@ bool rule_transfermen(void)
|
|||
return rule != 0;
|
||||
}
|
||||
|
||||
static void transfer_ships(ship *s1, ship *s2, int n)
|
||||
{
|
||||
assert(n <= s1->number);
|
||||
s2->damage += s1->damage * n / s1->number;
|
||||
s2->size += s1->size * n / s1->number;
|
||||
s2->number += n;
|
||||
if (s1->coast != NODIRECTION) {
|
||||
s2->coast = s1->coast;
|
||||
}
|
||||
scale_ship(s1, s1->number - n);
|
||||
}
|
||||
|
||||
static void transfer_units(ship *s1, ship *s2)
|
||||
{
|
||||
region * r = s1->region;
|
||||
unit *u;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->ship == s1) {
|
||||
leave_ship(u);
|
||||
u_set_ship(u, s2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool ship_cursed(const ship *sh) {
|
||||
return a_find(sh->attribs, &at_curse) != NULL;
|
||||
}
|
||||
|
||||
message * give_ship(unit *u1, unit *u2, int n, order *ord)
|
||||
{
|
||||
assert(u1->ship);
|
||||
assert(n > 0 && n <= u1->ship->number);
|
||||
if (u1->ship->type->range < 3) {
|
||||
/* Keine Boote und anderes Kleinzeug erlaubt */
|
||||
return msg_error(u1, ord, 326);
|
||||
}
|
||||
if (ship_cursed(u1->ship)) {
|
||||
return msg_error(u1, ord, 323);
|
||||
}
|
||||
if (u1 != ship_owner(u1->ship)) {
|
||||
return msg_error(u1, ord, 146);
|
||||
}
|
||||
if (u2 == NULL) {
|
||||
if (fval(u1->region->terrain, LAND_REGION) || n < u1->ship->number) {
|
||||
ship * sh = new_ship(u1->ship->type, u1->region, u1->faction->locale);
|
||||
scale_ship(sh, 0);
|
||||
transfer_ships(u1->ship, sh, n);
|
||||
}
|
||||
else {
|
||||
return msg_error(u1, ord, 327);
|
||||
}
|
||||
} else {
|
||||
if (u1->faction != u2->faction) {
|
||||
return msg_error(u1, ord, 324);
|
||||
}
|
||||
if (fval(u_race(u2), RCF_CANSAIL)) {
|
||||
if (u2->ship) {
|
||||
if (u2->ship == u1->ship) {
|
||||
ship * sh = new_ship(u1->ship->type, u1->region, u1->faction->locale);
|
||||
scale_ship(sh, 0);
|
||||
leave_ship(u2);
|
||||
u_set_ship(u2, sh);
|
||||
} else {
|
||||
if (u2 != ship_owner(u2->ship)) {
|
||||
return msg_error(u1, ord, 146);
|
||||
}
|
||||
if (u2->ship->type != u1->ship->type) {
|
||||
return msg_error(u1, ord, 322);
|
||||
}
|
||||
if (ship_cursed(u2->ship)) {
|
||||
return msg_error(u1, ord, 323);
|
||||
}
|
||||
if (u1->ship->coast != u2->ship->coast) {
|
||||
if (u1->ship->coast != NODIRECTION) {
|
||||
if (u2->ship->coast == NODIRECTION) {
|
||||
u2->ship->coast = u1->ship->coast;
|
||||
}
|
||||
else {
|
||||
return msg_error(u1, ord, 182);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (n < u1->ship->number) {
|
||||
transfer_ships(u1->ship, u2->ship, n);
|
||||
}
|
||||
else {
|
||||
transfer_ships(u1->ship, u2->ship, n);
|
||||
transfer_units(u1->ship, u2->ship);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (n < u1->ship->number) {
|
||||
ship * sh = new_ship(u1->ship->type, u1->region, u1->faction->locale);
|
||||
scale_ship(sh, 0);
|
||||
u_set_ship(u2, sh);
|
||||
transfer_ships(u1->ship, sh, n);
|
||||
}
|
||||
else {
|
||||
u_set_ship(u2, u1->ship);
|
||||
ship_set_owner(u2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return msg_error(u1, ord, 233);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
message * give_men(int n, unit * u, unit * u2, struct order *ord)
|
||||
{
|
||||
int error = 0;
|
||||
|
@ -610,6 +709,7 @@ void give_unit(unit * u, unit * u2, order * ord)
|
|||
}
|
||||
add_give_person(u, u2, u->number, ord, 0);
|
||||
u_setfaction(u, u2->faction);
|
||||
u_freeorders(u);
|
||||
u2->faction->newbies += u->number;
|
||||
}
|
||||
|
||||
|
@ -664,7 +764,8 @@ static void give_all_items(unit *u, unit *u2, order *ord) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (isparam(s, u->faction->locale, P_PERSON)) {
|
||||
param_t p = findparam(s, u->faction->locale);
|
||||
if (p == P_PERSON) {
|
||||
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
||||
|
@ -827,7 +928,24 @@ void give_cmd(unit * u, order * ord)
|
|||
return;
|
||||
}
|
||||
|
||||
if (isparam(s, u->faction->locale, P_PERSON)) {
|
||||
p = findparam(s, u->faction->locale);
|
||||
if (p == P_SHIP) {
|
||||
if (u->ship) {
|
||||
message * msg;
|
||||
if (n > u->ship->number) {
|
||||
n = u->ship->number;
|
||||
}
|
||||
msg = give_ship(u, u2, n, ord);
|
||||
if (msg) {
|
||||
ADDMSG(&u->faction->msgs, msg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cmistake(u, ord, 144, MSG_COMMERCE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (p == P_PERSON) {
|
||||
if (!(u_race(u)->ec_flags & ECF_GIVEPERSON)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, ord, "race_noregroup", "race", u_race(u)));
|
||||
|
|
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
|
||||
|
||||
|
|
30
src/gmtool.c
30
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
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
|
||||
|
|
|
@ -101,6 +101,10 @@ struct order *ord)
|
|||
cmistake(u, ord, 20, MSG_MOVE);
|
||||
return -1;
|
||||
}
|
||||
if (sh->number > 1) {
|
||||
cmistake(u, ord, 325, MSG_MAGIC);
|
||||
return -1;
|
||||
}
|
||||
|
||||
effect = SPEEDSAIL_EFFECT;
|
||||
create_curse(u, &sh->attribs, &ct_shipspeedup, 20, INT_MAX, effect, 0);
|
||||
|
|
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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -242,7 +224,7 @@ int destroy_cmd(unit * u, struct order *ord)
|
|||
return 14;
|
||||
}
|
||||
|
||||
if (n >= (sh->size * 100) / sh->type->construction->maxsize) {
|
||||
if (n >= (sh->size * 100) / ship_maxsize(sh)) {
|
||||
/* destroy completly */
|
||||
/* all units leave the ship */
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
|
@ -257,7 +239,7 @@ int destroy_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
else {
|
||||
/* partial destroy */
|
||||
sh->size -= (sh->type->construction->maxsize * n) / 100;
|
||||
sh->size -= (ship_maxsize(sh) * n) / 100;
|
||||
ADDMSG(&u->faction->msgs, msg_message("shipdestroy_partial",
|
||||
"unit region ship", u, r, sh));
|
||||
}
|
||||
|
@ -527,17 +509,16 @@ int build_skill(unit *u, int basesk, int skill_mod) {
|
|||
* of the first object have already been finished. return the
|
||||
* actual size that could be built.
|
||||
*/
|
||||
static int build_limited(unit * u, const construction * con, int completed, int want, int basesk, int *skill_total) {
|
||||
static int build_limited(unit * u, const construction * con, int completed, int number, int want, int basesk, int *skill_total) {
|
||||
int skills = *skill_total;
|
||||
int made = 0;
|
||||
int made = 0, maxsize;
|
||||
|
||||
assert(con);
|
||||
if (want <= 0) {
|
||||
return 0;
|
||||
}
|
||||
if (con == NULL) {
|
||||
return ENOMATERIALS;
|
||||
}
|
||||
if (completed == con->maxsize) {
|
||||
maxsize = con->maxsize * number;
|
||||
if (completed == maxsize) {
|
||||
return ECOMPLETE;
|
||||
}
|
||||
for (; want > 0 && skills > 0;) {
|
||||
|
@ -548,8 +529,8 @@ static int build_limited(unit * u, const construction * con, int completed, int
|
|||
* (enno): Nein, das ist fuer Dinge, bei denen die naechste Ausbaustufe
|
||||
* die gleiche wie die vorherige ist. z.b. Gegenstaende.
|
||||
*/
|
||||
if (con->maxsize > 0) {
|
||||
completed = completed % con->maxsize;
|
||||
if (maxsize > 0) {
|
||||
completed = completed % (maxsize);
|
||||
}
|
||||
else {
|
||||
completed = 0;
|
||||
|
@ -584,8 +565,8 @@ static int build_limited(unit * u, const construction * con, int completed, int
|
|||
|
||||
if (want < n) n = want;
|
||||
|
||||
if (con->maxsize > 0) {
|
||||
int req = con->maxsize - completed;
|
||||
if (maxsize > 0) {
|
||||
int req = maxsize - completed;
|
||||
if (req < n) n = req;
|
||||
want = n;
|
||||
}
|
||||
|
@ -610,11 +591,12 @@ static int build_limited(unit * u, const construction * con, int completed, int
|
|||
return made;
|
||||
}
|
||||
|
||||
int build(unit * u, const construction * con, int completed, int want, int skill_mod)
|
||||
int build(unit * u, int number, const construction * con, int completed, int want, int skill_mod)
|
||||
{
|
||||
int skills = INT_MAX; /* number of skill points remainig */
|
||||
int made, basesk = 0;
|
||||
|
||||
assert(number >= 1);
|
||||
assert(con->skill != NOSKILL);
|
||||
basesk = effskill(u, con->skill, NULL);
|
||||
if (basesk == 0) {
|
||||
|
@ -622,7 +604,7 @@ int build(unit * u, const construction * con, int completed, int want, int skill
|
|||
}
|
||||
|
||||
skills = build_skill(u, basesk, skill_mod);
|
||||
made = build_limited(u, con, completed, want, basesk, &skills);
|
||||
made = build_limited(u, con, completed, number, want, basesk, &skills);
|
||||
/* Nur soviel PRODUCEEXP wie auch tatsaechlich gemacht wurde */
|
||||
if (made > 0) {
|
||||
produceexp(u, con->skill, (made < u->number) ? made : u->number);
|
||||
|
@ -716,7 +698,7 @@ static int build_stages(unit *u, const building_type *btype, int built, int n, i
|
|||
want = todo;
|
||||
}
|
||||
}
|
||||
err = build_limited(u, con, built, want, basesk, skill_total);
|
||||
err = build_limited(u, con, 1, built, want, basesk, skill_total);
|
||||
if (err < 0) {
|
||||
if (made == 0) {
|
||||
/* could not make any part at all */
|
||||
|
@ -922,9 +904,9 @@ static void build_ship(unit * u, ship * sh, int want)
|
|||
const construction *construction = sh->type->construction;
|
||||
int size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE;
|
||||
int n;
|
||||
int can = build(u, construction, size, want, 0);
|
||||
int can = build(u, sh->number, construction, size, want, 0);
|
||||
|
||||
if ((n = construction->maxsize - sh->size) > 0 && can > 0) {
|
||||
if ((n = ship_maxsize(sh) - sh->size) > 0 && can > 0) {
|
||||
if (can >= n) {
|
||||
sh->size += n;
|
||||
can -= n;
|
||||
|
@ -950,8 +932,7 @@ static void build_ship(unit * u, ship * sh, int want)
|
|||
msg_message("buildship", "ship unit size", sh, u, n));
|
||||
}
|
||||
|
||||
void
|
||||
create_ship(unit * u, const struct ship_type *newtype, int want,
|
||||
void create_ship(unit * u, const struct ship_type *newtype, int want,
|
||||
order * ord)
|
||||
{
|
||||
ship *sh;
|
||||
|
@ -1019,11 +1000,12 @@ void continue_ship(unit * u, int want)
|
|||
cmistake(u, u->thisorder, 20, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
cons = sh->type->construction;
|
||||
if (sh->size == cons->maxsize && !sh->damage) {
|
||||
msize = ship_maxsize(sh);
|
||||
if (sh->size >= msize && !sh->damage) {
|
||||
cmistake(u, u->thisorder, 16, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
cons = sh->type->construction;
|
||||
if (effskill(u, cons->skill, NULL) < cons->minskill) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder,
|
||||
"error_build_skill_low", "value", cons->minskill));
|
||||
|
|
|
@ -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_BUILD
|
||||
#define H_KRNL_BUILD
|
||||
|
||||
|
@ -62,7 +44,7 @@ extern "C" {
|
|||
void sunhash(struct ship *sh);
|
||||
int roqf_factor(void);
|
||||
|
||||
int build(struct unit *u, const construction * ctype, int completed, int want, int skill_mod);
|
||||
int build(struct unit *u, int number, const construction * ctype, int completed, int want, int skill_mod);
|
||||
int maxbuild(const struct unit *u, const construction * cons);
|
||||
struct message *msg_materials_required(struct unit *u, struct order *ord,
|
||||
const struct construction *ctype, int multi);
|
||||
|
|
|
@ -145,10 +145,10 @@ static void test_build_requires_materials(CuTest *tc) {
|
|||
|
||||
u = setup_build(&bf);
|
||||
set_level(u, SK_ARMORER, 2);
|
||||
CuAssertIntEquals(tc, ENOMATERIALS, build(u, &bf.cons, 0, 1, 0));
|
||||
CuAssertIntEquals(tc, ENOMATERIALS, build(u, 1, &bf.cons, 0, 1, 0));
|
||||
itype = bf.cons.materials[0].rtype->itype;
|
||||
i_change(&u->items, itype, 2);
|
||||
CuAssertIntEquals(tc, 1, build(u, &bf.cons, 0, 1, 0));
|
||||
CuAssertIntEquals(tc, 1, build(u, 1, &bf.cons, 0, 1, 0));
|
||||
CuAssertIntEquals(tc, 1, i_get(u->items, itype));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static void test_build_failure_missing_skill(CuTest *tc) {
|
|||
u = setup_build(&bf);
|
||||
rtype = bf.cons.materials[0].rtype;
|
||||
i_change(&u->items, rtype->itype, 1);
|
||||
CuAssertIntEquals(tc, ENEEDSKILL, build(u, &bf.cons, 1, 1, 0));
|
||||
CuAssertIntEquals(tc, ENEEDSKILL, build(u, 1, &bf.cons, 1, 1, 0));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ static void test_build_failure_low_skill(CuTest *tc) {
|
|||
rtype = bf.cons.materials[0].rtype;
|
||||
i_change(&u->items, rtype->itype, 1);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill - 1);
|
||||
CuAssertIntEquals(tc, ELOWSKILL, build(u, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, ELOWSKILL, build(u, 1, &bf.cons, 0, 10, 0));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ static void test_build_failure_completed(CuTest *tc) {
|
|||
i_change(&u->items, rtype->itype, 1);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
bf.cons.maxsize = 1;
|
||||
CuAssertIntEquals(tc, ECOMPLETE, build(u, &bf.cons, bf.cons.maxsize, 10, 0));
|
||||
CuAssertIntEquals(tc, ECOMPLETE, build(u, 1, &bf.cons, bf.cons.maxsize, 10, 0));
|
||||
CuAssertIntEquals(tc, 1, i_get(u->items, rtype->itype));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
@ -203,19 +203,19 @@ static void test_build_limits(CuTest *tc) {
|
|||
assert(rtype);
|
||||
i_change(&u->items, rtype->itype, 1);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
CuAssertIntEquals(tc, 1, build(u, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 1, build(u, 1, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 0, i_get(u->items, rtype->itype));
|
||||
|
||||
scale_number(u, 2);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
i_change(&u->items, rtype->itype, 2);
|
||||
CuAssertIntEquals(tc, 2, build(u, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 2, build(u, 1, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 0, i_get(u->items, rtype->itype));
|
||||
|
||||
scale_number(u, 2);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill * 2);
|
||||
i_change(&u->items, rtype->itype, 4);
|
||||
CuAssertIntEquals(tc, 4, build(u, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 4, build(u, 1, &bf.cons, 0, 10, 0));
|
||||
CuAssertIntEquals(tc, 0, i_get(u->items, rtype->itype));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static void test_build_with_ring(CuTest *tc) {
|
|||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
i_change(&u->items, rtype->itype, 20);
|
||||
i_change(&u->items, ring, 1);
|
||||
CuAssertIntEquals(tc, 10, build(u, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 10, build(u, 1, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 10, i_get(u->items, rtype->itype));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
@ -253,16 +253,16 @@ static void test_build_with_potion(CuTest *tc) {
|
|||
i_change(&u->items, rtype->itype, 20);
|
||||
change_effect(u, ptype, 4);
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
CuAssertIntEquals(tc, 2, build(u, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 2, build(u, 1, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 18, i_get(u->items, rtype->itype));
|
||||
CuAssertIntEquals(tc, 3, get_effect(u, ptype));
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill * 2);
|
||||
CuAssertIntEquals(tc, 4, build(u, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 4, build(u, 1, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 2, get_effect(u, ptype));
|
||||
set_level(u, SK_ARMORER, bf.cons.minskill);
|
||||
scale_number(u, 2); /* OBS: this scales the effects, too: */
|
||||
CuAssertIntEquals(tc, 4, get_effect(u, ptype));
|
||||
CuAssertIntEquals(tc, 4, build(u, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 4, build(u, 1, &bf.cons, 0, 20, 0));
|
||||
CuAssertIntEquals(tc, 2, get_effect(u, ptype));
|
||||
teardown_build(&bf);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue