GIB 0 an Land kann alle Schiffe geben, auf Ozean nicht.

This commit is contained in:
Enno Rehling 2019-10-10 20:24:18 +02:00
parent 1d405e2ef8
commit 12491ffc16
3 changed files with 18 additions and 3 deletions

View File

@ -2774,6 +2774,9 @@ msgstr "\"$unit($unit) in $region($region): '$order($command)' - Spells can only
msgid "error326" msgid "error326"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - These ships cannot form a convoy.\"" 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" msgid "error324"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is not one of ours.\"" msgstr "\"$unit($unit) in $region($region): '$order($command)' - The unit is not one of ours.\""

View File

@ -203,8 +203,8 @@ function test_give_ship_same_ship()
assert_not_equal(u1.ship, u2.ship) assert_not_equal(u1.ship, u2.ship)
end end
function test_give_ship_dont_give_all() function test_give_ship_all_on_ocean()
local r = region.create(1, 0, 'ocean') local r = region.create(0, 0, 'ocean')
local f = faction.create("human") local f = faction.create("human")
local u1 = unit.create(f, r, 1) local u1 = unit.create(f, r, 1)
u1.ship = ship.create(r, 'longboat') u1.ship = ship.create(r, 'longboat')
@ -214,6 +214,18 @@ function test_give_ship_dont_give_all()
assert_equal(2, u1.ship.number) assert_equal(2, u1.ship.number)
end 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() function test_give_ship_no_boat()
local r = region.create(1, 0, 'ocean') local r = region.create(1, 0, 'ocean')
local f = faction.create("human") local f = faction.create("human")

View File

@ -336,7 +336,7 @@ message * give_ship(unit *u1, unit *u2, int n, order *ord)
return msg_error(u1, ord, 146); return msg_error(u1, ord, 146);
} }
if (u2 == NULL) { if (u2 == NULL) {
if (n < u1->ship->number) { if (fval(u1->region->terrain, LAND_REGION) || n < u1->ship->number) {
ship * sh = new_ship(u1->ship->type, u1->region, u1->faction->locale); ship * sh = new_ship(u1->ship->type, u1->region, u1->faction->locale);
scale_ship(sh, 0); scale_ship(sh, 0);
transfer_ships(u1->ship, sh, n); transfer_ships(u1->ship, sh, n);