forked from github/server
Merge pull request #807 from ennorehling/develop
running updates for development branch
This commit is contained in:
commit
d777afd794
57 changed files with 178 additions and 694 deletions
|
@ -28,7 +28,6 @@
|
|||
"stealth",
|
||||
"taxation",
|
||||
"trade",
|
||||
"besiege",
|
||||
"steal",
|
||||
"buy",
|
||||
"teach",
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
"work": [ "ARBEITE", "ARBEITEN" ],
|
||||
"attack": ["ATTACKIERE", "ATTACKIEREN"],
|
||||
"steal": [ "BEKLAUE", "BEKLAUEN" ],
|
||||
"besiege": ["BELAGERE", "BELAGERN" ],
|
||||
"name": [ "BENENNE", "BENENNEN" ],
|
||||
"use": [ "BENUTZE", "BENUTZEN" ],
|
||||
"describe": [ "BESCHREIBE", "BESCHREIBEN" ],
|
||||
|
|
|
@ -710,12 +710,6 @@
|
|||
<arg name="dir" type="direction"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="nr_building_besieged" section="nr">
|
||||
<type>
|
||||
<arg name="soldiers" type="int"/>
|
||||
<arg name="diff" type="int"/>
|
||||
</type>
|
||||
</message>
|
||||
|
||||
<message name="newbie_password" section="events">
|
||||
<type>
|
||||
|
@ -2684,19 +2678,6 @@
|
|||
<arg name="want" type="int"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="siege_catapults" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="building" type="building"/>
|
||||
<arg name="destruction" type="int"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="siege" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="building" type="building"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="drown_on_ship" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -3351,14 +3332,6 @@
|
|||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="entrance_besieged" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
<arg name="building" type="building"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="entrance_denied" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -3890,13 +3863,6 @@
|
|||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error166" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error165" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -4002,13 +3968,6 @@
|
|||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error60" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error151" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -4993,20 +4952,6 @@
|
|||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error24" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error23" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
</message>
|
||||
<message name="error22" section="errors">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
|
|
@ -257,9 +257,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Hier kann man k
|
|||
msgid "error165"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Trank bekommt der Einheit nicht.\""
|
||||
|
||||
msgid "siege_catapults"
|
||||
msgstr "\"$unit($unit) belagert $building($building). Dabei richten die Katapulte Zerstörungen von $int($destruction) Größenpunkten an.\""
|
||||
|
||||
msgid "curseinfo::magicstreet"
|
||||
msgstr "\"Die Straßen sind erstaunlich trocken und gut begehbar. ($int36($id))\""
|
||||
|
||||
|
@ -638,9 +635,6 @@ msgstr "\"$unit($unit) erscheint plötzlich.\""
|
|||
msgid "magicresistance_effect"
|
||||
msgstr "\"$unit($unit) wird kurz von einem magischen Licht umhüllt.\""
|
||||
|
||||
msgid "siege"
|
||||
msgstr "\"$unit($unit) belagert $building($building).\""
|
||||
|
||||
msgid "missing_force"
|
||||
msgstr "\"$unit($unit) schafft es nicht, genug Kraft aufzubringen, um $spell($spell) auf Stufe $int($level) zu zaubern.\""
|
||||
|
||||
|
@ -977,9 +971,6 @@ msgstr "\"$unit($mage) kümmert sich um die Verletzten und benutzt ein $resource
|
|||
msgid "error276"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Hier kann man keine Schiffe bauen.\""
|
||||
|
||||
msgid "error166"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Diese Rasse kann eine Burg nicht belagern.\""
|
||||
|
||||
msgid "chaosgate_effect_2"
|
||||
msgstr "\"Ein Wirbel aus blendendem Licht erscheint.\""
|
||||
|
||||
|
@ -998,9 +989,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit ist
|
|||
msgid "error82"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Es gibt keine Abstimmung mit dieser Nummer.\""
|
||||
|
||||
msgid "error60"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Die Einheit wird belagert.\""
|
||||
|
||||
msgid "error162"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Heiltrank wird automatisch bei Bedarf benutzt.\""
|
||||
|
||||
|
@ -1457,9 +1445,6 @@ msgstr "\"$unit($unit) öffnet eines der Schlösser in $region($region) mit $if(
|
|||
msgid "error255"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - So etwas kann man nicht opfern.\""
|
||||
|
||||
msgid "entrance_besieged"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - $building($building) wird belagert.\""
|
||||
|
||||
msgid "error260"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Besitzer eines Schiffes oder Gebäudes kann nicht neu sortiert werden.\""
|
||||
|
||||
|
@ -1550,9 +1535,6 @@ msgstr "\"In $region($region) findet ein Kampf statt.\""
|
|||
msgid "wormhole_dissolve"
|
||||
msgstr "\"Das Wurmloch in $region($region) schließt sich.\""
|
||||
|
||||
msgid "error23"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht die Kontaktaufnahme unmöglich.\""
|
||||
|
||||
msgid "error12"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Das Schiff gehört uns nicht.\""
|
||||
|
||||
|
@ -2135,9 +2117,6 @@ msgstr "\"Seit $int($age) Wochen Mitglied der Allianz '$name ($int36($id))', ang
|
|||
msgid "deathcloud_effect"
|
||||
msgstr "\"$unit($mage) beschwört einen Giftelementar in $region($region).\""
|
||||
|
||||
msgid "nr_building_besieged"
|
||||
msgstr "\", belagert von $int($soldiers) Personen$if($lt($diff,0),\"\",\" (abgeschnitten)\")\""
|
||||
|
||||
msgid "nr_population"
|
||||
msgstr "\"Deine Partei hat $int($population) Personen in $int($units) von maximal $int($limit) Einheiten.\""
|
||||
|
||||
|
@ -2414,9 +2393,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Das Schiff hat
|
|||
msgid "aborted_battle"
|
||||
msgstr "\"Der Kampf wurde abgebrochen, da alle Verteidiger flohen.\""
|
||||
|
||||
msgid "error24"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht Spionage unmöglich.\""
|
||||
|
||||
msgid "usecatapult"
|
||||
msgstr "\"$int($amount) Krieger von $unit($unit) feuern ihre Katapulte ab.\""
|
||||
|
||||
|
|
|
@ -257,9 +257,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Buildings canno
|
|||
msgid "error165"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The potion does not agree with the unit.\""
|
||||
|
||||
msgid "siege_catapults"
|
||||
msgstr "\"$building($building) is under siege by $unit($unit). During siege, catapults caused $int($destruction) points destruction.\""
|
||||
|
||||
msgid "curseinfo::magicstreet"
|
||||
msgstr "\"The roads are extremely dry and well-kept. ($int36($id))\""
|
||||
|
||||
|
@ -638,9 +635,6 @@ msgstr "\"$unit($unit) appears.\""
|
|||
msgid "magicresistance_effect"
|
||||
msgstr "\"$unit($unit) is briefly surrounded by a magical light.\""
|
||||
|
||||
msgid "siege"
|
||||
msgstr "\"$building($building) is under siege by $unit($unit).\""
|
||||
|
||||
msgid "missing_force"
|
||||
msgstr "\"$unit($unit) cannot muster enough energy to cast $spell($spell) on level $int($level).\""
|
||||
|
||||
|
@ -977,9 +971,6 @@ msgstr "\"$unit($mage) sees after the wounded and heals $int($amount). A $resour
|
|||
msgid "error276"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Ships cannot be built here.\""
|
||||
|
||||
msgid "error166"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - This race cannot besiege a castle.\""
|
||||
|
||||
msgid "chaosgate_effect_2"
|
||||
msgstr "\"A vortex of blinding light appears.\""
|
||||
|
||||
|
@ -998,9 +989,6 @@ msgstr "\"'$order($command)' - $unit($unit) marched into $region($region) during
|
|||
msgid "error82"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - There is no agreement with this number.\""
|
||||
|
||||
msgid "error60"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is under siege.\""
|
||||
|
||||
msgid "error162"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - This healing potion will be automatically used when needed.\""
|
||||
|
||||
|
@ -1457,9 +1445,6 @@ msgstr "\"$unit($unit) unlocks one of the locks in $region($region) with $if($eq
|
|||
msgid "error255"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - You cannot sacrifice this.\""
|
||||
|
||||
msgid "entrance_besieged"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - $building($building) is under siege.\""
|
||||
|
||||
msgid "error260"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The owner of a ship or a building cannot be sorted.\""
|
||||
|
||||
|
@ -1550,9 +1535,6 @@ msgstr "\"There is a battle in $region($region).\""
|
|||
msgid "wormhole_dissolve"
|
||||
msgstr "\"The wormhole in $region($region) disappears.\""
|
||||
|
||||
msgid "error23"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Contact was not possible due to siege.\""
|
||||
|
||||
msgid "error12"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship is not ours.\""
|
||||
|
||||
|
@ -2135,9 +2117,6 @@ msgstr "\"Member of '$name ($int36($id))' for $int($age) weeks, led by $faction(
|
|||
msgid "deathcloud_effect"
|
||||
msgstr "\"$unit($mage) summons a poison elemental in $region($region).\""
|
||||
|
||||
msgid "nr_building_besieged"
|
||||
msgstr "\", besieged by $int($soldiers) soldiers$if($lt($diff,0),\"\",\" (cut off)\")\""
|
||||
|
||||
msgid "nr_population"
|
||||
msgstr "\"Your faction has $int($population) people in $int($units) of $int($limit) possible units.\""
|
||||
|
||||
|
@ -2414,9 +2393,6 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - The ship has mo
|
|||
msgid "aborted_battle"
|
||||
msgstr "\"The battle was aborted because all enemies escaped.\""
|
||||
|
||||
msgid "error24"
|
||||
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Espionage was not possible due to siege.\""
|
||||
|
||||
msgid "usecatapult"
|
||||
msgstr "\"$int($amount) fighters of $unit($unit) launch their catapults.\""
|
||||
|
||||
|
|
|
@ -2772,10 +2772,6 @@ msgstr "Dieser wunderschoen geschmueckte Baum entfaltet in den Wintermonaten ein
|
|||
msgid "h10"
|
||||
msgstr "Kakteenschwitz"
|
||||
|
||||
msgctxt "keyword"
|
||||
msgid "besiege"
|
||||
msgstr "BELAGERE"
|
||||
|
||||
msgid "h11"
|
||||
msgstr "Sandfäule"
|
||||
|
||||
|
|
|
@ -2421,10 +2421,6 @@ msgctxt "iteminfo"
|
|||
msgid "xmastree"
|
||||
msgstr "In the winter months, this beautifully decorated tree has a magical effect on the entire forest."
|
||||
|
||||
msgctxt "keyword"
|
||||
msgid "besiege"
|
||||
msgstr "BESIEGE"
|
||||
|
||||
msgid "h10"
|
||||
msgstr "peyote"
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ function test_process()
|
|||
assert_equal("function", _G.type(eressea.process.movement))
|
||||
assert_equal("function", _G.type(eressea.process.use))
|
||||
assert_equal("function", _G.type(eressea.process.battle))
|
||||
assert_equal("function", _G.type(eressea.process.siege))
|
||||
assert_equal("function", _G.type(eressea.process.leave))
|
||||
assert_equal("function", _G.type(eressea.process.promote))
|
||||
assert_equal("function", _G.type(eressea.process.restack))
|
||||
|
|
|
@ -13,12 +13,6 @@ function setup()
|
|||
eressea.settings.set("magic.regeneration.enable", "0")
|
||||
end
|
||||
|
||||
local function dump_messages(f)
|
||||
for k, v in ipairs(f.messages) do
|
||||
print(v)
|
||||
end
|
||||
end
|
||||
|
||||
function test_fetch_astral()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
|
|
|
@ -541,16 +541,3 @@ function test_buy_sell()
|
|||
assert_equal(4, u:get_item(item))
|
||||
assert_not_equal(0, u:get_item('money'))
|
||||
end
|
||||
|
||||
function test_seaserpent_attack()
|
||||
local r = region.create(0, 0, 'ocean')
|
||||
local sh = ship.create(r, 'boat')
|
||||
local us = unit.create(get_monsters(), r, 1, 'seaserpent')
|
||||
local u = unit.create(faction.create('human', 'enno@example.com'), r, 20, 'human')
|
||||
u.ship = sh
|
||||
us:clear_orders()
|
||||
us:add_order('ATTACKIERE ' .. itoa36(u.id))
|
||||
us:set_skill('unarmed', 10)
|
||||
process_orders()
|
||||
write_reports()
|
||||
end
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
function dump_messages(f)
|
||||
for k, v in ipairs(f.messages) do
|
||||
print(v)
|
||||
end
|
||||
end
|
||||
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.astral'
|
||||
require 'tests.e2.spells'
|
||||
require 'tests.e2.e2features'
|
||||
|
@ -7,7 +14,6 @@ require 'tests.e2.production'
|
|||
require 'tests.e2.adamantium'
|
||||
require 'tests.e2.undead'
|
||||
require 'tests.e2.shiplanding'
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.destroy'
|
||||
require 'tests.e2.guard'
|
||||
require 'tests.e2.stealth'
|
||||
|
|
|
@ -9,7 +9,7 @@ function setup()
|
|||
eressea.settings.set("NewbieImmunity", "0")
|
||||
end
|
||||
|
||||
function test_piracy()
|
||||
function test_piracy()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local r3 = region.create(-1, 0, "ocean")
|
||||
|
@ -96,6 +96,7 @@ function test_follow_ship()
|
|||
local f = faction.create("human", "test@example.com", "de")
|
||||
local u1 = unit.create(f, r1, 1)
|
||||
local u2 = unit.create(f, r1, 1)
|
||||
u2.name = 'Xolgrim'
|
||||
u1:add_item("money", 100)
|
||||
u2:add_item("money", 100)
|
||||
u1.ship = ship.create(r1, "boat")
|
||||
|
|
|
@ -953,12 +953,11 @@ function test_bug2083()
|
|||
-- this is a bit weird, but the bug was caused by market code
|
||||
-- being called in two places. We want to make sure this doesn't happen
|
||||
for k, v in pairs(rules) do
|
||||
set_key("xm09", true)
|
||||
if 'table' == type(v) then
|
||||
if 'table' == type(v) then
|
||||
cb = v['update']
|
||||
if 'function' == type(cb) then
|
||||
if 'function' == type(cb) then
|
||||
cb()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ 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 "platform.h"
|
||||
#include "kernel/config.h"
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/item.h>
|
||||
|
|
|
@ -182,13 +182,13 @@ void register_attributes(void)
|
|||
at_register(&at_seenspell);
|
||||
at_register(&at_seenspells);
|
||||
|
||||
/* neue REGION-Attribute */
|
||||
/* REGION Attribute */
|
||||
at_register(&at_moveblock);
|
||||
at_register(&at_deathcount);
|
||||
at_register(&at_woodcount);
|
||||
at_register(&at_germs);
|
||||
|
||||
/* neue UNIT-Attribute */
|
||||
at_register(&at_siege);
|
||||
/* UNIT Attribute */
|
||||
at_register(&at_effect);
|
||||
at_register(&at_private);
|
||||
|
||||
|
@ -205,8 +205,7 @@ void register_attributes(void)
|
|||
register_bordertype(&bt_illusionwall);
|
||||
register_bordertype(&bt_road);
|
||||
|
||||
at_register(&at_germs);
|
||||
|
||||
at_deprecate("siege", a_readint);
|
||||
at_deprecate("maxmagicians", a_readint); /* factions with differnt magician limits, probably unused */
|
||||
at_deprecate("hurting", a_readint); /* an old arena attribute */
|
||||
at_deprecate("chaoscount", a_readint); /* used to increase the chance of monster spawns */
|
||||
|
|
|
@ -25,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/log.h>
|
||||
#include <storage.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
@ -76,25 +77,83 @@ static int keys_size(int n) {
|
|||
return 4096;
|
||||
}
|
||||
|
||||
static int read_flags(gamedata *data, int *keys, int n) {
|
||||
int i;
|
||||
for (i = 0; i != n; ++i) {
|
||||
int key;
|
||||
READ_INT(data->store, &key);
|
||||
keys[i * 2] = key;
|
||||
keys[i * 2 + 1] = 1;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
#ifdef KEYVAL_VERSION
|
||||
static int read_keyval(gamedata *data, int *keys, int n) {
|
||||
int i;
|
||||
for (i = 0; i != n; ++i) {
|
||||
int key, val;
|
||||
READ_INT(data->store, &key);
|
||||
READ_INT(data->store, &val);
|
||||
keys[i * 2] = key;
|
||||
keys[i * 2 + 1] = val;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FIXATKEYS_VERSION
|
||||
static int read_keyval_orig(gamedata *data, int *keys, int n) {
|
||||
int i, j = 0, dk = -1;
|
||||
for (i = 0; i != n; ++i) {
|
||||
int key, val;
|
||||
READ_INT(data->store, &key);
|
||||
READ_INT(data->store, &val);
|
||||
if (key > dk) {
|
||||
keys[j * 2] = key;
|
||||
keys[j * 2 + 1] = val;
|
||||
dk = key;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int a_readkeys(variant *var, void *owner, gamedata *data) {
|
||||
int i, n, *keys;
|
||||
int i, n, ksn, *keys;
|
||||
|
||||
READ_INT(data->store, &n);
|
||||
assert(n < 4096 && n >= 0);
|
||||
if (n == 0) {
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
keys = malloc(sizeof(int)*(keys_size(n) * 2 + 1));
|
||||
*keys = n;
|
||||
for (i = 0; i != n; ++i) {
|
||||
READ_INT(data->store, keys + i * 2 + 1);
|
||||
if (data->version >= KEYVAL_VERSION) {
|
||||
READ_INT(data->store, keys + i * 2 + 2);
|
||||
}
|
||||
else {
|
||||
keys[i * 2 + 2] = 1;
|
||||
ksn = keys_size(n);
|
||||
keys = malloc((ksn * 2 + 1) * sizeof(int));
|
||||
if (data->version >= FIXATKEYS_VERSION) {
|
||||
n = read_keyval(data, keys + 1, n);
|
||||
}
|
||||
else if (data->version >= KEYVAL_VERSION) {
|
||||
int m = read_keyval_orig(data, keys + 1, n);
|
||||
if (n != m) {
|
||||
int ksm = keys_size(m);
|
||||
if (ksm != ksn) {
|
||||
int *nkeys = (int *)realloc(keys, (ksm * 2 + 1) * sizeof(int));
|
||||
if (nkeys != NULL) {
|
||||
keys = nkeys;
|
||||
}
|
||||
else {
|
||||
log_error("a_readkeys allocation failed: %s", strerror(errno));
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
}
|
||||
n = m;
|
||||
}
|
||||
}
|
||||
else {
|
||||
n = read_flags(data, keys + 1, n);
|
||||
}
|
||||
keys[0] = n;
|
||||
if (data->version < SORTKEYS_VERSION) {
|
||||
int e = 1;
|
||||
for (i = 1; i != n; ++i) {
|
||||
|
|
17
src/battle.c
17
src/battle.c
|
@ -100,9 +100,7 @@ typedef enum combatmagic {
|
|||
#define MINSPELLRANGE 1
|
||||
#define MAXSPELLRANGE 7
|
||||
|
||||
#ifndef ROW_FACTOR
|
||||
# define ROW_FACTOR 10
|
||||
#endif
|
||||
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
||||
#define EFFECT_PANIC_SPELL 0.25
|
||||
#define TROLL_REGENERATION 0.10
|
||||
|
||||
|
@ -161,7 +159,7 @@ static void init_rules(void)
|
|||
skill_formula = config_get_int("rules.combat.skill_formula",
|
||||
FORMULA_ORIG);
|
||||
/* maximum number of combat turns */
|
||||
max_turns = config_get_int("rules.combat.turns", COMBAT_TURNS);
|
||||
max_turns = config_get_int("rules.combat.turns", 5);
|
||||
/* damage calculation */
|
||||
if (config_get_int("rules.combat.critical", 1)) {
|
||||
rule_damage |= DAMAGE_CRITICAL;
|
||||
|
@ -3579,17 +3577,6 @@ static void join_allies(battle * b)
|
|||
}
|
||||
if (se == s_end)
|
||||
continue;
|
||||
/* Wenn die Einheit belagert ist, mu<6D> auch einer der Alliierten belagert sein: */
|
||||
if (besieged(u)) {
|
||||
fighter *ally;
|
||||
for (ally = s->fighters; ally; ally = ally->next) {
|
||||
if (besieged(ally->unit)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ally == NULL)
|
||||
continue;
|
||||
}
|
||||
/* keine Einw<6E>nde, also soll er mitmachen: */
|
||||
if (c == NULL) {
|
||||
if (!join_battle(b, u, false, &c)) {
|
||||
|
|
|
@ -76,10 +76,6 @@ void process_battle(void) {
|
|||
do_battles();
|
||||
}
|
||||
|
||||
void process_siege(void) {
|
||||
process_cmd(K_BESIEGE, siege_cmd, PROC_LAND_REGION);
|
||||
}
|
||||
|
||||
void process_update_long_order(void) {
|
||||
region * r;
|
||||
for (r = regions; r; r = r->next) {
|
||||
|
|
|
@ -153,15 +153,6 @@ int tolua_itemlist_next(lua_State * L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_getkey(lua_State * L)
|
||||
{
|
||||
const char *name = tolua_tostring(L, 1, 0);
|
||||
int flag = atoi36(name);
|
||||
|
||||
lua_pushboolean(L, key_get(global.attribs, flag));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_translate(lua_State * L)
|
||||
{
|
||||
const char *str = tolua_tostring(L, 1, 0);
|
||||
|
@ -175,20 +166,6 @@ static int tolua_translate(lua_State * L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_setkey(lua_State * L)
|
||||
{
|
||||
const char *name = tolua_tostring(L, 1, 0);
|
||||
int value = (int)tolua_tonumber(L, 3, 0);
|
||||
int flag = atoi36(name);
|
||||
if (value) {
|
||||
key_set(&global.attribs, flag, value);
|
||||
}
|
||||
else {
|
||||
key_unset(&global.attribs, flag);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_random(lua_State * L)
|
||||
{
|
||||
lua_pushinteger(L, rng_int());
|
||||
|
@ -1003,8 +980,6 @@ int tolua_bindings_open(lua_State * L, const dictionary *inifile)
|
|||
tolua_function(L, TOLUA_CAST "update_owners", tolua_update_owners);
|
||||
tolua_function(L, TOLUA_CAST "learn_skill", tolua_learn_skill);
|
||||
tolua_function(L, TOLUA_CAST "create_curse", tolua_create_curse);
|
||||
tolua_function(L, TOLUA_CAST "get_key", tolua_getkey);
|
||||
tolua_function(L, TOLUA_CAST "set_key", tolua_setkey);
|
||||
tolua_function(L, TOLUA_CAST "translate", &tolua_translate);
|
||||
tolua_function(L, TOLUA_CAST "spells", tolua_get_spells);
|
||||
tolua_function(L, TOLUA_CAST "equip_newunits", tolua_equip_newunits);
|
||||
|
|
|
@ -673,9 +673,7 @@ static void cr_output_building(struct stream *out, building *b,
|
|||
if (fno >= 0) {
|
||||
stream_printf(out, "%d;Partei\n", fno);
|
||||
}
|
||||
if (b->besieged) {
|
||||
stream_printf(out, "%d;Belagerer\n", b->besieged);
|
||||
}
|
||||
|
||||
cr_output_curses(out, f, b, TYP_BUILDING);
|
||||
}
|
||||
|
||||
|
@ -780,7 +778,6 @@ void cr_output_unit(stream *out, const faction * f,
|
|||
const item_type *lasttype;
|
||||
int pr;
|
||||
item *itm, *show = NULL;
|
||||
building *b;
|
||||
const char *pzTmp;
|
||||
skill *sv;
|
||||
item result[MAX_INVENTORY];
|
||||
|
@ -879,9 +876,6 @@ void cr_output_unit(stream *out, const faction * f,
|
|||
if (is_guard(u)) {
|
||||
stream_printf(out, "%d;bewacht\n", 1);
|
||||
}
|
||||
if ((b = usiege(u)) != NULL) {
|
||||
stream_printf(out, "%d;belagert\n", b->no);
|
||||
}
|
||||
/* additional information for own units */
|
||||
if (u->faction == f || omniscient(f)) {
|
||||
order *ord;
|
||||
|
|
|
@ -103,6 +103,8 @@ static void recruit_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
#define ENTERTAINFRACTION 20
|
||||
|
||||
int entertainmoney(const region * r)
|
||||
{
|
||||
double n;
|
||||
|
@ -978,11 +980,6 @@ static void allocate_resource(unit * u, const resource_type * rtype, int want)
|
|||
}
|
||||
}
|
||||
|
||||
if (besieged(u)) {
|
||||
cmistake(u, u->thisorder, 60, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtype->modifiers) {
|
||||
message *msg = get_modifiers(u, sk, rtype, &save_mod, &skill_mod);
|
||||
if (msg) {
|
||||
|
@ -1604,11 +1601,6 @@ static void buy(unit * u, econ_request ** buyorders, struct order *ord)
|
|||
cmistake(u, ord, 26, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
/* Belagerte Einheiten k<>nnen nichts kaufen. */
|
||||
cmistake(u, ord, 60, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Entweder man ist Insekt in Sumpf/Wueste, oder es muss
|
||||
* einen Handelsposten in der Region geben: */
|
||||
|
@ -1928,12 +1920,6 @@ static bool sell(unit * u, econ_request ** sellorders, struct order *ord)
|
|||
return false;
|
||||
}
|
||||
}
|
||||
/* Belagerte Einheiten k<>nnen nichts verkaufen. */
|
||||
|
||||
if (besieged(u)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error60", ""));
|
||||
return false;
|
||||
}
|
||||
/* In der Region mu<6D> es eine Burg geben. */
|
||||
|
||||
if (u_race(u) == get_race(RC_INSECT)) {
|
||||
|
@ -2407,10 +2393,6 @@ void entertain_cmd(unit * u, struct order *ord)
|
|||
cmistake(u, ord, 58, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
if (u->ship && is_guarded(r, u)) {
|
||||
cmistake(u, ord, 69, MSG_INCOME);
|
||||
return;
|
||||
|
@ -2499,11 +2481,6 @@ static int do_work(unit * u, order * ord, econ_request * o)
|
|||
cmistake(u, ord, 313, MSG_INCOME);
|
||||
return -1;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
if (ord)
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return -1;
|
||||
}
|
||||
if (u->ship && is_guarded(r, u)) {
|
||||
if (ord)
|
||||
cmistake(u, ord, 69, MSG_INCOME);
|
||||
|
@ -2612,10 +2589,6 @@ void tax_cmd(unit * u, struct order *ord, econ_request ** taxorders)
|
|||
return;
|
||||
}
|
||||
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
n = armedmen(u, false);
|
||||
|
||||
if (!n) {
|
||||
|
@ -2686,10 +2659,6 @@ void loot_cmd(unit * u, struct order *ord, econ_request ** lootorders)
|
|||
return;
|
||||
}
|
||||
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
n = armedmen(u, false);
|
||||
|
||||
if (!n) {
|
||||
|
|
|
@ -487,6 +487,7 @@ static void test_recruit_insect(CuTest *tc) {
|
|||
|
||||
test_setup();
|
||||
test_create_calendar();
|
||||
test_create_terrain("desert", -1);
|
||||
f = test_create_faction(test_create_race("insect"));
|
||||
u = test_create_unit(f, test_create_region(0, 0, NULL));
|
||||
u->thisorder = create_order(K_RECRUIT, f->locale, "%d", 1);
|
||||
|
|
10
src/gmtool.c
10
src/gmtool.c
|
@ -932,20 +932,10 @@ static void seed_player(state *st, const newfaction *player) {
|
|||
pnormalize(&nx, &ny, st->cursor.pl);
|
||||
r = findregion(nx, ny);
|
||||
if (r) {
|
||||
const char *at = strchr(player->email, '@');
|
||||
faction *f;
|
||||
addplayer(r, f = addfaction(player->email, player->password,
|
||||
player->race, player->lang,
|
||||
player->subscription));
|
||||
if (at) {
|
||||
char fname[64];
|
||||
size_t len = at - player->email;
|
||||
if (len>4 && len<sizeof(fname)) {
|
||||
memcpy(fname, player->email, len);
|
||||
fname[len]=0;
|
||||
faction_setname(f, fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,8 +105,6 @@ static bool is_guardian_r(const unit * guard)
|
|||
{
|
||||
if (guard->number == 0)
|
||||
return false;
|
||||
if (besieged(guard))
|
||||
return false;
|
||||
|
||||
/* if region_owners exist then they may be guardians: */
|
||||
if (guard->building && rule_region_owners() && guard == building_owner(guard->building)) {
|
||||
|
|
|
@ -846,7 +846,7 @@ static void json_keyword(cJSON *json, struct locale *lang) {
|
|||
}
|
||||
for (child = json->child; child; child = child->next) {
|
||||
keyword_t kwd = findkeyword(child->string);
|
||||
if (kwd != NOKEYWORD) {
|
||||
if (kwd != NOKEYWORD && keywords[kwd]) {
|
||||
if (child->type == cJSON_String) {
|
||||
init_keyword(lang, kwd, child->valuestring);
|
||||
locale_setstring(lang, mkname("keyword", keywords[kwd]), child->valuestring);
|
||||
|
|
|
@ -120,7 +120,7 @@ static void test_disable(CuTest * tc)
|
|||
const char * data = "{\"disabled\": [ "
|
||||
"\"alchemy\","
|
||||
"\"pay\","
|
||||
"\"besiege\","
|
||||
"\"attack\","
|
||||
"\"module\""
|
||||
"]}";
|
||||
cJSON *json = cJSON_Parse(data);
|
||||
|
@ -129,13 +129,13 @@ static void test_disable(CuTest * tc)
|
|||
CuAssertTrue(tc, skill_enabled(SK_ALCHEMY));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_BANNER));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_PAY));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_BESIEGE));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_ATTACK));
|
||||
CuAssertIntEquals(tc, 1, config_get_int("module.enabled", 1));
|
||||
json_config(json);
|
||||
CuAssertTrue(tc, !skill_enabled(SK_ALCHEMY));
|
||||
CuAssertTrue(tc, !keyword_disabled(K_BANNER));
|
||||
CuAssertTrue(tc, keyword_disabled(K_PAY));
|
||||
CuAssertTrue(tc, keyword_disabled(K_BESIEGE));
|
||||
CuAssertTrue(tc, keyword_disabled(K_ATTACK));
|
||||
CuAssertIntEquals(tc, 0, config_get_int("module.enabled", 1));
|
||||
cJSON_Delete(json);
|
||||
test_teardown();
|
||||
|
|
|
@ -279,10 +279,6 @@ void build_road(unit * u, int size, direction_t d)
|
|||
cmistake(u, u->thisorder, 103, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
cmistake(u, u->thisorder, 60, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rn == NULL || rn->terrain->max_road < 0) {
|
||||
cmistake(u, u->thisorder, 94, MSG_PRODUCE);
|
||||
|
@ -780,11 +776,6 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
cmistake(u, ord, 93, MSG_PRODUCE);
|
||||
return 0;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
/* units under siege can not build */
|
||||
cmistake(u, ord, 60, MSG_PRODUCE);
|
||||
return 0;
|
||||
}
|
||||
if (btype->flags & BTF_NOBUILD) {
|
||||
/* special building, cannot be built */
|
||||
cmistake(u, ord, 221, MSG_PRODUCE);
|
||||
|
@ -949,10 +940,6 @@ create_ship(unit * u, const struct ship_type *newtype, int want,
|
|||
cmistake(u, ord, 100, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* check if skill and material for 1 size is available */
|
||||
if (effskill(u, cons->skill, 0) < cons->minskill) {
|
||||
|
|
|
@ -118,7 +118,6 @@ extern "C" {
|
|||
int no;
|
||||
int size;
|
||||
int sizeleft; /* is only used during battle. should be a temporary attribute */
|
||||
int besieged; /* should be an attribute */
|
||||
int flags;
|
||||
} building;
|
||||
|
||||
|
|
|
@ -767,10 +767,6 @@ void free_gamedata(void)
|
|||
free_borders();
|
||||
free_alliances();
|
||||
|
||||
while (global.attribs) {
|
||||
a_remove(&global.attribs, global.attribs);
|
||||
}
|
||||
|
||||
while (planes) {
|
||||
plane *pl = planes;
|
||||
planes = planes->next;
|
||||
|
|
|
@ -109,7 +109,6 @@ extern "C" {
|
|||
|
||||
/* globale settings des Spieles */
|
||||
typedef struct settings {
|
||||
struct attrib *attribs;
|
||||
void *vm_state;
|
||||
} settings;
|
||||
|
||||
|
|
|
@ -373,7 +373,6 @@ bool is_repeated(keyword_t kwd)
|
|||
case K_ROUTE:
|
||||
case K_DRIVE:
|
||||
case K_WORK:
|
||||
case K_BESIEGE:
|
||||
case K_ENTERTAIN:
|
||||
case K_TAX:
|
||||
case K_RESEARCH:
|
||||
|
@ -414,7 +413,6 @@ bool is_exclusive(const order * ord)
|
|||
case K_ROUTE:
|
||||
case K_DRIVE:
|
||||
case K_WORK:
|
||||
case K_BESIEGE:
|
||||
case K_ENTERTAIN:
|
||||
case K_TAX:
|
||||
case K_RESEARCH:
|
||||
|
@ -456,7 +454,6 @@ bool is_long(keyword_t kwd)
|
|||
case K_ROUTE:
|
||||
case K_DRIVE:
|
||||
case K_WORK:
|
||||
case K_BESIEGE:
|
||||
case K_ENTERTAIN:
|
||||
case K_TAX:
|
||||
case K_RESEARCH:
|
||||
|
|
|
@ -1392,7 +1392,13 @@ int read_game(gamedata *data)
|
|||
else {
|
||||
READ_STR(store, NULL, 0);
|
||||
}
|
||||
read_attribs(data, &global.attribs, NULL);
|
||||
|
||||
if (data->version < FIXATKEYS_VERSION) {
|
||||
attrib *a = NULL;
|
||||
read_attribs(data, &a, NULL);
|
||||
a_removeall(&a, NULL);
|
||||
}
|
||||
|
||||
READ_INT(store, &turn);
|
||||
log_debug(" - reading turn %d", turn);
|
||||
rng_init(turn + config_get_int("game.seed", 0));
|
||||
|
@ -1614,9 +1620,6 @@ int write_game(gamedata *data) {
|
|||
WRITE_INT(store, game_id());
|
||||
WRITE_SECTION(store);
|
||||
|
||||
write_attribs(store, global.attribs, NULL);
|
||||
WRITE_SECTION(store);
|
||||
|
||||
WRITE_INT(store, turn);
|
||||
WRITE_INT(store, 0 /* max_unique_id */);
|
||||
WRITE_INT(store, nextborder);
|
||||
|
|
|
@ -530,60 +530,6 @@ attrib_type at_target = {
|
|||
NO_READ
|
||||
};
|
||||
|
||||
/*********************/
|
||||
/* at_siege */
|
||||
/*********************/
|
||||
|
||||
void a_writesiege(const variant *var, const void *owner, struct storage *store)
|
||||
{
|
||||
struct building *b = (struct building *)var->v;
|
||||
write_building_reference(b, store);
|
||||
}
|
||||
|
||||
int a_readsiege(variant *var, void *owner, gamedata *data)
|
||||
{
|
||||
if (read_building_reference(data, (building **)&var->v, NULL) <= 0) {
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
attrib_type at_siege = {
|
||||
"siege",
|
||||
DEFAULT_INIT,
|
||||
DEFAULT_FINALIZE,
|
||||
DEFAULT_AGE,
|
||||
a_writesiege,
|
||||
a_readsiege
|
||||
};
|
||||
|
||||
struct building *usiege(const unit * u)
|
||||
{
|
||||
attrib *a;
|
||||
if (!fval(u, UFL_SIEGE))
|
||||
return NULL;
|
||||
a = a_find(u->attribs, &at_siege);
|
||||
assert(a || !"flag set, but no siege found");
|
||||
return (struct building *)a->data.v;
|
||||
}
|
||||
|
||||
void usetsiege(unit * u, const struct building *t)
|
||||
{
|
||||
attrib *a = a_find(u->attribs, &at_siege);
|
||||
if (!a && t)
|
||||
a = a_add(&u->attribs, a_new(&at_siege));
|
||||
if (a) {
|
||||
if (!t) {
|
||||
a_remove(&u->attribs, a);
|
||||
freset(u, UFL_SIEGE);
|
||||
}
|
||||
else {
|
||||
a->data.v = (void *)t;
|
||||
fset(u, UFL_SIEGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*********************/
|
||||
/* at_contact */
|
||||
/*********************/
|
||||
|
@ -1914,14 +1860,6 @@ int getunit(const region * r, const faction * f, unit **uresult)
|
|||
return result;
|
||||
}
|
||||
|
||||
int besieged(const unit * u)
|
||||
{
|
||||
/* belagert kann man in schiffen und burgen werden */
|
||||
return (u && !keyword_disabled(K_BESIEGE)
|
||||
&& u->building && u->building->besieged
|
||||
&& u->building->besieged >= u->building->size * SIEGEFACTOR);
|
||||
}
|
||||
|
||||
bool has_horses(const unit * u)
|
||||
{
|
||||
item *itm = u->items;
|
||||
|
|
|
@ -47,7 +47,6 @@ extern "C" {
|
|||
#define UFL_NOTMOVING (1<<9) /* Die Einheit kann sich wg. langen Kampfes nicht bewegen */
|
||||
#define UFL_DEFENDER (1<<10)
|
||||
#define UFL_HUNGER (1<<11) /* kann im Folgemonat keinen langen Befehl außer ARBEITE ausführen */
|
||||
#define UFL_SIEGE (1<<12) /* speedup: belagert eine burg, siehe attribut */
|
||||
#define UFL_TARGET (1<<13) /* speedup: hat ein target, siehe attribut */
|
||||
#define UFL_WERE (1<<14)
|
||||
#define UFL_ENTER (1<<15) /* unit has entered a ship/building and will not leave it */
|
||||
|
@ -121,7 +120,6 @@ extern "C" {
|
|||
|
||||
extern struct attrib_type at_creator;
|
||||
extern struct attrib_type at_alias;
|
||||
extern struct attrib_type at_siege;
|
||||
extern struct attrib_type at_target;
|
||||
extern struct attrib_type at_potionuser;
|
||||
extern struct attrib_type at_contact;
|
||||
|
@ -138,8 +136,6 @@ extern "C" {
|
|||
const struct race *u_irace(const struct unit *u);
|
||||
const struct race *u_race(const struct unit *u);
|
||||
void u_setrace(struct unit *u, const struct race *);
|
||||
struct building *usiege(const struct unit *u);
|
||||
void usetsiege(struct unit *u, const struct building *b);
|
||||
|
||||
const char *uprivate(const struct unit *u);
|
||||
void usetprivate(struct unit *u, const char *c);
|
||||
|
@ -257,7 +253,6 @@ extern "C" {
|
|||
int read_unitid(const struct faction *f, const struct region *r);
|
||||
|
||||
/* !< sets combatstatus of a unit */
|
||||
int besieged(const struct unit *u);
|
||||
bool has_horses(const struct unit *u);
|
||||
int maintenance_cost(const struct unit *u);
|
||||
bool has_limited_skills(const struct unit *u);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
const char * keyword(keyword_t kwd)
|
||||
{
|
||||
static char result[32]; /* FIXME: static return value */
|
||||
if (kwd==NOKEYWORD) {
|
||||
if (kwd==NOKEYWORD || keywords[kwd] == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (!result[0]) {
|
||||
|
@ -43,7 +43,7 @@ void init_keywords(const struct locale *lang) {
|
|||
keyword_t findkeyword(const char *s) {
|
||||
int i;
|
||||
for (i = 0; i != MAXKEYWORDS; ++i) {
|
||||
if (strcmp(s, keywords[i]) == 0) {
|
||||
if (keywords[i] && (strcmp(s, keywords[i]) == 0)) {
|
||||
return (keyword_t)i;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ const char *keywords[MAXKEYWORDS] = {
|
|||
"work",
|
||||
"attack",
|
||||
"steal",
|
||||
"besiege",
|
||||
NULL,
|
||||
"name",
|
||||
"use",
|
||||
"describe",
|
||||
|
|
|
@ -17,7 +17,7 @@ extern "C"
|
|||
K_WORK,
|
||||
K_ATTACK,
|
||||
K_STEAL,
|
||||
K_BESIEGE,
|
||||
K_BESIEGE_UNUSED,
|
||||
K_NAME,
|
||||
K_USE,
|
||||
K_DISPLAY,
|
||||
|
|
182
src/laws.c
182
src/laws.c
|
@ -306,6 +306,11 @@ static void calculate_emigration(region * r)
|
|||
}
|
||||
}
|
||||
|
||||
/* Vermehrungsrate Bauern in 1/10000.
|
||||
* TODO: Evt. Berechnungsfehler, reale Vermehrungsraten scheinen hoeher. */
|
||||
#define PEASANTGROWTH 10
|
||||
#define PEASANTLUCK 10
|
||||
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
|
||||
|
||||
static double peasant_growth_factor(void)
|
||||
{
|
||||
|
@ -896,61 +901,6 @@ void demographics(void)
|
|||
immigration();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
/* test if the unit can slip through a siege undetected.
|
||||
* returns 0 if siege is successful, or 1 if the building is either
|
||||
* not besieged or the unit can slip through the siege due to better stealth.
|
||||
*/
|
||||
static int slipthru(const region * r, const unit * u, const building * b)
|
||||
{
|
||||
unit *u2;
|
||||
int n, o;
|
||||
|
||||
/* b ist die burg, in die man hinein oder aus der man heraus will. */
|
||||
if (b == NULL || b->besieged < b->size * SIEGEFACTOR) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* u wird am hinein- oder herausschluepfen gehindert, wenn STEALTH <=
|
||||
* OBSERVATION +2 der belagerer u2 ist */
|
||||
n = effskill(u, SK_STEALTH, r);
|
||||
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
if (usiege(u2) == b) {
|
||||
|
||||
if (invisible(u, u2) >= u->number)
|
||||
continue;
|
||||
|
||||
o = effskill(u2, SK_PERCEPTION, r);
|
||||
|
||||
if (o + 2 >= n) {
|
||||
return 0; /* entdeckt! */
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int can_contact(const region * r, const unit * u, const unit * u2) {
|
||||
|
||||
/* hier geht es nur um die belagerung von burgen */
|
||||
UNUSED_ARG(r);
|
||||
if (u->building == u2->building) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* unit u is trying to contact u2 - unasked for contact. wenn u oder u2
|
||||
* nicht in einer burg ist, oder die burg nicht belagert ist, ist
|
||||
* slipthru () == 1. ansonsten ist es nur 1, wenn man die belagerer */
|
||||
|
||||
if (slipthru(u->region, u, u->building) && slipthru(u->region, u2, u2->building)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (alliedunit(u, u2->faction, HELP_GIVE));
|
||||
}
|
||||
|
||||
int contact_cmd(unit * u, order * ord)
|
||||
{
|
||||
unit *u2;
|
||||
|
@ -961,10 +911,6 @@ int contact_cmd(unit * u, order * ord)
|
|||
u2 = findunit(n);
|
||||
|
||||
if (u2 != NULL) {
|
||||
if (!can_contact(u->region, u, u2)) {
|
||||
cmistake(u, u->thisorder, 23, MSG_EVENT);
|
||||
return -1;
|
||||
}
|
||||
usetcontact(u, u2);
|
||||
}
|
||||
return 0;
|
||||
|
@ -989,13 +935,7 @@ int leave_cmd(unit * u, struct order *ord)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
if (!slipthru(r, u, u->building)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "entrance_besieged",
|
||||
"building", u->building));
|
||||
}
|
||||
else {
|
||||
leave(u, true);
|
||||
}
|
||||
leave(u, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1143,13 +1083,6 @@ int enter_building(unit * u, order * ord, int id, bool report)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
if (!slipthru(r, u, b)) {
|
||||
if (report) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_besieged",
|
||||
"building", b));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (leave(u, 0)) {
|
||||
fset(u, UFL_ENTER);
|
||||
|
@ -3799,98 +3732,6 @@ int armedmen(const unit * u, bool siege_weapons)
|
|||
return n;
|
||||
}
|
||||
|
||||
int siege_cmd(unit * u, order * ord)
|
||||
{
|
||||
region *r = u->region;
|
||||
building *b;
|
||||
int d, pooled;
|
||||
int bewaffnete, katapultiere = 0;
|
||||
resource_type *rt_catapultammo = NULL;
|
||||
resource_type *rt_catapult = NULL;
|
||||
|
||||
init_order_depr(ord);
|
||||
b = getbuilding(r);
|
||||
|
||||
if (!b) {
|
||||
cmistake(u, ord, 31, MSG_BATTLE);
|
||||
return 31;
|
||||
}
|
||||
|
||||
if (!playerrace(u_race(u))) {
|
||||
/* keine Drachen, Illusionen, Untote etc */
|
||||
cmistake(u, ord, 166, MSG_BATTLE);
|
||||
return 166;
|
||||
}
|
||||
/* schaden durch katapulte */
|
||||
|
||||
rt_catapultammo = rt_find("catapultammo");
|
||||
rt_catapult = rt_find("catapult");
|
||||
|
||||
d = i_get(u->items, rt_catapult->itype);
|
||||
if (d > u->number) d = u->number;
|
||||
pooled = get_pooled(u, rt_catapultammo, GET_DEFAULT, d);
|
||||
if (d > pooled) d = pooled;
|
||||
if (effskill(u, SK_CATAPULT, 0) >= 1) {
|
||||
katapultiere = d;
|
||||
d *= effskill(u, SK_CATAPULT, 0);
|
||||
}
|
||||
else {
|
||||
d = 0;
|
||||
}
|
||||
|
||||
bewaffnete = armedmen(u, true);
|
||||
if (d == 0 && bewaffnete == 0) {
|
||||
/* abbruch, falls unbewaffnet oder unfaehig, katapulte zu benutzen */
|
||||
cmistake(u, ord, 80, MSG_EVENT);
|
||||
return 80;
|
||||
}
|
||||
|
||||
if (!is_guard(u)) {
|
||||
/* abbruch, wenn die einheit nicht vorher die region bewacht - als
|
||||
* warnung fuer alle anderen! */
|
||||
cmistake(u, ord, 81, MSG_EVENT);
|
||||
return 81;
|
||||
}
|
||||
/* einheit und burg markieren - spart zeit beim behandeln der einheiten
|
||||
* in der burg, falls die burg auch markiert ist und nicht alle
|
||||
* einheiten wieder abgesucht werden muessen! */
|
||||
|
||||
usetsiege(u, b);
|
||||
if (katapultiere < bewaffnete) katapultiere = bewaffnete;
|
||||
b->besieged += katapultiere;
|
||||
|
||||
/* definitiver schaden eingeschraenkt */
|
||||
if (d > b->size - 1) d = b->size - 1;
|
||||
|
||||
/* meldung, schaden anrichten */
|
||||
if (d && !curse_active(get_curse(b->attribs, &ct_magicwalls))) {
|
||||
b->size -= d;
|
||||
use_pooled(u, rt_catapultammo,
|
||||
GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, d);
|
||||
/* send message to the entire region */
|
||||
ADDMSG(&r->msgs, msg_message("siege_catapults",
|
||||
"unit building destruction", u, b, d));
|
||||
}
|
||||
else {
|
||||
/* send message to the entire region */
|
||||
ADDMSG(&r->msgs, msg_message("siege", "unit building", u, b));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void do_siege(region * r)
|
||||
{
|
||||
if (fval(r->terrain, LAND_REGION)) {
|
||||
unit *u;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (getkeyword(u->thisorder) == K_BESIEGE) {
|
||||
siege_cmd(u, u->thisorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void enter_1(region * r)
|
||||
{
|
||||
do_enter(r, 0);
|
||||
|
@ -3974,11 +3815,6 @@ void init_processor(void)
|
|||
p += 10;
|
||||
add_proc_global(p, do_battles, "Attackieren");
|
||||
|
||||
if (!keyword_disabled(K_BESIEGE)) {
|
||||
p += 10;
|
||||
add_proc_region(p, do_siege, "Belagern");
|
||||
}
|
||||
|
||||
p += 10; /* can't allow reserve before siege (weapons) */
|
||||
add_proc_region(p, enter_1, "Betreten (3. Versuch)"); /* to claim a castle after a victory and to be able to DESTROY it in the same turn */
|
||||
if (config_get_int("rules.reserve.twophase", 0)) {
|
||||
|
@ -4196,7 +4032,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
|||
}
|
||||
|
||||
/* simple visibility, just gotta have a viewer in the region to see 'em */
|
||||
if (leftship(u) || is_guard(u) || usiege(u) || u->building || u->ship) {
|
||||
if (leftship(u) || is_guard(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -4234,7 +4070,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
|
|||
else {
|
||||
int n, rings;
|
||||
|
||||
if (is_guard(target) || usiege(target) || target->building
|
||||
if (is_guard(target) || target->building
|
||||
|| target->ship) {
|
||||
return true;
|
||||
}
|
||||
|
@ -4277,7 +4113,7 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u,
|
|||
else {
|
||||
int rings, n;
|
||||
|
||||
if (is_guard(u) || usiege(u) || u->building || u->ship) {
|
||||
if (is_guard(u) || u->building || u->ship) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ extern "C" {
|
|||
bool renamed_building(const struct building * b);
|
||||
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
|
||||
void get_food(struct region * r);
|
||||
int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
|
||||
|
||||
int enter_building(struct unit *u, struct order *ord, int id, bool report);
|
||||
int enter_ship(struct unit *u, struct order *ord, int id, bool report);
|
||||
|
@ -82,7 +81,6 @@ extern "C" {
|
|||
int quit_cmd(struct unit *u, struct order *ord);
|
||||
int name_cmd(struct unit *u, struct order *ord);
|
||||
int use_cmd(struct unit *u, struct order *ord);
|
||||
int siege_cmd(struct unit *u, struct order *ord);
|
||||
int leave_cmd(struct unit *u, struct order *ord);
|
||||
int pay_cmd(struct unit *u, struct order *ord);
|
||||
int promotion_cmd(struct unit *u, struct order *ord);
|
||||
|
|
|
@ -95,37 +95,6 @@ static void test_rename_building_twice(CuTest * tc)
|
|||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_contact(CuTest * tc)
|
||||
{
|
||||
region *r;
|
||||
unit *u1, *u2, *u3;
|
||||
building *b;
|
||||
building_type *btype;
|
||||
ally *al;
|
||||
|
||||
test_setup();
|
||||
test_create_locale();
|
||||
btype = test_create_buildingtype("castle");
|
||||
r = test_create_region(0, 0, NULL);
|
||||
b = new_building(btype, r, default_locale);
|
||||
u1 = test_create_unit(test_create_faction(NULL), r);
|
||||
u2 = test_create_unit(test_create_faction(NULL), r);
|
||||
u3 = test_create_unit(test_create_faction(NULL), r);
|
||||
set_level(u3, SK_PERCEPTION, 2);
|
||||
usetsiege(u3, b);
|
||||
b->besieged = 1;
|
||||
CuAssertIntEquals(tc, 1, can_contact(r, u1, u2));
|
||||
|
||||
u_set_building(u1, b);
|
||||
CuAssertIntEquals(tc, 0, can_contact(r, u1, u2));
|
||||
al = ally_add(&u1->faction->allies, u2->faction);
|
||||
al->status = HELP_ALL;
|
||||
CuAssertIntEquals(tc, HELP_GIVE, can_contact(r, u1, u2));
|
||||
u_set_building(u2, b);
|
||||
CuAssertIntEquals(tc, 1, can_contact(r, u1, u2));
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
static void test_enter_building(CuTest * tc)
|
||||
{
|
||||
unit *u;
|
||||
|
@ -1832,7 +1801,6 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_pay_cmd_must_be_owner);
|
||||
SUITE_ADD_TEST(suite, test_new_units);
|
||||
SUITE_ADD_TEST(suite, test_cannot_create_unit_above_limit);
|
||||
SUITE_ADD_TEST(suite, test_contact);
|
||||
SUITE_ADD_TEST(suite, test_enter_building);
|
||||
SUITE_ADD_TEST(suite, test_enter_ship);
|
||||
SUITE_ADD_TEST(suite, test_display_cmd);
|
||||
|
|
57
src/move.c
57
src/move.c
|
@ -630,7 +630,7 @@ mark_travelthru(unit * u, region * r, const region_list * route,
|
|||
}
|
||||
}
|
||||
|
||||
ship *move_ship(ship * sh, region * from, region * to, region_list * route)
|
||||
void move_ship(ship * sh, region * from, region * to, region_list * route)
|
||||
{
|
||||
unit **iunit = &from->units;
|
||||
unit **ulist = &to->units;
|
||||
|
@ -663,8 +663,6 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route)
|
|||
if (*iunit == u)
|
||||
iunit = &u->next;
|
||||
}
|
||||
|
||||
return sh;
|
||||
}
|
||||
|
||||
static bool is_freezing(const unit * u)
|
||||
|
@ -857,39 +855,34 @@ static void drifting_ships(region * r)
|
|||
}
|
||||
}
|
||||
|
||||
if (rnext != NULL) {
|
||||
if (firstu != NULL) {
|
||||
message *msg = msg_message("ship_drift", "ship dir", sh, dir);
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg);
|
||||
}
|
||||
|
||||
fset(sh, SF_DRIFTED);
|
||||
if (ovl >= overload_start()) {
|
||||
damage_ship(sh, damage_overload(ovl));
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh));
|
||||
}
|
||||
else {
|
||||
damage_ship(sh, damage_drift);
|
||||
}
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh));
|
||||
sink_ship(sh);
|
||||
remove_ship(shp, sh);
|
||||
}
|
||||
else if (rnext != NULL) {
|
||||
/* Das Schiff und alle Einheiten darin werden nun von r
|
||||
* nach rnext verschoben. Danach eine Meldung. */
|
||||
* nach rnext verschoben. Danach eine Meldung. */
|
||||
add_regionlist(&route, rnext);
|
||||
|
||||
set_coast(sh, r, rnext);
|
||||
sh = move_ship(sh, r, rnext, route);
|
||||
move_ship(sh, r, rnext, route);
|
||||
free_regionlist(route);
|
||||
|
||||
if (firstu != NULL) {
|
||||
message *msg = msg_message("ship_drift", "ship dir", sh, dir);
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg);
|
||||
}
|
||||
}
|
||||
|
||||
if (sh != NULL) {
|
||||
fset(sh, SF_DRIFTED);
|
||||
if (ovl >= overload_start()) {
|
||||
damage_ship(sh, damage_overload(ovl));
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh));
|
||||
}
|
||||
else {
|
||||
damage_ship(sh, damage_drift);
|
||||
}
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh));
|
||||
sink_ship(sh);
|
||||
remove_ship(shp, sh);
|
||||
}
|
||||
}
|
||||
|
||||
if (*shp == sh) {
|
||||
else {
|
||||
shp = &sh->next;
|
||||
}
|
||||
}
|
||||
|
@ -1970,7 +1963,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
if (fval(u, UFL_FOLLOWING))
|
||||
caught_target(current_point, u);
|
||||
|
||||
sh = move_ship(sh, starting_point, current_point, *routep);
|
||||
move_ship(sh, starting_point, current_point, *routep);
|
||||
|
||||
/* Hafengebühren ? */
|
||||
|
||||
|
@ -2368,7 +2361,7 @@ static void move_hunters(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!fval(u, UFL_LONGACTION) && !LongHunger(u) && follow_ship(u, ord)) {
|
||||
if (!LongHunger(u) && follow_ship(u, ord)) {
|
||||
up = &r->units;
|
||||
break;
|
||||
}
|
||||
|
@ -2633,9 +2626,9 @@ void follow_unit(unit * u)
|
|||
}
|
||||
}
|
||||
if (follow) {
|
||||
fset(u, UFL_FOLLOWING);
|
||||
fset(u2, UFL_FOLLOWED);
|
||||
/* FOLLOW unit on a (potentially) moving unit prevents long orders */
|
||||
fset(u, UFL_FOLLOWING | UFL_LONGACTION);
|
||||
set_order(&u->thisorder, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ extern "C" {
|
|||
bool canfly(struct unit *u);
|
||||
void leave_trail(struct ship *sh, struct region *from,
|
||||
struct region_list *route);
|
||||
struct ship *move_ship(struct ship *sh, struct region *from,
|
||||
void move_ship(struct ship *sh, struct region *from,
|
||||
struct region *to, struct region_list *route);
|
||||
int walkingcapacity(const struct unit *u);
|
||||
int movement_speed(const struct unit * u);
|
||||
|
|
|
@ -21,7 +21,6 @@ module eressea {
|
|||
void process_movement @ movement(void); /* MOVE/FOLLOW/ROUTE */
|
||||
void process_use @ use(void); /* USE */
|
||||
void process_battle @ battle(void); /* ATTACK */
|
||||
void process_siege @ siege(void); /* SIEGE */
|
||||
void process_leave @ leave(void); /* LEAVE */
|
||||
void process_maintenance @ maintenance(void); /* PAY */
|
||||
void process_promote @ promote(void); /* PROMOTE */
|
||||
|
|
|
@ -435,30 +435,6 @@ static int tolua_process_eressea_process_battle00(lua_State* tolua_S)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* function: process_siege */
|
||||
static int tolua_process_eressea_process_siege00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isnoobj(tolua_S,1,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
{
|
||||
process_siege();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'siege'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* function: process_leave */
|
||||
static int tolua_process_eressea_process_leave00(lua_State* tolua_S)
|
||||
{
|
||||
|
@ -993,7 +969,6 @@ LUALIB_API int luaopen_process (lua_State* tolua_S)
|
|||
tolua_function(tolua_S,"movement",tolua_process_eressea_process_movement00);
|
||||
tolua_function(tolua_S,"use",tolua_process_eressea_process_use00);
|
||||
tolua_function(tolua_S,"battle",tolua_process_eressea_process_battle00);
|
||||
tolua_function(tolua_S,"siege",tolua_process_eressea_process_siege00);
|
||||
tolua_function(tolua_S,"leave",tolua_process_eressea_process_leave00);
|
||||
tolua_function(tolua_S,"maintenance",tolua_process_eressea_process_maintenance00);
|
||||
tolua_function(tolua_S,"promote",tolua_process_eressea_process_promote00);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
void age_firedragon(struct unit *u);
|
||||
void age_dragon(struct unit *u);
|
||||
void age_undead(struct unit *u);
|
||||
void age_skeleton(struct unit *u);
|
||||
void age_zombie(struct unit *u);
|
||||
void age_ghoul(struct unit *u);
|
||||
|
@ -81,7 +80,6 @@ void equip_newunits(struct unit *u)
|
|||
void register_races(void)
|
||||
{
|
||||
/* function age for race->age() */
|
||||
register_function((pf_generic)age_undead, "age_undead");
|
||||
register_function((pf_generic)age_skeleton, "age_skeleton");
|
||||
register_function((pf_generic)age_zombie, "age_zombie");
|
||||
register_function((pf_generic)age_ghoul, "age_ghoul");
|
||||
|
|
|
@ -40,29 +40,6 @@ void make_undead_unit(unit * u)
|
|||
u->flags |= UFL_ISNEW;
|
||||
}
|
||||
|
||||
void age_undead(unit * u)
|
||||
{
|
||||
region *r = u->region;
|
||||
|
||||
/* untote, die einer partei angehoeren, koennen sich
|
||||
* absplitten, anstatt sich zu vermehren. monster
|
||||
* untote vermehren sich nur noch */
|
||||
|
||||
if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
|
||||
&& rng_int() % 100 < UNDEAD_BREAKUP) {
|
||||
int m, n = 0;
|
||||
unit *u2;
|
||||
|
||||
for (m = u->number; m; m--) {
|
||||
if (rng_int() % 100 < UNDEAD_BREAKUP_FRACTION)
|
||||
++n;
|
||||
}
|
||||
u2 = create_unit(r, get_monsters(), 0, get_race(RC_UNDEAD), 0, NULL, u);
|
||||
make_undead_unit(u2);
|
||||
transfermen(u, u2, u->number - n);
|
||||
}
|
||||
}
|
||||
|
||||
void age_skeleton(unit * u)
|
||||
{
|
||||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||
|
|
10
src/report.c
10
src/report.c
|
@ -1821,7 +1821,6 @@ nr_building(struct stream *out, const region *r, const building *b, const factio
|
|||
const char *name, *bname, *billusion = NULL;
|
||||
const struct locale *lang;
|
||||
char buffer[8192];
|
||||
message *msg;
|
||||
size_t size;
|
||||
sbstring sbs;
|
||||
|
||||
|
@ -1853,15 +1852,6 @@ nr_building(struct stream *out, const region *r, const building *b, const factio
|
|||
sbs_strcat(&sbs, LOC(lang, "nr_building_inprogress"));
|
||||
}
|
||||
|
||||
if (b->besieged > 0 && r->seen.mode >= seen_lighthouse) {
|
||||
msg = msg_message("nr_building_besieged", "soldiers diff", b->besieged,
|
||||
b->besieged - b->size * SIEGEFACTOR);
|
||||
|
||||
size = nr_render(msg, lang, sbs.end, sbs.size - (sbs.end - sbs.begin), f);
|
||||
sbs.end += size;
|
||||
|
||||
msg_release(msg);
|
||||
}
|
||||
i = 0;
|
||||
if (b->display && b->display[0]) {
|
||||
sbs_strcat(&sbs, "; ");
|
||||
|
|
|
@ -683,7 +683,6 @@ bufunit(const faction * f, const unit * u, seen_mode mode, char *buf,
|
|||
int i, dh;
|
||||
int getarnt = fval(u, UFL_ANON_FACTION);
|
||||
const char *pzTmp, *str;
|
||||
building *b;
|
||||
bool isbattle = (bool)(mode == seen_battle);
|
||||
item *itm, *show = NULL;
|
||||
faction *fv;
|
||||
|
@ -807,11 +806,6 @@ bufunit(const faction * f, const unit * u, seen_mode mode, char *buf,
|
|||
bufp = STRLCPY(bufp, LOC(lang, "unit_guards"), size);
|
||||
}
|
||||
|
||||
if ((b = usiege(u)) != NULL) {
|
||||
bufp = STRLCPY(bufp, ", belagert ", size);
|
||||
bufp = STRLCPY(bufp, buildingname(b), size);
|
||||
}
|
||||
|
||||
dh = 0;
|
||||
if (u->faction == f) {
|
||||
skill *sv;
|
||||
|
|
|
@ -10,23 +10,11 @@
|
|||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#define ENTERTAINFRACTION 20
|
||||
#define TEACHDIFFERENCE 2
|
||||
#define RESOURCE_QUANTITY 0.5
|
||||
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
|
||||
#define COMBAT_TURNS 5
|
||||
#undef NEWATSROI
|
||||
|
||||
/* Vermehrungsrate Bauern in 1/10000.
|
||||
* TODO: Evt. Berechnungsfehler, reale Vermehrungsraten scheinen hoeher. */
|
||||
#define PEASANTGROWTH 10
|
||||
#define PEASANTLUCK 10
|
||||
|
||||
#define ROW_FACTOR 3 /* factor for combat row advancement rule */
|
||||
|
||||
/* TODO: move these settings to settings.h or into configuration files */
|
||||
#define TREESIZE (8) /* space used by trees (in #peasants) */
|
||||
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
|
||||
|
||||
/* Gebaeudegroesse = Minimalbelagerer */
|
||||
#define SIEGEFACTOR 2
|
||||
|
|
|
@ -299,7 +299,7 @@ int sp_combatrosthauch(struct castorder * co)
|
|||
for (w = 0; df->weapons[w].type != NULL; ++w) {
|
||||
weapon *wp = df->weapons;
|
||||
int n = force;
|
||||
if (n < wp->used) n = wp->used;
|
||||
if (n > wp->used) n = wp->used;
|
||||
if (n) {
|
||||
requirement *mat = wp->type->itype->construction->materials;
|
||||
bool iron = false;
|
||||
|
|
|
@ -137,10 +137,6 @@ int spy_cmd(unit * u, struct order *ord)
|
|||
msg_feedback(u, u->thisorder, "feedback_unit_not_found", ""));
|
||||
return 0;
|
||||
}
|
||||
if (!can_contact(r, u, target)) {
|
||||
cmistake(u, u->thisorder, 24, MSG_EVENT);
|
||||
return 0;
|
||||
}
|
||||
if (effskill(u, SK_SPY, 0) < 1) {
|
||||
cmistake(u, u->thisorder, 39, MSG_EVENT);
|
||||
return 0;
|
||||
|
|
|
@ -198,17 +198,17 @@ static void test_setstealth_cmd(CuTest *tc) {
|
|||
test_setup();
|
||||
u = test_create_unit(test_create_faction(NULL), test_create_plain(0, 0));
|
||||
lang = u->faction->locale;
|
||||
u->flags = UFL_ANON_FACTION | UFL_SIEGE;
|
||||
u->flags = UFL_ANON_FACTION | UFL_DEFENDER;
|
||||
u->thisorder = create_order(K_SETSTEALTH, lang, "%s %s",
|
||||
LOC(lang, parameters[P_FACTION]),
|
||||
LOC(lang, parameters[P_NOT]));
|
||||
setstealth_cmd(u, u->thisorder);
|
||||
CuAssertIntEquals(tc, UFL_SIEGE, u->flags);
|
||||
CuAssertIntEquals(tc, UFL_DEFENDER, u->flags);
|
||||
free_order(u->thisorder);
|
||||
u->thisorder = create_order(K_SETSTEALTH, lang, "%s",
|
||||
LOC(lang, parameters[P_FACTION]));
|
||||
setstealth_cmd(u, u->thisorder);
|
||||
CuAssertIntEquals(tc, UFL_SIEGE | UFL_ANON_FACTION, u->flags);
|
||||
CuAssertIntEquals(tc, UFL_DEFENDER | UFL_ANON_FACTION, u->flags);
|
||||
test_teardown();
|
||||
}
|
||||
|
||||
|
|
|
@ -188,10 +188,6 @@ void steal_cmd(unit * u, struct order *ord, econ_request ** stealorders)
|
|||
}
|
||||
|
||||
assert(u->region == u2->region);
|
||||
if (!can_contact(r, u, u2)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error60", ""));
|
||||
return;
|
||||
}
|
||||
|
||||
effsk = effskill(u, SK_STEALTH, 0);
|
||||
n = effsk - max_skill(r, f, SK_PERCEPTION);
|
||||
|
|
|
@ -31,6 +31,7 @@ extern "C" {
|
|||
|
||||
#define STUDYDAYS 30
|
||||
#define TEACHNUMBER 10
|
||||
#define TEACHDIFFERENCE 2
|
||||
|
||||
typedef struct teaching_info {
|
||||
struct selist *teachers;
|
||||
|
|
28
src/tests.c
28
src/tests.c
|
@ -13,6 +13,7 @@
|
|||
#include <kernel/plane.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/terrain.h>
|
||||
#include <kernel/terrainid.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/order.h>
|
||||
|
@ -146,7 +147,9 @@ struct locale * test_create_locale(void) {
|
|||
locale_setstring(loc, combatstatus[i], combatstatus[i] + 7);
|
||||
}
|
||||
for (i = 0; i != MAXKEYWORDS; ++i) {
|
||||
locale_setstring(loc, mkname("keyword", keywords[i]), keywords[i]);
|
||||
if (keywords[i]) {
|
||||
locale_setstring(loc, mkname("keyword", keywords[i]), keywords[i]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i != MAXPARAMS; ++i) {
|
||||
locale_setstring(loc, parameters[i], parameters[i]);
|
||||
|
@ -238,6 +241,29 @@ static void test_reset(void) {
|
|||
free_spellbooks();
|
||||
free_prefixes();
|
||||
mt_clear();
|
||||
/*
|
||||
for (i = 0; i != MAXTERRAINS; ++i) {
|
||||
int flags = 0;
|
||||
if (i == T_FIREWALL) {
|
||||
flags |= FORBIDDEN_REGION;
|
||||
} else {
|
||||
flags = FLY_INTO | WALK_INTO;
|
||||
if (i == T_OCEAN) {
|
||||
flags |= SEA_REGION | SWIM_INTO;
|
||||
}
|
||||
else {
|
||||
flags |= LAND_REGION;
|
||||
if (i == T_PLAIN) {
|
||||
flags |= CAVALRY_REGION | FOREST_REGION;
|
||||
}
|
||||
else if (i == T_GLACIER || i == T_ICEBERG || i == T_ICEBERG_SLEEP) {
|
||||
flags |= ARCTIC_REGION;
|
||||
}
|
||||
}
|
||||
}
|
||||
test_create_terrain(terrainnames[i], flags);
|
||||
}
|
||||
*/
|
||||
for (i = 0; i != MAXSKILLS; ++i) {
|
||||
enable_skill(i, true);
|
||||
}
|
||||
|
|
|
@ -36,10 +36,11 @@
|
|||
#define FAMILIAR_FIX_VERSION 359 /* familiar links are fixed */
|
||||
#define SKILLSORT_VERSION 360 /* u->skills is sorted */
|
||||
#define LANDDISPLAY_VERSION 360 /* r.display is now in r.land.display */
|
||||
#define FIXATKEYS_VERSION 361 /* remove global.attribs, fix at_keys */
|
||||
/* unfinished: */
|
||||
#define CRYPT_VERSION 400 /* passwords are encrypted */
|
||||
|
||||
#define RELEASE_VERSION LANDDISPLAY_VERSION /* current datafile */
|
||||
#define RELEASE_VERSION FIXATKEYS_VERSION /* current datafile */
|
||||
#define MIN_VERSION UIDHASH_VERSION /* minimal datafile we support */
|
||||
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */
|
||||
|
||||
|
|
|
@ -86,13 +86,7 @@ static void mt_register(message_type * mtype) {
|
|||
|
||||
message_type *mt_create(message_type * mtype, const char *args[], int nparameters)
|
||||
{
|
||||
if (args != NULL && args[nparameters]) {
|
||||
/* count the number of parameters */
|
||||
do {
|
||||
++nparameters;
|
||||
} while (args[nparameters]);
|
||||
}
|
||||
if (nparameters > 0) {
|
||||
if (args && nparameters > 0) {
|
||||
int i;
|
||||
mtype->nparameters = nparameters;
|
||||
mtype->pnames = (char **)malloc(sizeof(char *) * nparameters);
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "settings.h"
|
||||
|
||||
#include "wormhole.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue