From 198f2cf90f00b5c24a1503c63026af67de3cd307 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 9 May 2005 22:30:43 +0000 Subject: [PATCH] Das mit dem neuen Befehls-handling zieht Kreise. --- src/common/attributes/attributes.vcproj | 3 ++- src/common/gamecode/gamecode.vcproj | 3 ++- src/common/gamecode/laws.c | 7 +++---- src/common/gamecode/monster.c | 6 ++---- src/common/gamecode/study.c | 2 +- src/common/items/items.vcproj | 3 ++- src/common/kernel/build.c | 4 ++-- src/common/kernel/kernel.vcproj | 3 ++- src/common/kernel/movement.c | 3 +-- src/common/kernel/order.c | 3 ++- src/common/kernel/save.c | 1 - src/common/modules/modules.vcproj | 3 ++- src/common/races/races.vcproj | 3 ++- src/common/spells/spells.vcproj | 3 ++- src/common/triggers/triggers.vcproj | 3 ++- src/common/util/util.vcproj | 3 ++- src/eressea/eressea-lua.vcproj | 3 ++- src/eressea/eressea.vcproj | 3 ++- src/mapper/mapper.vcproj | 3 ++- 19 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/common/attributes/attributes.vcproj b/src/common/attributes/attributes.vcproj index da9a2afcd..e557dbb0d 100644 --- a/src/common/attributes/attributes.vcproj +++ b/src/common/attributes/attributes.vcproj @@ -23,8 +23,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/gamecode/gamecode.vcproj b/src/common/gamecode/gamecode.vcproj index 7fd0e6863..210592266 100644 --- a/src/common/gamecode/gamecode.vcproj +++ b/src/common/gamecode/gamecode.vcproj @@ -128,8 +128,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index d98cd6861..c375eed2e 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3465,7 +3465,7 @@ setdefaults (void) if (idle(u->faction)) { set_order(&u->thisorder, default_order(u->faction->locale)); } else { - set_order(&u->thisorder, ord); + set_order(&u->thisorder, copy_order(ord)); } break; } else { @@ -3489,7 +3489,7 @@ setdefaults (void) break; case K_WEREWOLF: - set_order(&u->thisorder, ord); + set_order(&u->thisorder, copy_order(ord)); break; /* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen @@ -3525,7 +3525,7 @@ setdefaults (void) break; default: - set_order(&u->lastorder, u->thisorder); + set_order(&u->lastorder, copy_order(u->thisorder)); } #endif } @@ -3667,7 +3667,6 @@ defaultorders (void) cmd = strdup(getstrtoken()); set_order(&u->lastorder, parse_order(cmd, u->faction->locale)); free(cmd); - free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */ *ordp = ord->next; ord->next = NULL; free_order(ord); diff --git a/src/common/gamecode/monster.c b/src/common/gamecode/monster.c index 47aba2dbc..dbd8704b0 100644 --- a/src/common/gamecode/monster.c +++ b/src/common/gamecode/monster.c @@ -783,7 +783,6 @@ recruit_dracoids(unit * dragon, int size) new_order = parse_order(buf, default_locale); #ifdef LASTORDER set_order(&un->lastorder, new_order); - free_order(new_order); #else addlist(&un->orders, new_order); #endif @@ -974,10 +973,9 @@ plan_monsters(void) break; } if (long_order) { - set_order(&u->thisorder, long_order); + set_order(&u->thisorder, copy_order(long_order)); #ifdef LASTORDER - set_order(&u->lastorder, long_order); - free_order(new_order); /* parse_order & set_order have both increased the refcount */ + set_order(&u->lastorder, copy_order(long_order)); #else addlist(&u->orders, long_order); #endif diff --git a/src/common/gamecode/study.c b/src/common/gamecode/study.c index 1c73985bd..8e7e9a59a 100644 --- a/src/common/gamecode/study.c +++ b/src/common/gamecode/study.c @@ -428,8 +428,8 @@ teach(unit * u, struct order * ord) set_order(&u->lastorder, new_order); #else replace_order(ord, new_order); -#endif free_order(new_order); /* parse_order & set_order have each increased the refcount */ +#endif } if (academy && sk!=NOSKILL) { academy = academy/30; /* anzahl gelehrter wochen, max. 10 */ diff --git a/src/common/items/items.vcproj b/src/common/items/items.vcproj index 6b81136de..68d0e8c18 100644 --- a/src/common/items/items.vcproj +++ b/src/common/items/items.vcproj @@ -74,8 +74,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 5cc6b99e4..f95ea8a3c 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -933,8 +933,8 @@ build_building(unit * u, const building_type * btype, int want, order * ord) set_order(&u->lastorder, new_order); #else replace_order(ord, new_order); -#endif free_order(new_order); +#endif b->size += built; update_lighthouse(b); @@ -1026,8 +1026,8 @@ create_ship(region * r, unit * u, const struct ship_type * newtype, int want, or set_order(&u->lastorder, new_order); #else replace_order(ord, new_order); -#endif free_order(new_order); +#endif build_ship(u, sh, want); } diff --git a/src/common/kernel/kernel.vcproj b/src/common/kernel/kernel.vcproj index eff2bfdf9..1b26fed6b 100644 --- a/src/common/kernel/kernel.vcproj +++ b/src/common/kernel/kernel.vcproj @@ -75,8 +75,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index e98d85c82..9b83bd4f0 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -915,8 +915,8 @@ cycle_route(order * ord, unit *u, int gereist) set_order(&u->lastorder, norder); #else replace_order(ord, norder); -#endif free_order(norder); +#endif } static boolean @@ -2067,7 +2067,6 @@ piracy_cmd(unit *u, struct order * ord) sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_MOVE]), locale_string(u->faction->locale, directions[target_dir])); set_order(&u->thisorder, parse_order(buf, u->faction->locale)); - free_order(u->thisorder); /* parse_order & set_order have each increased the refcount */ /* Bewegung ausführen */ init_tokens(u->thisorder); diff --git a/src/common/kernel/order.c b/src/common/kernel/order.c index d4cd3ae74..8f4c58dbe 100644 --- a/src/common/kernel/order.c +++ b/src/common/kernel/order.c @@ -98,6 +98,7 @@ void free_order(order * ord) { if (ord!=NULL) { + assert(ord->next==0); release_data(ord->data); free(ord); } @@ -122,7 +123,7 @@ set_order(struct order ** destp, struct order * src) { if (*destp==src) return; free_order(*destp); - *destp = copy_order(src); + *destp = src; } void diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 8d74ec884..55bf7be61 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1133,7 +1133,6 @@ readunit(FILE * F) if (ord!=NULL) { #ifdef LASTORDER set_order(&u->lastorder, ord); - free_order(ord); #else addlist(&u->orders, ord); #endif diff --git a/src/common/modules/modules.vcproj b/src/common/modules/modules.vcproj index 4329128c4..76a8d0b02 100644 --- a/src/common/modules/modules.vcproj +++ b/src/common/modules/modules.vcproj @@ -23,8 +23,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/races/races.vcproj b/src/common/races/races.vcproj index 4bb6cb9b7..24f0bdd09 100644 --- a/src/common/races/races.vcproj +++ b/src/common/races/races.vcproj @@ -23,8 +23,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/spells/spells.vcproj b/src/common/spells/spells.vcproj index 10aceae66..4e4a365f3 100644 --- a/src/common/spells/spells.vcproj +++ b/src/common/spells/spells.vcproj @@ -74,8 +74,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../kernel,../util,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/triggers/triggers.vcproj b/src/common/triggers/triggers.vcproj index f6ea99dc3..a350a7836 100644 --- a/src/common/triggers/triggers.vcproj +++ b/src/common/triggers/triggers.vcproj @@ -23,8 +23,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../util,../kernel,../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/common/util/util.vcproj b/src/common/util/util.vcproj index de7317c46..b4cac96d9 100644 --- a/src/common/util/util.vcproj +++ b/src/common/util/util.vcproj @@ -127,8 +127,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../..,.." PreprocessorDefinitions="_WINDOWS,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj index 4bc967da6..b0efd7fe3 100644 --- a/src/eressea/eressea-lua.vcproj +++ b/src/eressea/eressea-lua.vcproj @@ -152,8 +152,9 @@ AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="_CONSOLE,WIN32" StringPooling="TRUE" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="FALSE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/eressea/eressea.vcproj b/src/eressea/eressea.vcproj index e6239fd5b..c560f5f50 100644 --- a/src/eressea/eressea.vcproj +++ b/src/eressea/eressea.vcproj @@ -151,8 +151,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="_CONSOLE,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="FALSE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h" diff --git a/src/mapper/mapper.vcproj b/src/mapper/mapper.vcproj index c5f209372..25a7b281c 100644 --- a/src/mapper/mapper.vcproj +++ b/src/mapper/mapper.vcproj @@ -86,8 +86,9 @@ ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." PreprocessorDefinitions="_CONSOLE,WIN32" - BasicRuntimeChecks="0" + BasicRuntimeChecks="3" RuntimeLibrary="3" + BufferSecurityCheck="TRUE" DisableLanguageExtensions="TRUE" UsePrecompiledHeader="0" PrecompiledHeaderThrough="stdafx.h"