defines für die spiele in settings-file ausgelagert.

code angepasst.
einheitenlimit in xml datei.
achtung: nach dem update muss eine settings.h datei angelegt werden.
This commit is contained in:
Enno Rehling 2001-12-15 12:26:04 +00:00
parent 9e183e4393
commit a44a17585d
37 changed files with 232 additions and 180 deletions

View file

@ -36,9 +36,7 @@
#ifdef AT_OPTION
# include "option.h"
#endif
#ifdef AT_MOVED
# include "moved.h"
#endif
#include "moved.h"
/* util includes */
#include <attrib.h>
@ -65,9 +63,7 @@ init_attributes(void)
init_racename();
init_synonym();
#ifdef AT_MOVED
init_moved();
#endif
#ifdef AT_OPTION
init_option();
#endif

View file

@ -1014,7 +1014,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
fprintf(F, "\"%s\";Beschr\n", r->display);
#endif
if (landregion(rterrain(r))) {
#ifdef GROWING_TREES
#if GROWING_TREES
int trees = rtrees(r,2);
int ytrees = rtrees(r,1);
# ifdef RESOURCECOMPAT
@ -1050,7 +1050,7 @@ report_computer(FILE * F, faction * f, const seen_region * seen,
if (seemode>=see_unit) {
struct demand * dmd = r->land->demands;
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
struct rawmaterial * res = r->resources;
fprintf(F, "%d;Silber\n", rmoney(r));

View file

@ -73,7 +73,9 @@
#include <attributes/racename.h>
#include <attributes/orcification.h>
#include <items/seed.h>
#if GROWING_TREES
# include <items/seed.h>
#endif
/* - static global symbols ------------------------------------- */
typedef struct spende {
@ -1606,7 +1608,7 @@ enum {
AFL_DONE = 1<<0,
AFL_LOWSKILL = 1<<1
};
#ifdef NEW_RESOURCEGROWTH
static int
required(int want, double save)
{
@ -1615,6 +1617,7 @@ required(int want, double save)
return norders;
}
#if NEW_RESOURCEGROWTH
static void
leveled_allocation(const allocator * self, region * r, allocation * alist)
{
@ -1737,7 +1740,7 @@ split_allocations(region * r)
i_change(&al->unit->items, itype, al->get);
change_skill(al->unit, itype->construction->skill,
al->unit->number * PRODUCEEXP);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
fset(r, RF_DH);
#endif
}
@ -2507,7 +2510,7 @@ plant(region *r, unit *u, int raw)
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, htype->itype->rtype));
}
#ifdef GROWING_TREES
#if GROWING_TREES
void
planttrees(region *r, unit *u, int raw)
{
@ -2589,21 +2592,21 @@ pflanze(region *r, unit *u)
plant(r, u, m);
return;
}
#if GROWING_TREES
else if (p==P_TREES){
planttrees(r, u, m);
return;
}
else if (itype!=NULL){
#ifdef GROWING_TREES
if (itype==&it_mallornseed || itype==&it_seed){
planttrees(r, u, m);
return;
}
#endif
}
#endif
}
#ifdef GROWING_TREES
#if GROWING_TREES
/* züchte bäume */
void
@ -2725,9 +2728,11 @@ zuechte(region *r, unit *u)
case P_HERBS:
plant(r, u, m);
return;
#if GROWING_TREES
case P_TREES:
breedtrees(r, u, m);
return;
#endif
default:
breedhorses(r, u);
return;
@ -3260,7 +3265,7 @@ produce(void)
zuechte(r, u);
break;
#ifdef GROWING_TREES
#if GROWING_TREES
case K_PFLANZE:
planttrees(r, u, INT_MAX);
break;
@ -3309,11 +3314,11 @@ init_economy(void)
add_allocator(make_allocator(item2resource(olditemtype[I_HORSE]), attrib_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_WOOD]), attrib_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_MALLORN]), attrib_allocation));
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
add_allocator(make_allocator(item2resource(olditemtype[I_STONE]), leveled_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_IRON]), leveled_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_LAEN]), leveled_allocation));
#ifdef GROWING_TREES
#if GROWING_TREES
add_allocator(make_allocator(&rt_seed, attrib_allocation));
add_allocator(make_allocator(&rt_mallornseed, attrib_allocation));
#endif

View file

@ -579,7 +579,7 @@ migrate(region * r)
* das hatte ich geändert. jemand hat es wieder gelöscht, toll.
* ich habe es wieder aktiviert, muß getestet werden.
*/
#ifndef GROWING_TREES
#if GROWING_TREES == 0
rsettrees(r, rtrees(r) + m->trees);
#endif
*hp = m->next;
@ -643,7 +643,7 @@ horses(region * r)
assert(rhorses(r) >= 0);
}
#ifdef GROWING_TREES
#if GROWING_TREES
static int
count_race(const region *r, const race *rc)
@ -878,7 +878,7 @@ trees(region * r)
}
#endif
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
extern attrib_type at_laen;
static void
iron(region * r)
@ -909,7 +909,7 @@ void
demographics(void)
{
region *r;
#ifdef GROWING_TREES
#if GROWING_TREES
int current_season = season(turn);
int last_weeks_season = season(turn-1);
#endif
@ -956,17 +956,17 @@ demographics(void)
r->age++;
horses(r);
#ifdef GROWING_TREES
#if GROWING_TREES
if(current_season != SEASON_WINTER) {
trees(r, current_season, last_weeks_season);
}
#else
trees(r);
#endif
#ifndef NEW_RESOURCEGROWTH
iron(r);
#else
#if NEW_RESOURCEGROWTH
update_resources(r);
#else
iron(r);
#endif
migrate(r);
}
@ -2859,7 +2859,7 @@ ageing(void)
static int
maxunits(faction *f)
{
return MAXUNITS + 400 * fspecial(f, FS_ADMINISTRATOR);
return (int) (global.maxunits * (1 + 0.4 * fspecial(f, FS_ADMINISTRATOR)));
}
static void
@ -2981,7 +2981,9 @@ setdefaults (void)
case K_TAX:
case K_TEACH:
case K_ZUECHTE:
#if GROWING_TREES
case K_PFLANZE:
#endif
case K_BIETE:
case K_PIRACY:
if (idle (u->faction)) {

View file

@ -42,7 +42,7 @@ extern void sinkships(void);
void processorders(void);
extern int count_migrants (const struct faction * f);
#ifdef GROWING_TREES
#if GROWING_TREES
extern attrib_type at_germs;
#endif

View file

@ -125,7 +125,7 @@ dissolve_units(void)
break;
case 2:
if(r->land) {
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) + n);
#else
rsettrees(r, rtrees(r) + n);
@ -733,7 +733,7 @@ volcano_outbreak(region *r)
/* Vulkan-Region verwüsten */
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, 0);
rsettrees(r, 1, 0);
rsettrees(r, 0, 0);
@ -777,7 +777,7 @@ volcano_outbreak(region *r)
if (rn) {
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, 0);
rsettrees(r, 1, 0);
rsettrees(r, 0, 0);
@ -1205,7 +1205,7 @@ randomevents(void)
* bekommen. */
if (r->land && !fval(r, RF_MALLORN)) {
#ifdef GROWING_TREES
#if GROWING_TREES
int trees = rtrees(r,2);
#else
int trees = rtrees(r);
@ -1221,7 +1221,7 @@ randomevents(void)
}
}
}
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, trees);
#else
rsettrees(r, trees);
@ -1479,7 +1479,7 @@ randomevents(void)
for (r = regions; r; r = r->next) {
if (fval(r, RF_CHAOTIC) ||(r->x >= -13 && r->x <= -6 && r->y >= 50 && r->y <= 57)) {
if (woodcount(r) >= 40 && rand()%100 < 33) {
#ifdef GROWING_TREES
#if GROWING_TREES
int trees = rtrees(r,2);
#else
int trees = rtrees(r);
@ -1490,7 +1490,7 @@ randomevents(void)
treemen = max(25, treemen);
woodcounts(r, -40);
trees = max(0, trees-treemen);
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, trees);
#else
rsettrees(r, trees);

View file

@ -988,7 +988,7 @@ describe(FILE * F, region * r, int partial, faction * f)
boolean dh;
direction_t d;
int trees;
#ifdef GROWING_TREES
#if GROWING_TREES
int ytrees;
#endif
attrib *a;
@ -1059,7 +1059,7 @@ describe(FILE * F, region * r, int partial, faction * f)
/* Bäume */
#ifdef GROWING_TREES
#if GROWING_TREES
trees = rtrees(r,2);
ytrees = rtrees(r,1);
if (production(r)) {
@ -1101,7 +1101,7 @@ describe(FILE * F, region * r, int partial, faction * f)
#endif
/* Eisen */
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
if (partial == 0 && f != (faction *) NULL) {
struct rawmaterial * res;
for (res=r->resources;res;res=res->next) {

View file

@ -18,7 +18,9 @@
#include "demonseye.h"
#include "weapons.h"
#include "xerewards.h"
#include "seed.h"
#if GROWING_TREES
# include "seed.h"
#endif
#include "birthday_firework.h"
void
@ -28,8 +30,10 @@ register_items(void)
register_demonseye();
init_lmsreward();
register_xerewards();
#if GROWING_TREES
init_seed();
init_mallornseed();
#endif
register_birthday_firework();
register_lebkuchenherz();
}

View file

@ -1,25 +1,24 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <config.h>
#include <eressea.h>
#include <build.h>
#include <region.h>
#if GROWING_TREES
#include "seed.h"
#ifdef GROWING_TREES
#include <build.h>
#include <region.h>
/* kernel includes */
#include <item.h>

View file

@ -12,6 +12,7 @@
* prior permission by the authors of Eressea.
*/
#if GROWING_TREES
extern struct item_type it_seed;
extern struct resource_type rt_seed;
extern void init_seed(void);
@ -19,3 +20,6 @@ extern void init_seed(void);
extern struct item_type it_mallornseed;
extern struct resource_type rt_mallornseed;
extern void init_mallornseed(void);
#else
#error seed.h should not be included when building with GROWING_TREES==0
#endif

View file

@ -114,7 +114,7 @@ use_potion(unit * u, const item_type * itype, const char * cmd)
holz = new_use_pooled(u, oldresourcetype[R_WOOD],
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10);
}
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 1, rtrees(r, 1) + holz);
#else
rsettrees(r, rtrees(r) + holz);

View file

@ -66,9 +66,7 @@ typedef enum combatmagic {
#include <attributes/key.h>
#include <attributes/racename.h>
#include <attributes/otherfaction.h>
#ifdef AT_MOVED
# include <attributes/moved.h>
#endif
#include <attributes/moved.h>
/* libc includes */
#include <assert.h>
@ -79,10 +77,6 @@ typedef enum combatmagic {
#include <stdlib.h>
#include <string.h>
#if !defined(AT_MOVED) && defined(DELAYED_OFFENSE)
# error "must define AT_MOVED to use combat option DELAYED_OFFENSE"
#endif
#ifdef HAVE_ZLIB
# include <zlib.h>
# define dbgprintf(a) gzprintf a;

View file

@ -30,7 +30,7 @@
enum {
B_SITE,
#ifdef LARGE_CASTLES
#if LARGE_CASTLES
B_TRADEPOST,
#endif
B_FORTIFICATION,

View file

@ -179,7 +179,7 @@ findbuilding(int i)
#ifdef NEW_BUILDINGS
enum {
B_SITE,
#ifdef LARGE_CASTLES
#if LARGE_CASTLES
B_TRADEPOST,
#endif
B_FORTIFICATION,
@ -196,7 +196,7 @@ castle_name(int bsize)
{
const char * fname[MAXBUILDINGS] = {
"site",
#ifdef LARGE_CASTLES
#if LARGE_CASTLES
"tradepost",
#endif
"fortification",
@ -221,7 +221,7 @@ static requirement castle_req[] = {
{ NORESOURCE, 0, 0.0 },
};
#ifdef LARGE_CASTLES
#if LARGE_CASTLES
static const construction castle_bld[MAXBUILDINGS] = {
{ SK_BUILDING, 1, 2, 1, castle_req, &castle_bld[1] },
{ SK_BUILDING, 1, 8, 1, castle_req, &castle_bld[2] },

View file

@ -229,7 +229,7 @@ const char *keywords[MAXKEYWORDS] =
#endif
"PRÄFIX",
"SYNONYM",
#ifdef GROWING_TREES
#if GROWING_TREES
"PFLANZEN",
#endif
};
@ -1732,7 +1732,7 @@ idle (faction * f)
int
maxworkingpeasants(const struct region * r)
{
#ifdef GROWING_TREES
#if GROWING_TREES
int i = production(r) * MAXPEASANTS_PER_AREA
- ((rtrees(r,2)+rtrees(r,1)/2) * TREESIZE);
#else
@ -2096,6 +2096,16 @@ parse_tagbegin(struct xml_stack *stack, void *data)
log_printf("required tag 'file' missing from include");
return XML_USERERROR;
}
} else if (strcmp(tag->name, "game")==0) {
const char * name = xml_value(tag, "name");
int maxunits = xml_ivalue(tag, "units");
if (name!=NULL) {
global.gamename = strdup(name);
}
if (maxunits!=0) {
global.maxunits = maxunits;
}
} else if (strcmp(tag->name, "game")==0) {
} else if (strcmp(tag->name, "order")==0) {
const char * name = xml_value(tag, "name");
if (xml_bvalue(tag, "disable")) {
@ -2304,7 +2314,7 @@ attrib_init(void)
#endif
at_register(&at_jihad);
at_register(&at_skillmod);
#ifdef GROWING_TREES
#if GROWING_TREES
at_register(&at_germs);
#endif
at_register(&at_laen); /* required for old datafiles */

View file

@ -21,19 +21,20 @@
#ifndef ERESSEA_H
#define ERESSEA_H
/* Features currently in development (change makefile please): */
#ifndef MSG_LEVELS
# undef MSG_LEVELS /* msg-levels active */
#endif
/*
* Features enabled:
* If you are lacking the settings.h, create a new file common/settings.h,
* and write #include <settings-eressea.h> (or whatever settings you want
* your game to use) in there.
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
*/
#include <settings.h>
/* Features enabled: */
#define RESOURCE_FIX /* Should be removed soon! */
#define NEW_RESOURCEGROWTH
#define LARGE_CASTLES
#define GROWING_TREES
#define STEALTHFACTION
#define AT_MOVED
#undef RACE_ADJUSTMENTS
/* Features currently in development (change makefile please): */
/* #define MSG_LEVELS -- msg-levels active */
/* #define RACE_ADJUSTMENTS */
/* basic types used in the eressea "kernel" */
typedef unsigned char order_t;
@ -167,7 +168,7 @@ struct xml_stack;
#endif
*/
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
extern void init_resourcefix(void);
extern void read_iron(struct region * r, int iron);
extern void read_laen(struct region * r, int laen);
@ -300,9 +301,6 @@ extern void plagues(struct region * r, boolean ismagic);
/* Schiffsbeschädigungen */
#define SHIPDAMAGE
/* Maximale Einheitenzahl */
#define MAXUNITS 1000
/* regionen im Report der Parteien werden nur einmal berechnet: */
#define FAST_REGION
@ -437,7 +435,7 @@ enum {
#endif
K_PREFIX,
K_SYNONYM,
#ifdef GROWING_TREES
#if GROWING_TREES
K_PFLANZE,
#endif
MAXKEYWORDS,
@ -1170,6 +1168,7 @@ extern const struct race * new_race[];
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
unsigned int maxunits;
struct attrib *attribs;
unsigned int data_version;
boolean disabled[MAXKEYWORDS];

View file

@ -1223,12 +1223,12 @@ limit_oldtypes(const region * r, const resource_type * rtype)
/* TODO: split into seperate functions. really much nicer. */
{
if (rtype==oldresourcetype[R_WOOD]) {
#ifdef GROWING_TREES
#if GROWING_TREES
return rtrees(r,2) + rtrees(r,1);
#else
return rtrees(r);
#endif
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) {
return rlaen(r);
} else if (rtype==oldresourcetype[R_IRON]) {
@ -1237,7 +1237,7 @@ limit_oldtypes(const region * r, const resource_type * rtype)
return terrain[rterrain(r)].quarries;
#endif
} else if (rtype==oldresourcetype[R_MALLORN]) {
#ifdef GROWING_TREES
#if GROWING_TREES
return rtrees(r,2) + rtrees(r,1);
#else
return rtrees(r);
@ -1257,7 +1257,7 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
{
assert(norders>0);
if (rtype==oldresourcetype[R_WOOD] || rtype==oldresourcetype[R_MALLORN]) {
#ifdef GROWING_TREES
#if GROWING_TREES
int avail_grownup = rtrees(r,2);
int avail_young = rtrees(r,1);
int avail = avail_grownup + avail_young;
@ -1284,7 +1284,7 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
rsettrees(r, avail-norders);
woodcounts(r, norders);
#endif
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) {
int avail = rlaen(r);
assert(norders <= avail);

View file

@ -458,9 +458,8 @@ attrib_type at_travelunit = {
NO_READ
};
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
extern int laen_read(attrib * a, FILE * F);
# define LAEN_READ laen_read
# define LAEN_WRITE NULL
#else
@ -555,7 +554,7 @@ rroad(const region * r, direction_t d)
boolean
r_isforest(const region * r)
{
#ifdef GROWING_TREES
#if GROWING_TREES
if (r->terrain==T_PLAIN && rtrees(r,2) + rtrees(r,1) >= 600) return true;
#else
if (r->terrain==T_PLAIN && rtrees(r) >= 600) return true;
@ -647,7 +646,7 @@ rname(const region * r, const locale * lang) {
return locale_string(lang, terrain[rterrain(r)].name);
}
#ifdef GROWING_TREES
#if GROWING_TREES
int
rtrees(const region *r, int ageclass)
{
@ -797,7 +796,7 @@ void
terraform(region * r, terrain_t t)
{
const struct locale * locale_de = find_locale("de");
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
rawmaterial **lrm;
int i;
#endif
@ -805,7 +804,7 @@ terraform(region * r, terrain_t t)
/* defaults: */
rsetterrain(r, t);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
/* Resourcen, die nicht mehr vorkommen können, löschen */
lrm = &r->resources;
while (*lrm) {
@ -822,7 +821,7 @@ terraform(region * r, terrain_t t)
}
#endif
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
rsetlaen(r, -1);
rsetiron(r, 0);
#endif
@ -831,7 +830,7 @@ terraform(region * r, terrain_t t)
freeland(r->land);
r->land = NULL;
}
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 0, 0);
rsettrees(r, 1, 0);
rsettrees(r, 2, 0);
@ -839,7 +838,7 @@ terraform(region * r, terrain_t t)
rsettrees(r, 0);
#endif
rsethorses(r, 0);
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, 0);
rsetlaen(r, -1);
#endif
@ -938,7 +937,7 @@ terraform(region * r, terrain_t t)
case T_PLAIN:
rsethorses(r, rand() % (terrain[t].production_max / 5));
if(rand()%100 < 40) {
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, terrain[t].production_max * (30+rand()%40)/100);
rsettrees(r, 1, rtrees(r, 2)/4);
rsettrees(r, 0, rtrees(r, 2)/2);
@ -948,14 +947,14 @@ terraform(region * r, terrain_t t)
}
break;
case T_MOUNTAIN:
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, IRONSTART);
if (rand() % 100 < 8) rsetlaen(r, 5 + rand() % 5);
#endif
break;
case T_GLACIER:
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
if (riron(r) <= 0){
rsetiron(r, GLIRONSTART);
}
@ -964,7 +963,7 @@ terraform(region * r, terrain_t t)
case T_ICEBERG_SLEEP:
/* Kann aus Gletscher entstehen und sollte diesem gleichen */
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
if (riron(r) <= 0){
rsetiron(r, GLIRONSTART);
}
@ -976,7 +975,7 @@ terraform(region * r, terrain_t t)
break;
}
#ifdef GROWING_TREES
#if GROWING_TREES
/* Initialisierung irgendwann über rm_-Mechamismus machen */
if(t != T_PLAIN && rand()%100 < 20) {
rsettrees(r, 2, terrain[t].production_max * (30 + rand() % 40) / 100);
@ -985,7 +984,7 @@ terraform(region * r, terrain_t t)
}
#endif
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
terraform_resources(r);
#endif

View file

@ -53,7 +53,7 @@ typedef struct land_region {
} * demands;
const struct herb_type * herbtype;
short herbs;
#ifdef GROWING_TREES
#if GROWING_TREES
int trees[3]; /* 0 -> Samen, 1 -> Sprößlinge, 2 -> Bäume */
#else
int trees;
@ -62,7 +62,7 @@ typedef struct land_region {
int peasants;
int newpeasants;
int money;
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
int iron;
#endif
} land_region;
@ -90,7 +90,7 @@ typedef struct region {
#ifdef WEATHER
weather_t weathertype;
#endif
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
struct rawmaterial * resources;
#endif
} region;
@ -159,7 +159,7 @@ void rsetroad(struct region * r, direction_t d, int value);
int is_coastregion(struct region *r);
#ifdef GROWING_TREES
#if GROWING_TREES
int rtrees(const struct region * r, int ageclass);
int rsettrees(const struct region *r, int ageclass, int value);
#else
@ -177,7 +177,7 @@ void rsetmoney(struct region * r, int value);
#define rbuildings(r) ((r)->buildings)
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
#define riron(r) ((r)->land?(r)->land->iron:0)
#define rsetiron(r, value) ((r)->land?((r)->land->iron=(value)):(value),0)

View file

@ -14,7 +14,7 @@
#include "eressea.h"
#include "resources.h"
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
/* kernel includes */
#include "build.h"
#include "item.h"

View file

@ -9,7 +9,8 @@
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#ifdef NEW_RESOURCEGROWTH
#ifndef RESOURCES_H
#if NEW_RESOURCEGROWTH
enum {
RM_USED = 1<<0, /* resource has been used */
@ -56,3 +57,4 @@ extern struct rawmaterial_type rm_iron;
extern struct rawmaterial_type rm_laen;
#endif
#endif

View file

@ -88,7 +88,7 @@ static region * current_region;
int firstx = 0, firsty = 0;
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
int laen_read(attrib * a, FILE * F)
{
int laen;
@ -728,7 +728,7 @@ read_items(FILE *F, item **ilist)
}
}
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
struct attrib_type at_resources = {
"resources", NULL, NULL, NULL, NULL, NULL, ATF_UNIQUE
};
@ -1120,7 +1120,7 @@ readgame(boolean backup)
}
if (global.data_version < MEMSAVE_VERSION || r->land) {
int i;
#ifdef GROWING_TREES
#if GROWING_TREES
if(global.data_version < GROWTREE_VERSION) {
i = ri(F); rsettrees(r, 2, i);
} else {
@ -1132,10 +1132,10 @@ readgame(boolean backup)
i = ri(F); rsettrees(r, i);
#endif
i = ri(F); rsethorses(r, i);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
if (global.data_version < NEWRESOURCE_VERSION) {
i = ri(F);
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
if (i!=0) read_iron(r, i);
#endif
} else {
@ -1192,12 +1192,12 @@ readgame(boolean backup)
rsetherbs(r, (short)ri(F));
} else if (global.data_version<MEMSAVE_VERSION) {
int i = ri(F);
#ifndef NEW_RESOURCEGROWTH
rsetlaen(r, i);
#else
#ifdef RESOURCE_FIX
#if NEW_RESOURCEGROWTH
#if RESOURCE_CONVERSION
if (i!=0) read_laen(r, i);
#endif
#else
rsetlaen(r, i);
#endif
if (ri(F)) fset(r, RF_MALLORN);
if (ri(F)) fset(r, RF_ENCOUNTER);
@ -1934,7 +1934,7 @@ writegame(char *path, char quiet)
struct demand * demand;
ws(F, r->land->name);
wspace(F);
#ifdef GROWING_TREES
#if GROWING_TREES
wi(F, rtrees(r,0));
wspace(F);
wi(F, rtrees(r,1));
@ -1947,7 +1947,7 @@ writegame(char *path, char quiet)
#endif
wi(F, rhorses(r));
wspace(F);
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
wi(F, riron(r));
#elif RELEASE_VERSION>=NEWRESOURCE_VERSION
{

View file

@ -62,7 +62,7 @@ extern int read_faction_reference(struct faction ** f, FILE * F);
extern const char * datapath(void);
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
extern struct attrib_type at_resources;
#endif

View file

@ -920,7 +920,7 @@ sp_summonent(castorder *co)
attrib *a;
int ents;
#ifdef GROWING_TREES
#if GROWING_TREES
if(rtrees(r,2) == 0) {
#else
if(rtrees(r) == 0) {
@ -930,7 +930,7 @@ sp_summonent(castorder *co)
return 0;
}
#ifdef GROWING_TREES
#if GROWING_TREES
ents = min(power*power, rtrees(r,2));
#else
ents = min(power*power, rtrees(r));
@ -944,7 +944,7 @@ sp_summonent(castorder *co)
a_add(&u->attribs, a);
fset(u, FL_LOCKED);
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) - ents);
#else
rsettrees(r, rtrees(r) - ents);
@ -1082,7 +1082,7 @@ sp_mallorn(castorder *co)
}
/* half the trees will die */
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2);
@ -1163,7 +1163,7 @@ sp_hain(castorder *co)
}
trees = lovar(force * 10) + force;
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 1, rtrees(r,1) + trees);
#else
rsettrees(r, rtrees(r) + trees);
@ -1580,7 +1580,7 @@ sp_great_drought(castorder *co)
/* sterben */
rsetpeasants(r, rpeasants(r)/2); /* evtl wuerfeln */
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2);
@ -1613,7 +1613,7 @@ sp_great_drought(castorder *co)
break;
case T_GLACIER:
#ifndef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, 0);
rsetlaen(r, -1);
#endif
@ -2097,7 +2097,7 @@ sp_drought(castorder *co)
c->duration = max(c->duration, power);
} else {
/* Baeume und Pferde sterben */
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2);
@ -2466,7 +2466,7 @@ sp_forest_fire(castorder *co)
unit *u;
region *nr;
int prozent, chance, vernichtet;
#ifdef GROWING_TREES
#if GROWING_TREES
int vernichtet_schoesslinge;
#endif
direction_t i;
@ -2475,7 +2475,7 @@ sp_forest_fire(castorder *co)
int cast_level = co->level;
prozent = (rand() % 71) + 10; /* 10 - 80% */
#ifdef GROWING_TREES
#if GROWING_TREES
vernichtet = rtrees(r,2) * prozent / 100;
vernichtet_schoesslinge = rtrees(r,1) * prozent / 100;
#else
@ -2487,7 +2487,7 @@ sp_forest_fire(castorder *co)
return 0;
}
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) - vernichtet);
rsettrees(r, 1, rtrees(r,1) - vernichtet_schoesslinge);
#else
@ -2510,7 +2510,7 @@ sp_forest_fire(castorder *co)
}
}
if(!fval(mage->faction, FL_DH)){
#ifdef GROWING_TREES
#if GROWING_TREES
sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s "
"den Flammen zum Opfer.", unitname(mage), vernichtet+vernichtet_schoesslinge,
vernichtet+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen");
@ -2527,7 +2527,7 @@ sp_forest_fire(castorder *co)
assert(nr);
vernichtet = 0;
#ifdef GROWING_TREES
#if GROWING_TREES
if(rtrees(nr,2) + rtrees(nr,1) >= 800) {
if((rand() % 100) < chance ) {
vernichtet = rtrees(nr,2) * prozent / 200;

View file

@ -70,7 +70,7 @@ const terraindata_t terrain[] = {
1000, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LARGE_SHIPS|LAND_REGION, /* Flags */
plain_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "2d4-1", "5d8", "2d20+10", 10.0 },
{ &rm_stones, "1d4", "5d8", "2d30+20", 15.0 },
{ &rm_laen, "1d4", "1d4", "2d20+50", 1.0} }
@ -86,7 +86,7 @@ const terraindata_t terrain[] = {
200, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
swamp_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "2d4-1", "5d8", "2d20+10", 2.0 },
{ &rm_stones, "1d4", "5d8", "2d30+20", 2.0 },
{ &rm_laen, "1d4", "1d4", "2d20+50", 2.0} }
@ -102,7 +102,7 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
desert_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "2d4-1", "5d8", "2d20+10", 15.0 },
{ &rm_stones, "1d4", "5d8", "2d30+20", 25.0 },
{ &rm_laen, "1d4", "1d4", "2d20+50", 2.5} }
@ -118,7 +118,7 @@ const terraindata_t terrain[] = {
400, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
highland_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "2d4-1", "5d8", "2d20+10", 15.0 },
{ &rm_stones, "1d4", "5d8", "2d30+20", 20.0 },
{ &rm_laen, "1d4", "1d4", "2d20+50", 2.5} }
@ -134,7 +134,7 @@ const terraindata_t terrain[] = {
100, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
mountain_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 100.0 },
{ &rm_stones, "1", "100", "100", 100.0 },
{ &rm_laen, "1", "4", "100", 5.0} }
@ -150,7 +150,7 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ &rm_laen, "1", "4", "100", 0.5} }
@ -220,7 +220,7 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
NULL,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 50.0 },
{ &rm_stones, "1", "100", "100", 50.0 },
{ &rm_laen, "1", "4", "100", 7.5} }
@ -235,7 +235,7 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
NULL,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 50.0 },
{ &rm_stones, "1", "100", "100", 50.0 },
{ &rm_laen, "1", "4", "100", 7.5} }
@ -251,7 +251,7 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ NULL, NULL, NULL, NULL, 100.0 } }
@ -267,7 +267,7 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ NULL, NULL, NULL, NULL, 100.0 } }

View file

@ -77,7 +77,7 @@ typedef struct terraindata_t {
*/
unsigned int flags;
const char ** herbs;
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
struct {
const struct rawmaterial_type * type;
const char *startlevel;

View file

@ -34,9 +34,7 @@
#include "region.h"
#include "ship.h"
#ifdef AT_MOVED
# include <attributes/moved.h>
#endif
#include <attributes/moved.h>
/* util includes */
#include <resolve.h>
@ -684,9 +682,7 @@ move_unit(unit * u, region * r, unit ** ulist)
if (u->region == r) return;
if (!ulist) ulist = (&r->units);
if (u->region) {
#ifdef AT_MOVED
set_moved(&u->attribs);
#endif
setguard(u, GUARD_NONE);
fset(u, FL_MOVED);
if (u->ship || u->building) leave(u->region, u);

View file

@ -213,7 +213,7 @@ create_xmas2000(int x, int y)
r = new_region(x, y);
terraform(r, T_PLAIN);
set_string(&r->land->name, "Weihnachtsinsel");
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r, 2, 1000);
#else
rsettrees(r, 1000);

View file

@ -0,0 +1,20 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
/*
* Contains defines for the "free" game (Eressea) .
* Include this file from settings.h to make eressea work.
*/
#define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1
#define GROWING_TREES 1

View file

@ -0,0 +1,20 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
/*
* Contains defines for the "classic" game (Vinyambar I) .
* Include this file from settings.h to make eressea work.
*/
#define RESOURCE_CONVERSION 0
#define NEW_RESOURCEGROWTH 0
#define LARGE_CASTLES 0
#define GROWING_TREES 0

View file

@ -27,12 +27,10 @@
#include <attributes/overrideroads.h>
#include <attributes/racename.h>
#include <attributes/otherfaction.h>
#include <attributes/moved.h>
#ifdef AT_OPTION
# include <attributes/option.h>
#endif
#ifdef AT_MOVED
# include <attributes/moved.h>
#endif
/* util includes */
#include <attrib.h>
@ -51,9 +49,7 @@ init_attributes(void)
init_reduceproduction();
init_racename();
init_otherfaction();
#ifdef AT_MOVED
init_moved();
#endif
#ifdef AT_OPTION
init_option();
#endif

View file

@ -2346,7 +2346,7 @@ update_igjarjuk_quest(void)
}
#ifdef RESOURCE_FIX
#if RESOURCE_CONVERSION
extern struct attrib_type at_resources;
void
init_resourcefix(void)
@ -2572,7 +2572,7 @@ fix_negpotion(void)
}
}
#ifdef GROWING_TREES
#if GROWING_TREES
int
growing_trees(void)
{
@ -2689,6 +2689,7 @@ fix_ratfamiliar(void)
return 0;
}
#if NEW_RESOURCEGROWTH
static int
randomized_resources(void)
{
@ -2704,6 +2705,7 @@ randomized_resources(void)
}
return 0;
}
#endif
void
korrektur(void)
@ -2773,21 +2775,22 @@ korrektur(void)
}
do_once("sql2", dump_sql());
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
/* do not remove do_once calls - old datafiles need them! */
do_once("rgrw", convert_resources());
do_once("rsfx", read_resfix());
#endif
/* do_once("xepl", create_xe()); */
#ifdef GROWING_TREES
#if GROWING_TREES
do_once("grtr", growing_trees());
#endif
do_once("grat", fix_ratfamiliar());
do_once("fdmd", fix_demand());
#if NEW_RESOURCEGROWTH
do_once("rndr", randomized_resources());
#endif
{
/* Test der Message-Funktion. Ist leider noch nicht
* Plane-übergreifend, deshalb die Waldelfen. */

View file

@ -120,6 +120,7 @@ static boolean g_killeiswald = false;
struct settings global = {
"Eressea", /* gamename */
1000, /* maxunits */
};
static int
@ -172,7 +173,7 @@ game_init(void)
init_attributes();
init_economy();
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
init_rawmaterials();
#endif

View file

@ -244,23 +244,23 @@ addmenulist(menulist ** SP, const char *s, int *val)
static int peasants, money, trees, horses, iron, laen, chaotisch;
#ifdef GROWING_TREES
#if GROWING_TREES
static int ytrees, seeds;
#endif
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
static int ironlevel, laenlevel, stone, stonelevel;
#endif
static void
get_region(region *r) {
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
struct rawmaterial *res;
#endif
peasants = rpeasants(r);
money = rmoney(r);
#ifdef GROWING_TREES
#if GROWING_TREES
trees = rtrees(r,2);
ytrees = rtrees(r,1);
seeds = rtrees(r,0);
@ -268,7 +268,7 @@ get_region(region *r) {
trees = rtrees(r);
#endif
horses = rhorses(r);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
iron = -1;
ironlevel = -1;
laen = -1;
@ -297,13 +297,13 @@ get_region(region *r) {
static void
put_region(region *r) {
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
struct rawmaterial *res;
#endif
rsetpeasants(r, peasants);
rsetmoney(r,money);
#ifdef GROWING_TREES
#if GROWING_TREES
rsettrees(r,2,trees);
rsettrees(r,1,ytrees);
rsettrees(r,0,seeds);
@ -311,7 +311,7 @@ put_region(region *r) {
rsettrees(r,trees);
#endif
rsethorses(r, horses);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
for (res=r->resources;res;res=res->next) {
const item_type * itype = resource2item(res->type->rtype);
if(itype == olditemtype[I_IRON]) {
@ -347,19 +347,19 @@ create_region_menu(menulist ** menu, region * r)
addmenulist(menu, "Silver", &money);
if (fval(r, RF_MALLORN)) {
addmenulist(menu, "Mallorntrees", &trees);
#ifdef GROWING_TREES
#if GROWING_TREES
addmenulist(menu, "Mallornsprouts", &ytrees);
addmenulist(menu, "Mallornseeds", &seeds);
#endif
} else {
addmenulist(menu, "Trees", &trees);
#ifdef GROWING_TREES
#if GROWING_TREES
addmenulist(menu, "Sprouts", &ytrees);
addmenulist(menu, "Seeds", &seeds);
#endif
}
addmenulist(menu, "Horses", &horses);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
if(iron != -1) {
addmenulist(menu, "Iron", &iron);
addmenulist(menu, "Ironlevel", &ironlevel);

View file

@ -173,7 +173,7 @@ showregion(region * r, char full)
faction *f;
int d,pp=0, ecount[MAXRACES], count[MAXRACES];
char str[256];
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
int iron = -1, ironlevel = -1,
laen = -1, laenlevel = -1,
stone = -1, stonelevel = -1;
@ -200,7 +200,7 @@ showregion(region * r, char full)
adddbllist(&reglist, buf);
sprintf(buf, " %d peasants, %d(%d) silver", rpeasants(r), rmoney(r), count_all_money(r));
adddbllist(&reglist, buf);
#ifdef GROWING_TREES
#if GROWING_TREES
sprintf(buf, " %d horses, %d/%d/%d ",
rhorses(r), rtrees(r,2), rtrees(r,1), rtrees(r,0));
if (fval(r,RF_MALLORN))
@ -216,7 +216,7 @@ showregion(region * r, char full)
#endif
adddbllist(&reglist, buf);
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
for(res=r->resources;res;res=res->next) {
const item_type * itype = resource2item(res->type->rtype);
if(itype == olditemtype[I_IRON]) {

View file

@ -261,6 +261,7 @@ factionhere(region * r, int f)
return false;
}
#if NEW_RESOURCEGROWTH
static boolean
has_laen(region *r)
{
@ -271,6 +272,7 @@ has_laen(region *r)
}
return false;
}
#endif
void
drawmap(boolean maponly) {
@ -1362,7 +1364,7 @@ main(int argc, char *argv[])
init_resources();
register_items();
init_attributes();
#ifdef NEW_RESOURCEGROWTH
#if NEW_RESOURCEGROWTH
init_rawmaterials();
#endif

View file

@ -10,7 +10,7 @@
<include file="races.xml"></include>
<include file="items.xml"></include>
<game name="Vinyambar">
<game name="Vinyambar II" units="250">
<comment>Game specific</comment>
<order name="ARBEITEN" disable></order>
<order name="MEINUNG" disable></order>