Das mit dem neuen Befehls-handling zieht Kreise.

This commit is contained in:
Enno Rehling 2005-05-09 22:30:43 +00:00
parent d7816c7b2d
commit 198f2cf90f
19 changed files with 35 additions and 27 deletions

View File

@ -23,8 +23,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -128,8 +128,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -3465,7 +3465,7 @@ setdefaults (void)
if (idle(u->faction)) { if (idle(u->faction)) {
set_order(&u->thisorder, default_order(u->faction->locale)); set_order(&u->thisorder, default_order(u->faction->locale));
} else { } else {
set_order(&u->thisorder, ord); set_order(&u->thisorder, copy_order(ord));
} }
break; break;
} else { } else {
@ -3489,7 +3489,7 @@ setdefaults (void)
break; break;
case K_WEREWOLF: case K_WEREWOLF:
set_order(&u->thisorder, ord); set_order(&u->thisorder, copy_order(ord));
break; break;
/* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen /* Wird je diese Ausschliesslichkeit aufgehoben, muss man aufpassen
@ -3525,7 +3525,7 @@ setdefaults (void)
break; break;
default: default:
set_order(&u->lastorder, u->thisorder); set_order(&u->lastorder, copy_order(u->thisorder));
} }
#endif #endif
} }
@ -3667,7 +3667,6 @@ defaultorders (void)
cmd = strdup(getstrtoken()); cmd = strdup(getstrtoken());
set_order(&u->lastorder, parse_order(cmd, u->faction->locale)); set_order(&u->lastorder, parse_order(cmd, u->faction->locale));
free(cmd); free(cmd);
free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */
*ordp = ord->next; *ordp = ord->next;
ord->next = NULL; ord->next = NULL;
free_order(ord); free_order(ord);

View File

@ -783,7 +783,6 @@ recruit_dracoids(unit * dragon, int size)
new_order = parse_order(buf, default_locale); new_order = parse_order(buf, default_locale);
#ifdef LASTORDER #ifdef LASTORDER
set_order(&un->lastorder, new_order); set_order(&un->lastorder, new_order);
free_order(new_order);
#else #else
addlist(&un->orders, new_order); addlist(&un->orders, new_order);
#endif #endif
@ -974,10 +973,9 @@ plan_monsters(void)
break; break;
} }
if (long_order) { if (long_order) {
set_order(&u->thisorder, long_order); set_order(&u->thisorder, copy_order(long_order));
#ifdef LASTORDER #ifdef LASTORDER
set_order(&u->lastorder, long_order); set_order(&u->lastorder, copy_order(long_order));
free_order(new_order); /* parse_order & set_order have both increased the refcount */
#else #else
addlist(&u->orders, long_order); addlist(&u->orders, long_order);
#endif #endif

View File

@ -428,8 +428,8 @@ teach(unit * u, struct order * ord)
set_order(&u->lastorder, new_order); set_order(&u->lastorder, new_order);
#else #else
replace_order(ord, new_order); replace_order(ord, new_order);
#endif
free_order(new_order); /* parse_order & set_order have each increased the refcount */ free_order(new_order); /* parse_order & set_order have each increased the refcount */
#endif
} }
if (academy && sk!=NOSKILL) { if (academy && sk!=NOSKILL) {
academy = academy/30; /* anzahl gelehrter wochen, max. 10 */ academy = academy/30; /* anzahl gelehrter wochen, max. 10 */

View File

@ -74,8 +74,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -933,8 +933,8 @@ build_building(unit * u, const building_type * btype, int want, order * ord)
set_order(&u->lastorder, new_order); set_order(&u->lastorder, new_order);
#else #else
replace_order(ord, new_order); replace_order(ord, new_order);
#endif
free_order(new_order); free_order(new_order);
#endif
b->size += built; b->size += built;
update_lighthouse(b); 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); set_order(&u->lastorder, new_order);
#else #else
replace_order(ord, new_order); replace_order(ord, new_order);
#endif
free_order(new_order); free_order(new_order);
#endif
build_ship(u, sh, want); build_ship(u, sh, want);
} }

View File

@ -75,8 +75,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../util,../..,.." AdditionalIncludeDirectories="../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -915,8 +915,8 @@ cycle_route(order * ord, unit *u, int gereist)
set_order(&u->lastorder, norder); set_order(&u->lastorder, norder);
#else #else
replace_order(ord, norder); replace_order(ord, norder);
#endif
free_order(norder); free_order(norder);
#endif
} }
static boolean 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]), sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_MOVE]),
locale_string(u->faction->locale, directions[target_dir])); locale_string(u->faction->locale, directions[target_dir]));
set_order(&u->thisorder, parse_order(buf, u->faction->locale)); 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 */ /* Bewegung ausführen */
init_tokens(u->thisorder); init_tokens(u->thisorder);

View File

@ -98,6 +98,7 @@ void
free_order(order * ord) free_order(order * ord)
{ {
if (ord!=NULL) { if (ord!=NULL) {
assert(ord->next==0);
release_data(ord->data); release_data(ord->data);
free(ord); free(ord);
} }
@ -122,7 +123,7 @@ set_order(struct order ** destp, struct order * src)
{ {
if (*destp==src) return; if (*destp==src) return;
free_order(*destp); free_order(*destp);
*destp = copy_order(src); *destp = src;
} }
void void

View File

@ -1133,7 +1133,6 @@ readunit(FILE * F)
if (ord!=NULL) { if (ord!=NULL) {
#ifdef LASTORDER #ifdef LASTORDER
set_order(&u->lastorder, ord); set_order(&u->lastorder, ord);
free_order(ord);
#else #else
addlist(&u->orders, ord); addlist(&u->orders, ord);
#endif #endif

View File

@ -23,8 +23,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -23,8 +23,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -74,8 +74,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../kernel,../util,../..,.." AdditionalIncludeDirectories="../kernel,../util,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -23,8 +23,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../util,../kernel,../..,.." AdditionalIncludeDirectories="../util,../kernel,../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -127,8 +127,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../..,.." AdditionalIncludeDirectories="../..,.."
PreprocessorDefinitions="_WINDOWS,WIN32" PreprocessorDefinitions="_WINDOWS,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -152,8 +152,9 @@
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
PreprocessorDefinitions="_CONSOLE,WIN32" PreprocessorDefinitions="_CONSOLE,WIN32"
StringPooling="TRUE" StringPooling="TRUE"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="FALSE" DisableLanguageExtensions="FALSE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -151,8 +151,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
PreprocessorDefinitions="_CONSOLE,WIN32" PreprocessorDefinitions="_CONSOLE,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="FALSE" DisableLanguageExtensions="FALSE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"

View File

@ -86,8 +86,9 @@
ImproveFloatingPointConsistency="TRUE" ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.." AdditionalIncludeDirectories="../common/kernel,../common/gamecode,../common/util,../common,.."
PreprocessorDefinitions="_CONSOLE,WIN32" PreprocessorDefinitions="_CONSOLE,WIN32"
BasicRuntimeChecks="0" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
DisableLanguageExtensions="TRUE" DisableLanguageExtensions="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="stdafx.h" PrecompiledHeaderThrough="stdafx.h"