diff --git a/src/common/attributes/attributes.vcproj b/src/common/attributes/attributes.vcproj index 128277be7..68b3a41a4 100644 --- a/src/common/attributes/attributes.vcproj +++ b/src/common/attributes/attributes.vcproj @@ -22,7 +22,7 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" + PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" RuntimeLibrary="3" DisableLanguageExtensions="TRUE" diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 7044096a1..c1498a15e 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -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); diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index b008a42ed..c4207dd6d 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -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); } diff --git a/src/common/kernel/ship.c b/src/common/kernel/ship.c index eb40792d1..95c762368 100644 --- a/src/common/kernel/ship.c +++ b/src/common/kernel/ship.c @@ -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; } diff --git a/src/common/modules/xecmd.c b/src/common/modules/xecmd.c index f214508aa..a4f9cea04 100644 --- a/src/common/modules/xecmd.c +++ b/src/common/modules/xecmd.c @@ -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); diff --git a/src/common/spells/spells.vcproj b/src/common/spells/spells.vcproj index 0515a7e71..3503cb2e7 100644 --- a/src/common/spells/spells.vcproj +++ b/src/common/spells/spells.vcproj @@ -73,7 +73,7 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" + PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" RuntimeLibrary="3" DisableLanguageExtensions="TRUE" diff --git a/src/common/triggers/triggers.vcproj b/src/common/triggers/triggers.vcproj index 8e6000f1d..fb86affbd 100644 --- a/src/common/triggers/triggers.vcproj +++ b/src/common/triggers/triggers.vcproj @@ -22,7 +22,7 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../util,../kernel,../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" + PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" RuntimeLibrary="3" DisableLanguageExtensions="TRUE" diff --git a/src/common/util/util.vcproj b/src/common/util/util.vcproj index 3923a911a..bfae99d9c 100644 --- a/src/common/util/util.vcproj +++ b/src/common/util/util.vcproj @@ -126,7 +126,7 @@ Optimization="0" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../..,.." - PreprocessorDefinitions="_WINDOWS,WIN32,_DEBUG" + PreprocessorDefinitions="_WINDOWS,WIN32" BasicRuntimeChecks="0" RuntimeLibrary="3" DisableLanguageExtensions="TRUE" diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index ea19b28a8..cb607499e 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -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" diff --git a/src/mapper/map_modify.c b/src/mapper/map_modify.c index 55e766563..09cc0a717 100644 --- a/src/mapper/map_modify.c +++ b/src/mapper/map_modify.c @@ -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)); diff --git a/src/mapper/map_units.c b/src/mapper/map_units.c index 02179c197..cb72ce647 100644 --- a/src/mapper/map_units.c +++ b/src/mapper/map_units.c @@ -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."); diff --git a/src/scripts/samples.lua b/src/scripts/samples.lua index 049db1482..51d77f792 100644 --- a/src/scripts/samples.lua +++ b/src/scripts/samples.lua @@ -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