From 97dfebbf2b2b4a70c60ba443e4cc3b716b1b627f Mon Sep 17 00:00:00 2001 From: johns <> Date: Fri, 27 Jul 2001 20:03:29 +0000 Subject: [PATCH] Resource hack now works with no GNU C compiler, but still hack. --- src/include/upgrade_structs.h | 65 +++++++++++++++++++++++++++++++++ src/stratagus/script_player.cpp | 4 +- src/unit/script_unittype.cpp | 2 +- 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/include/upgrade_structs.h b/src/include/upgrade_structs.h index d526f9269..3882f1c07 100644 --- a/src/include/upgrade_structs.h +++ b/src/include/upgrade_structs.h @@ -43,15 +43,26 @@ -- Declarations ----------------------------------------------------------------------------*/ +#ifdef __GNUC__ // { + /** ** Default resources for a new player. */ #define DEFAULT_RESOURCES \ ((int[]){ 0, 2000, 1000, 1000, 1000, 1000, 1000 }) +/** +** Default resources for a new player with low resources.. +*/ #define DEFAULT_RESOURCES_LOW \ ((int[]){ 0, 2000, 1000, 1000, 1000, 1000, 1000 }) +/** +** Default resources for a new player with mid resources. +*/ #define DEFAULT_RESOURCES_MEDIUM \ ((int[]){ 0, 5000, 2000, 2000, 2000, 2000, 2000 }) +/** +** Default resources for a new player with high resources. +*/ #define DEFAULT_RESOURCES_HIGH \ ((int[]){ 0, 10000, 5000, 5000, 5000, 5000, 5000 }) @@ -73,6 +84,60 @@ #define DEFAULT_NAMES \ ((char*[]){"time","gold","wood","oil","ore","stone","coal"}) +#else // }{ __GNUC__ + +/** +** Default resources for a new player. +*/ +static const int DEFAULT_RESOURCES[7] = { + 0, 2000, 1000, 1000, 1000, 1000, 1000 +}; + +/** +** Default resources for a new player with low resources.. +*/ +static const int DEFAULT_RESOURCES_LOW[7] = { + 0, 2000, 1000, 1000, 1000, 1000, 1000 +}; + +/** +** Default resources for a new player with mid resources. +*/ +static const int DEFAULT_RESOURCES_MEDIUM[7] = { + 0, 5000, 2000, 2000, 2000, 2000, 2000 +}; + +/** +** Default resources for a new player with high resources. +*/ +static const int DEFAULT_RESOURCES_HIGH[7] = { + 0, 10000, 5000, 5000, 5000, 5000, 5000 +}; + +/** +** Default incomes for a new player. +*/ +static const int DEFAULT_INCOMES[7] = { + 0, 100, 100, 100, 100, 100, 100 +}; + +/** +** Default action for the resources. +*/ +static const char* DEFAULT_ACTIONS[7] __attribute__((unused)) = { + "stop","mine","chop","drill","mine","mine","mine" +}; + + +/** +** Default names for the resources. +*/ +static const char* DEFAULT_NAMES[7] __attribute__((unused)) = { + "time","gold","wood","oil","ore","stone","coal" +}; + +#endif // } __GNUC__ + /** ** Indices into costs/resource/income array. (A litte future here :) */ diff --git a/src/stratagus/script_player.cpp b/src/stratagus/script_player.cpp index 1f1a19ffd..dcf6a5238 100644 --- a/src/stratagus/script_player.cpp +++ b/src/stratagus/script_player.cpp @@ -171,7 +171,7 @@ local SCM CclPlayer(SCM list) sublist=gh_cdr(sublist); for( i=0; i<MaxCosts; ++i ) { - if( gh_eq_p(value,gh_symbol2scm(DEFAULT_NAMES[i])) ) { + if( gh_eq_p(value,gh_symbol2scm((char*)DEFAULT_NAMES[i])) ) { player->Resources[i]=gh_scm2int(gh_car(sublist)); break; } @@ -191,7 +191,7 @@ local SCM CclPlayer(SCM list) sublist=gh_cdr(sublist); for( i=0; i<MaxCosts; ++i ) { - if( gh_eq_p(value,gh_symbol2scm(DEFAULT_NAMES[i])) ) { + if( gh_eq_p(value,gh_symbol2scm((char*)DEFAULT_NAMES[i])) ) { player->Incomes[i]=gh_scm2int(gh_car(sublist)); break; } diff --git a/src/unit/script_unittype.cpp b/src/unit/script_unittype.cpp index 4913f9023..d1af957d0 100644 --- a/src/unit/script_unittype.cpp +++ b/src/unit/script_unittype.cpp @@ -683,7 +683,7 @@ local SCM CclDefineUnitStats(SCM list) sublist=gh_cdr(sublist); for( i=0; i<MaxCosts; ++i ) { - if( gh_eq_p(value,gh_symbol2scm(DEFAULT_NAMES[i])) ) { + if( gh_eq_p(value,gh_symbol2scm((char*)DEFAULT_NAMES[i])) ) { stats->Costs[i]=gh_scm2int(gh_car(sublist)); break; }