Commit Graph

16 Commits

Author SHA1 Message Date
CTD1 700a88fd79 Umlaute in Kommentaren
sind doof.
2014-07-15 15:46:02 +02:00
CTD1 38a754844e BUG 0001980: Gegener hält Burg obwohl alle geflohen sind!
http://bugs.eressea.de/view.php?id=1980
Der Test unten erzeugt eine Temp-Einheit welche nach dem Kampf die Burg hält, trotz einer vernichtenden Niederlage innerhalb von 2 Kampfrunden. Der Angreifer darf die Burg zwar betreten, bekommt aber nicht das Kommando.
Grund ist das beim Betreten der Burg via u_set_building() nur dann die betretende Einheit zum Burgenbesitzer wird wenn es keinen Burgenbesitzer gibt.
Die eher aufgerufene Funktion building_owner() versucht zwar nach dem Kampf einen neuen Burgenbesitzer zu finden, da sich zu diesem Zeitpunkt aber nur eine Tote Einheit und einen Temp Einheit, beide mit 0 Personen, in der Bug befinden schlägt dies Fehl. Es wird von der Funktion zwar 0 zurückgegeben, aber b->_owner wird nicht zurückgesetzt (Vermutlich da der Server an anderer Stelle sonst annimmt das noch nie jemand in der Burg war). Daher die Überprüfung bei u_set_building ob der Burgenbesitzer tot ist, und wenn ja wird die betretende Einheit neuer Burgenbesitzer.

local r1 = region.create(1, 2, "plain")
local f1 = faction.create("a@b.de", "human", "de")
local f2 = faction.create("c@d.de", "human", "de")
f1.age=20
f2.age=20

local b1 = building.create(r1, "castle")
b1.size = 100

local u0 = unit.create(f1, r1, 10)
u0.building = b1
u0:add_item("money", u0.number * 100)
u0:clear_orders()
u0:add_order("KÄMPFE")
u0:add_order("MACHE TEMP 1")
u0:add_order("ENDE")

local u1 = unit.create(f1, r1, 100)
u1.building = b1
u1:add_item("money", u1.number * 100)
u1:clear_orders()
u1:add_order("KÄMPFE FLIEHE")
u1:add_order("GIB TEMP 1 ALLES PERSONEN")
u1:add_order("GIB TEMP 1 ALLES")
u1:add_order("GIB TEMP 1 Kommando")

local u2 = unit.create(f2, r1, 101)
u2:add_item("sword", u2.number)
u2:add_item("money", u2.number * 100)
u2:set_skill("melee", 16)
u2:clear_orders()
u2:add_order("KÄMPFE")
u2:add_order("ATTACKIEREN " .. itoa36(u1.id))
u2:add_order("BETRETE BURG " .. itoa36(b1.id))

process_orders()


Das sollte für Schiffe eigentlich das gleiche sein, also da die gleiche Änderung.
2014-07-15 15:24:21 +02:00
Enno Rehling b2b35fd9d0 add a test for the E3 reduced give quota.
foreign units receive only 50% of silver given to them.

Conflicts:
	tests/pool.lua
2014-07-07 03:41:33 +02:00
Enno Rehling 88f9d247bd Revert "use race::flags|RCF_NOGIVE instead of race::ec_flags|GIVEITEM"
E3 Tests (GIVE) did not pass.

This reverts commit 5ec3f5b83a.
2014-07-06 00:29:52 -07:00
Enno Rehling 5ec3f5b83a use race::flags|RCF_NOGIVE instead of race::ec_flags|GIVEITEM
None of this has tests, it'd going to be years before a change like this can be made without fear D-:
2014-07-05 23:31:34 -07:00
Enno Rehling c3dfbdea18 eliminate new_race array in favor of a function (TODO: make it fast) 2014-06-29 18:10:02 -07:00
Enno Rehling 92f43a7b51 eliminate it_find calls, replace it_find with something backed by rt_find 2014-06-24 22:44:05 -07:00
Enno Rehling d581737744 optimization: caching resource types in get_resourcetype.
eliminate some it_find calls.
eliminate static variables, they make testing hard.
2014-06-24 07:42:45 -07:00
Enno Rehling 73da14e305 getting rid of the olditemtypes[] array
reduce use of statics
reduce use of item_t enum
2014-06-23 07:28:10 -07:00
Enno Rehling bff25f3c51 move skill_t into a separate file, give it unit tests.
name functions the same as we did for keyword/direction earlier.
to do: json configuration and lua test.
2014-06-20 23:59:04 -07:00
Enno Rehling 7038b021de fix counting of units, making it slower but more correct 2014-05-24 20:25:06 -07:00
Enno Rehling 535a9e6e53 fix number of units in the report header 2014-04-26 12:24:51 -07:00
Enno Rehling 7358c48580 removing some naming conflicts that hapen when trying to re-enable amalgamation builds. 2014-04-11 19:41:17 -07:00
Enno Rehling 0ae8737062 rename MIN/MAX to _min/_max 2014-03-16 05:03:17 +01:00
Enno Rehling 1a7d892a96 use cmake for autoconf, slim down platform.h 2014-03-15 19:29:11 +01:00
Enno Rehling 03c247c788 I am killing the core/ directory.
Lots of files are moving to a new location in src/
Some intersting CMake changes.
2014-02-18 05:45:00 +01:00
Renamed from core/src/kernel/unit.c (Browse further)