Neue Schiffe erzeugen setzt sie automatisch in die Regionsliste ein.

This commit is contained in:
Enno Rehling 2004-12-22 22:58:52 +00:00
parent 6af2549c7d
commit 07a214b7fa
12 changed files with 77 additions and 29 deletions

View File

@ -22,7 +22,7 @@
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG"
PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"

View File

@ -1007,8 +1007,6 @@ create_ship(region * r, unit * u, const struct ship_type * newtype, int want)
sh = new_ship(newtype, u->faction->locale, r);
addlist(&r->ships, sh);
leave(r, u);
u->ship = sh;
fset(u, UFL_OWNER);

View File

@ -262,7 +262,6 @@ give_starting_equipment(struct region *r, struct unit *u)
{
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
sh->size = sh->type->construction->maxsize;
addlist(&r->ships, sh);
u->ship = sh;
fset(u, UFL_OWNER);
}

View File

@ -178,6 +178,7 @@ new_ship(const ship_type * stype, const struct locale * lang, region * r)
set_string(&sh->name, buffer);
set_string(&sh->display, "");
shash(sh);
addlist(&r->ships, sh);
return sh;
}

View File

@ -82,7 +82,6 @@ xe_giveballon(unit *u, struct order *ord)
sh = new_ship(st_find("balloon"), u2->faction->locale, u2->region);
sh->size = 5;
set_string(&sh->name,"Xontormia-Ballon");
addlist(&u2->region->ships, sh);
leave(u2->region, u2);
u2->ship = sh;
fset(u2, UFL_OWNER);

View File

@ -73,7 +73,7 @@
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG"
PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"

View File

@ -22,7 +22,7 @@
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../util,../kernel,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG"
PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"

View File

@ -126,7 +126,7 @@
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG"
PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"

View File

@ -149,6 +149,7 @@
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
PreprocessorDefinitions="_CONSOLE,WIN32"
StringPooling="TRUE"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
DisableLanguageExtensions="FALSE"

View File

@ -531,8 +531,6 @@ NeuesSchiff(region * r)
wrefresh(win);
s = new_ship(stype[q], default_locale, r);
/* Ist das richtig so, Henning? */
addlist(&r->ships, s);
s->region = r;
strcpy(buf, my_input(win, 2, 2, "Name: ", NULL));

View File

@ -61,7 +61,6 @@ SpecialFunctionUnit(unit *u)
case 'B':
{
ship *sh = new_ship(st_find("balloon"), u->faction->locale, u->region);
addlist(&u->region->ships, sh);
set_string(&sh->name, "Ballon");
set_string(&sh->display, "Eine große leuchtendrote Werbeaufschrift "
"für den Xontormia Express prangt auf einer Seite des Luftgefährts.");

View File

@ -2,6 +2,7 @@ function mkunit(f, r, num)
u = add_unit(f, r)
u.number = num
u:add_item("money", num*10)
u:clear_orders()
return u
end
@ -11,8 +12,8 @@ function test_movement()
-- im westen ohne strassen
ocean = terraform(-3, 0, "ocean")
terraform(-2, 0, "plain")
terraform(-1, 0, "plain")
w2 = terraform(-2, 0, "plain")
w1 = terraform(-1, 0, "plain")
-- im osten mit strassen
r0 = terraform(0, 0, "plain")
@ -30,33 +31,64 @@ function test_movement()
r3:set_road(east, 1.0)
r4:set_road(west, 1.0)
orcs = add_faction("enno@eressea.de", "orc", "de")
orcs = add_faction("orcs@eressea.de", "orc", "de")
orcs.age = 20
bugs = add_faction("enno@eressea.de", "insect", "de")
aqua = add_faction("aqua@eressea.de", "aquarian", "de")
aqua.age = 20
bugs = add_faction("bugz@eressea.de", "insect", "de")
bugs.age = 20
orc = mkunit(orcs, r0, 10)
orc:add_item("horse", orc.number*3)
orc:set_skill("sk_riding", 10)
-- schiffe zum abtreiben:
ships = {}
for i = 1, 100 do
ships[i] = add_ship("boat", ocean)
end
foot = mkunit(orcs, r0, 1)
ship = add_ship("boat", r0)
sail = mkunit(orcs, r0, 1)
sail.ship = ship
bug = mkunit(bugs, r0, 1)
sail:clear_orders()
sail:add_order("NACH O")
sail:add_order("NUMMER EINHEIT saiL")
foot:clear_orders()
foot:add_order("ROUTE W W")
foot:add_order("NUMMER EINHEIT foot")
orc:clear_orders()
watch = mkunit(orcs, w2, 1)
ship = add_ship("boat", ocean)
cptn = mkunit(aqua, ocean, 1)
cptn.ship = ship
cptn:add_order("NACH O")
cptn:add_order("NUMMER EINHEIT cptn")
cptn:add_order("BENENNE EINHEIT Landungsleiter")
cptn:add_order("BENENNE PARTEI Meermenschen")
swim = mkunit(aqua, ocean, 1)
swim.ship = ship
swim:add_order("NACH O")
swim:add_order("NUMMER EINHEIT swim")
swim:add_order("BENENNE EINHEIT Landungstruppe")
-- ein schiff im landesinneren
ship = add_ship("boat", r0)
sail = mkunit(aqua, r0, 1)
sail.ship = ship
crew = mkunit(aqua, r0, 1)
crew.ship = ship
bug = mkunit(bugs, r0, 1)
crew:add_order("NACH O")
crew:add_order("NUMMER EINHEIT crew")
crew:add_order("BENENNE EINHEIT Aussteiger")
crew:add_order("NUMMER PARTEI aqua")
sail:add_order("NACH O")
sail:add_order("NUMMER EINHEIT saiL")
sail:add_order("BENENNE EINHEIT Aussteiger")
orc:add_order("NUMMER PARTEI orcs")
orc:add_order("NUMMER EINHEIT orc")
orc:add_order("BENENNE EINHEIT Orks")
@ -65,7 +97,6 @@ function test_movement()
orc:add_order("GIB 0 ALLES Holz")
orc:add_order("TRANSPORTIEREN " .. itoa36(bug.id))
bug:clear_orders()
bug:add_order("NUMMER PARTEI bugs")
bug:add_order("NUMMER EINHEIT bug")
bug:add_order("BENENNE EINHEIT Käfer")
@ -355,3 +386,25 @@ run_scripts()
process_orders()
write_reports()
if swim.region==ocean then
print "ERROR: Meermenschen können nicht anschwimmen"
end
if sail.region~=r0 then
print "ERROR: Kapitän kann Schiff mit NACH ohne VERLASSE verlassen"
end
if crew.region==r0 then
print "ERROR: Einheiten kann Schiff nicht mit NACH ohne VERLASSE verlassen"
end
drift = false
for i = 1, 100 do
if ships[i].region ~= ocean then
drift = true
break
end
end
if not drift then
print "ERROR: Unbemannte Schiffe treiben nicht ab"
end
if foot.region ~= w1 then
print "ERROR: Fusseinheit hat ihr NACH nicht korrekt ausgeführt"
end