removed the old GROWING_TREES macro.

Also, made sure starting regions always have at least a few trees and horses, because I'm sick and tired of the complaints.
This commit is contained in:
Enno Rehling 2005-09-10 21:09:51 +00:00
parent 170eed6b62
commit bcf0b8d446
24 changed files with 18 additions and 262 deletions

View File

@ -1303,9 +1303,8 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
fprintf(F, "\"%s\";Beschr\n", r->display); fprintf(F, "\"%s\";Beschr\n", r->display);
#endif #endif
if (landregion(rterrain(r))) { if (landregion(rterrain(r))) {
#if GROWING_TREES int trees = rtrees(r, 2);
int trees = rtrees(r,2); int ytrees = rtrees(r, 1);
int ytrees = rtrees(r,1);
# ifdef RESOURCECOMPAT # ifdef RESOURCECOMPAT
if (trees > 0) fprintf(F, "%d;Baeume\n", trees); if (trees > 0) fprintf(F, "%d;Baeume\n", trees);
if (ytrees > 0) fprintf(F, "%d;Schoesslinge\n", ytrees); if (ytrees > 0) fprintf(F, "%d;Schoesslinge\n", ytrees);
@ -1319,19 +1318,6 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
if (ytrees) pos = report_resource(pos, "rm_youngmallorn", f->locale, ytrees, -1); if (ytrees) pos = report_resource(pos, "rm_youngmallorn", f->locale, ytrees, -1);
if (trees) pos = report_resource(pos, "rm_mallorn", f->locale, trees, -1); if (trees) pos = report_resource(pos, "rm_mallorn", f->locale, trees, -1);
} }
#else
int trees = rtrees(r);
# ifdef RESOURCECOMPAT
fprintf(F, "%d;Baeume\n", trees);
if (fval(r, RF_MALLORN) && trees)
fprintf(F, "1;Mallorn\n");
# endif
if (!fval(r, RF_MALLORN)) {
if (trees) pos = report_resource(pos, "rm_trees", f->locale, trees, -1);
} else {
if (trees) pos = report_resource(pos, "rm_mallorn", f->locale, trees, -1);
}
#endif
fprintf(F, "%d;Bauern\n", rpeasants(r)); fprintf(F, "%d;Bauern\n", rpeasants(r));
if(fval(r, RF_ORCIFIED)) { if(fval(r, RF_ORCIFIED)) {
fprintf(F, "1;Verorkt\n"); fprintf(F, "1;Verorkt\n");

View File

@ -69,9 +69,7 @@
#include <attributes/racename.h> #include <attributes/racename.h>
#include <attributes/orcification.h> #include <attributes/orcification.h>
#if GROWING_TREES #include <items/seed.h>
# include <items/seed.h>
#endif
typedef struct request { typedef struct request {
struct request * next; struct request * next;
@ -2395,7 +2393,6 @@ plant(region *r, unit *u, int raw)
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, htype->itype->rtype)); "plant%u:unit%r:region%i:amount%X:herb", u, r, planted, htype->itype->rtype));
} }
#if GROWING_TREES
static void static void
planttrees(region *r, unit *u, int raw) planttrees(region *r, unit *u, int raw)
{ {
@ -2515,8 +2512,6 @@ breedtrees(region *r, unit *u, int raw)
"plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype)); "plant%u:unit%r:region%i:amount%X:herb", u, r, planted, itype->rtype));
} }
#endif
static void static void
plant_cmd(unit *u, struct order * ord) plant_cmd(unit *u, struct order * ord)
{ {
@ -2555,7 +2550,6 @@ plant_cmd(unit *u, struct order * ord)
plant(r, u, m); plant(r, u, m);
return; return;
} }
#if GROWING_TREES
else if (p==P_TREES){ else if (p==P_TREES){
breedtrees(r, u, m); breedtrees(r, u, m);
return; return;
@ -2566,7 +2560,6 @@ plant_cmd(unit *u, struct order * ord)
return; return;
} }
} }
#endif
} }
@ -2636,11 +2629,9 @@ breed_cmd(unit *u, struct order * ord)
case P_HERBS: case P_HERBS:
plant(r, u, m); plant(r, u, m);
return; return;
#if GROWING_TREES
case P_TREES: case P_TREES:
breedtrees(r, u, m); breedtrees(r, u, m);
return; return;
#endif
default: default:
breedhorses(r, u); breedhorses(r, u);
return; return;
@ -3262,10 +3253,8 @@ init_economy(void)
add_allocator(make_allocator(item2resource(olditemtype[I_STONE]), leveled_allocation)); 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_IRON]), leveled_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_LAEN]), leveled_allocation)); add_allocator(make_allocator(item2resource(olditemtype[I_LAEN]), leveled_allocation));
#if GROWING_TREES
add_allocator(make_allocator(&rt_seed, attrib_allocation)); add_allocator(make_allocator(&rt_seed, attrib_allocation));
add_allocator(make_allocator(&rt_mallornseed, attrib_allocation)); add_allocator(make_allocator(&rt_mallornseed, attrib_allocation));
#endif
#else #else
add_allocator(make_allocator(item2resource(olditemtype[I_STONE]), attrib_allocation)); add_allocator(make_allocator(item2resource(olditemtype[I_STONE]), attrib_allocation));
add_allocator(make_allocator(item2resource(olditemtype[I_IRON]), attrib_allocation)); add_allocator(make_allocator(item2resource(olditemtype[I_IRON]), attrib_allocation));

View File

@ -642,9 +642,6 @@ migrate(region * r)
* das hatte ich geändert. jemand hat es wieder gelöscht, toll. * das hatte ich geändert. jemand hat es wieder gelöscht, toll.
* ich habe es wieder aktiviert, muß getestet werden. * ich habe es wieder aktiviert, muß getestet werden.
*/ */
#if GROWING_TREES == 0
rsettrees(r, rtrees(r) + m->trees);
#endif
*hp = m->next; *hp = m->next;
m->next = free_migrants; m->next = free_migrants;
free_migrants = m; free_migrants = m;
@ -876,7 +873,6 @@ void
demographics(void) demographics(void)
{ {
region *r; region *r;
#if GROWING_TREES
static int last_weeks_season = -1; static int last_weeks_season = -1;
static int current_season = -1; static int current_season = -1;
@ -884,7 +880,6 @@ demographics(void)
current_season = get_gamedate(turn, NULL)->season; current_season = get_gamedate(turn, NULL)->season;
last_weeks_season = get_gamedate(turn-1, NULL)->season; last_weeks_season = get_gamedate(turn-1, NULL)->season;
} }
#endif
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
if (r->age>0 || rterrain(r)!=T_OCEAN) { if (r->age>0 || rterrain(r)!=T_OCEAN) {
@ -912,13 +907,9 @@ demographics(void)
plagues(r, false); plagues(r, false);
horses(r); horses(r);
#if GROWING_TREES
if(current_season != SEASON_WINTER) { if(current_season != SEASON_WINTER) {
trees(r, current_season, last_weeks_season); trees(r, current_season, last_weeks_season);
} }
#else
trees(r);
#endif
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
update_resources(r); update_resources(r);
#else #else

View File

@ -38,9 +38,7 @@ void remove_unequipped_guarded(void);
#include "resolve.h" #include "resolve.h"
void processorders(void); void processorders(void);
#if GROWING_TREES
extern attrib_type at_germs; extern attrib_type at_germs;
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -126,11 +126,7 @@ dissolve_units(void)
break; break;
case 2: case 2:
if (r->land && !fval(r, RF_MALLORN)) { if (r->land && !fval(r, RF_MALLORN)) {
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) + n); rsettrees(r, 2, rtrees(r,2) + n);
#else
rsettrees(r, rtrees(r) + n);
#endif
if (n == 1) { if (n == 1) {
str = "wurde zum Baum."; str = "wurde zum Baum.";
} else { } else {
@ -820,13 +816,9 @@ volcano_outbreak(region *r)
/* Vulkan-Region verwüsten */ /* Vulkan-Region verwüsten */
#if GROWING_TREES
rsettrees(r, 2, 0); rsettrees(r, 2, 0);
rsettrees(r, 1, 0); rsettrees(r, 1, 0);
rsettrees(r, 0, 0); rsettrees(r, 0, 0);
#else
rsettrees(r, 0);
#endif
a = a_find(r->attribs, &at_reduceproduction); a = a_find(r->attribs, &at_reduceproduction);
if (!a) a = a_add(&r->attribs, a_new(&at_reduceproduction)); if (!a) a = a_add(&r->attribs, a_new(&at_reduceproduction));
@ -864,13 +856,9 @@ volcano_outbreak(region *r)
if (rn) { if (rn) {
#if GROWING_TREES
rsettrees(r, 2, 0); rsettrees(r, 2, 0);
rsettrees(r, 1, 0); rsettrees(r, 1, 0);
rsettrees(r, 0, 0); rsettrees(r, 0, 0);
#else
rsettrees(r, 0);
#endif
a = a_find(rn->attribs, &at_reduceproduction); a = a_find(rn->attribs, &at_reduceproduction);
if (!a) a = a_add(&rn->attribs, a_new(&at_reduceproduction)); if (!a) a = a_add(&rn->attribs, a_new(&at_reduceproduction));
@ -1323,11 +1311,7 @@ randomevents(void)
#if !RACE_ADJUSTMENTS #if !RACE_ADJUSTMENTS
/* Elfen generieren Wald */ /* Elfen generieren Wald */
if (r->land && !fval(r, RF_MALLORN)) { if (r->land && !fval(r, RF_MALLORN)) {
#if GROWING_TREES
int trees = rtrees(r, 2); int trees = rtrees(r, 2);
#else
int trees = rtrees(r);
#endif
int maxgen = (production(r) * MAXPEASANTS_PER_AREA)/8; int maxgen = (production(r) * MAXPEASANTS_PER_AREA)/8;
for (u = r->units; u && maxgen > 0; u = u->next) { for (u = r->units; u && maxgen > 0; u = u->next) {
if (u->race == new_race[RC_ELF]) { if (u->race == new_race[RC_ELF]) {
@ -1339,11 +1323,7 @@ randomevents(void)
} }
} }
} }
#if GROWING_TREES
rsettrees(r, 2, trees); rsettrees(r, 2, trees);
#else
rsettrees(r, trees);
#endif /* GROWING_TREES */
} /* !RACE_ADJUSTMENTS */ } /* !RACE_ADJUSTMENTS */
#endif #endif
@ -1578,22 +1558,14 @@ randomevents(void)
for (r = regions; r; r = r->next) { 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 (fval(r, RF_CHAOTIC) ||(r->x >= -13 && r->x <= -6 && r->y >= 50 && r->y <= 57)) {
if (woodcount(r) >= 40 && rand()%100 < 33) { if (woodcount(r) >= 40 && rand()%100 < 33) {
#if GROWING_TREES
int trees = rtrees(r,2); int trees = rtrees(r,2);
#else
int trees = rtrees(r);
#endif
int treemen = rand()%(max(50,trees)/3); int treemen = rand()%(max(50,trees)/3);
struct message * msg; struct message * msg;
treemen = max(25, treemen); treemen = max(25, treemen);
woodcounts(r, -40); woodcounts(r, -40);
trees = max(0, trees-treemen); trees = max(0, trees-treemen);
#if GROWING_TREES
rsettrees(r, 2, trees); rsettrees(r, 2, trees);
#else
rsettrees(r, trees);
#endif
u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]); u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]);
fset(u, UFL_ISNEW|UFL_MOVED); fset(u, UFL_ISNEW|UFL_MOVED);

View File

@ -1000,9 +1000,7 @@ describe(FILE * F, const region * r, int partial, faction * f)
boolean dh; boolean dh;
direction_t d; direction_t d;
int trees; int trees;
#if GROWING_TREES
int ytrees; int ytrees;
#endif
attrib *a; attrib *a;
const char *tname; const char *tname;
struct edge { struct edge {
@ -1070,7 +1068,6 @@ describe(FILE * F, const region * r, int partial, faction * f)
/* Bäume */ /* Bäume */
#if GROWING_TREES
trees = rtrees(r,2); trees = rtrees(r,2);
ytrees = rtrees(r,1); ytrees = rtrees(r,1);
if (production(r)) { if (production(r)) {
@ -1088,22 +1085,6 @@ describe(FILE * F, const region * r, int partial, faction * f)
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p")); bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p"));
} }
} }
#else
trees = rtrees(r);
if (production(r) && trees > 0) {
bufp += sprintf(bufp, ", %d ", trees);
if (fval(r, RF_MALLORN)) {
if (trees == 1)
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree"));
else
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
}
else if (trees == 1)
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree"));
else
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p"));
}
#endif
/* iron & stone */ /* iron & stone */
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH

View File

@ -18,9 +18,7 @@
#include "xerewards.h" #include "xerewards.h"
#include "artrewards.h" #include "artrewards.h"
#include "weapons.h" #include "weapons.h"
#if GROWING_TREES #include "seed.h"
# include "seed.h"
#endif
void void
register_itemtypes(void) register_itemtypes(void)
@ -28,10 +26,8 @@ register_itemtypes(void)
register_weapons(); register_weapons();
register_demonseye(); register_demonseye();
register_xerewards(); register_xerewards();
#if GROWING_TREES
register_seed(); register_seed();
register_mallornseed(); register_mallornseed();
#endif
register_artrewards(); register_artrewards();
} }

View File

@ -13,7 +13,6 @@
#include <config.h> #include <config.h>
#include <eressea.h> #include <eressea.h>
#if GROWING_TREES
#include "seed.h" #include "seed.h"
#include <build.h> #include <build.h>
@ -142,7 +141,3 @@ register_mallornseed(void)
rdata->use = produce_mallornseeds; rdata->use = produce_mallornseeds;
} }
} }
#else
int __xx_nonempty=0; /* to prevent this from being an empty translation unit */
#endif

View File

@ -19,7 +19,6 @@ extern "C" {
#endif #endif
#if GROWING_TREES
extern struct item_type it_seed; extern struct item_type it_seed;
extern struct resource_type rt_seed; extern struct resource_type rt_seed;
extern void register_seed(void); extern void register_seed(void);
@ -27,9 +26,6 @@ extern void register_seed(void);
extern struct item_type it_mallornseed; extern struct item_type it_mallornseed;
extern struct resource_type rt_mallornseed; extern struct resource_type rt_mallornseed;
extern void register_mallornseed(void); extern void register_mallornseed(void);
#else
#error seed.h should not be included when building with GROWING_TREES==0
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -117,11 +117,7 @@ use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount); GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
} }
if (r->land==0) holz=0; if (r->land==0) holz=0;
#if GROWING_TREES
rsettrees(r, 1, rtrees(r, 1) + holz); rsettrees(r, 1, rtrees(r, 1) + holz);
#else
rsettrees(r, rtrees(r) + holz);
#endif
add_message(&u->faction->msgs, new_message(u->faction, add_message(&u->faction->msgs, new_message(u->faction,
"growtree_effect%u:mage%i:amount", u, holz)); "growtree_effect%u:mage%i:amount", u, holz));
} else if (ptype==oldpotiontype[P_HEAL]) { } else if (ptype==oldpotiontype[P_HEAL]) {

View File

@ -1997,12 +1997,8 @@ idle (faction * f)
int int
maxworkingpeasants(const struct region * r) maxworkingpeasants(const struct region * r)
{ {
#if GROWING_TREES
int i = production(r) * MAXPEASANTS_PER_AREA int i = production(r) * MAXPEASANTS_PER_AREA
- ((rtrees(r,2)+rtrees(r,1)/2) * TREESIZE); - ((rtrees(r,2)+rtrees(r,1)/2) * TREESIZE);
#else
int i = production(r) * MAXPEASANTS_PER_AREA - rtrees(r) * TREESIZE;
#endif
return max(i, 0); return max(i, 0);
} }
@ -3199,9 +3195,7 @@ attrib_init(void)
register_bordertype(&bt_questportal); register_bordertype(&bt_questportal);
at_register(&at_jihad); at_register(&at_jihad);
#if GROWING_TREES
at_register(&at_germs); at_register(&at_germs);
#endif
at_register(&at_laen); /* required for old datafiles */ at_register(&at_laen); /* required for old datafiles */
#ifdef XECMD_MODULE #ifdef XECMD_MODULE
at_register(&at_xontormiaexpress); /* required for old datafiles */ at_register(&at_xontormiaexpress); /* required for old datafiles */

View File

@ -1166,11 +1166,7 @@ limit_oldtypes(const region * r, const resource_type * rtype)
/* TODO: split into seperate functions. really much nicer. */ /* TODO: split into seperate functions. really much nicer. */
{ {
if (rtype==oldresourcetype[R_WOOD]) { if (rtype==oldresourcetype[R_WOOD]) {
#if GROWING_TREES
return rtrees(r,2) + rtrees(r,1); return rtrees(r,2) + rtrees(r,1);
#else
return rtrees(r);
#endif
#if NEW_RESOURCEGROWTH == 0 #if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) { } else if (rtype==oldresourcetype[R_EOG]) {
return rlaen(r); return rlaen(r);
@ -1180,11 +1176,7 @@ limit_oldtypes(const region * r, const resource_type * rtype)
return terrain[rterrain(r)].quarries; return terrain[rterrain(r)].quarries;
#endif #endif
} else if (rtype==oldresourcetype[R_MALLORN]) { } else if (rtype==oldresourcetype[R_MALLORN]) {
#if GROWING_TREES
return rtrees(r,2) + rtrees(r,1); return rtrees(r,2) + rtrees(r,1);
#else
return rtrees(r);
#endif
} else if (rtype==oldresourcetype[R_HORSE]) { } else if (rtype==oldresourcetype[R_HORSE]) {
return rhorses(r); return rhorses(r);
} else { } else {
@ -1200,7 +1192,6 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
{ {
assert(norders>0); assert(norders>0);
if (rtype==oldresourcetype[R_WOOD] || rtype==oldresourcetype[R_MALLORN]) { if (rtype==oldresourcetype[R_WOOD] || rtype==oldresourcetype[R_MALLORN]) {
#if GROWING_TREES
int avail_grownup = rtrees(r,2); int avail_grownup = rtrees(r,2);
int avail_young = rtrees(r,1); int avail_young = rtrees(r,1);
int wcount; int wcount;
@ -1220,12 +1211,6 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
} else { } else {
woodcounts(r, wcount*2); woodcounts(r, wcount*2);
} }
#else
int avail = rtrees(r);
assert(norders <= avail);
rsettrees(r, avail-norders);
woodcounts(r, norders);
#endif
#if NEW_RESOURCEGROWTH == 0 #if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) { } else if (rtype==oldresourcetype[R_EOG]) {
int avail = rlaen(r); int avail = rlaen(r);

View File

@ -340,10 +340,8 @@ is_repeated(const order * ord)
case K_PIRACY: case K_PIRACY:
return true; return true;
#if GROWING_TREES
case K_PLANT: case K_PLANT:
return true; return true;
#endif
case K_FOLLOW: case K_FOLLOW:
/* FOLLOW is only a long order if we are following a ship. */ /* FOLLOW is only a long order if we are following a ship. */
@ -401,10 +399,8 @@ is_exclusive(const order * ord)
case K_PIRACY: case K_PIRACY:
return true; return true;
#if GROWING_TREES
case K_PLANT: case K_PLANT:
return true; return true;
#endif
case K_FOLLOW: case K_FOLLOW:
/* FOLLOW is only a long order if we are following a ship. */ /* FOLLOW is only a long order if we are following a ship. */

View File

@ -599,11 +599,7 @@ rroad(const region * r, direction_t d)
boolean boolean
r_isforest(const region * r) r_isforest(const region * r)
{ {
#if GROWING_TREES
if (r->terrain==T_PLAIN && rtrees(r,2) + rtrees(r,1) >= 600) return true; 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;
#endif
return false; return false;
} }
@ -705,7 +701,6 @@ rname(const region * r, const struct locale * lang) {
return locale_string(lang, terrain[rterrain(r)].name); return locale_string(lang, terrain[rterrain(r)].name);
} }
#if GROWING_TREES
int int
rtrees(const region *r, int ageclass) rtrees(const region *r, int ageclass)
{ {
@ -722,24 +717,6 @@ rsettrees(const region *r, int ageclass, int value)
} }
return 0; return 0;
} }
#else
int
rtrees(const region *r)
{
return ((r)->land?(r)->land->trees:0);
}
int
rsettrees(const region *r, int value)
{
if (!r->land) assert(value==0);
else {
assert(value>=0);
return r->land->trees=value;
}
return 0;
}
#endif
static region *last; static region *last;
@ -921,13 +898,9 @@ terraform(region * r, terrain_t t)
freeland(r->land); freeland(r->land);
r->land = NULL; r->land = NULL;
} }
#if GROWING_TREES
rsettrees(r, 0, 0); rsettrees(r, 0, 0);
rsettrees(r, 1, 0); rsettrees(r, 1, 0);
rsettrees(r, 2, 0); rsettrees(r, 2, 0);
#else
rsettrees(r, 0);
#endif
rsethorses(r, 0); rsethorses(r, 0);
#if NEW_RESOURCEGROWTH == 0 #if NEW_RESOURCEGROWTH == 0
rsetiron(r, 0); rsetiron(r, 0);
@ -1030,13 +1003,9 @@ terraform(region * r, terrain_t t)
case T_PLAIN: case T_PLAIN:
rsethorses(r, rand() % (terrain[t].production_max / 5)); rsethorses(r, rand() % (terrain[t].production_max / 5));
if(rand()%100 < 40) { if(rand()%100 < 40) {
#if GROWING_TREES
rsettrees(r, 2, terrain[t].production_max * (30+rand()%40)/100); rsettrees(r, 2, terrain[t].production_max * (30+rand()%40)/100);
rsettrees(r, 1, rtrees(r, 2)/4); rsettrees(r, 1, rtrees(r, 2)/4);
rsettrees(r, 0, rtrees(r, 2)/2); rsettrees(r, 0, rtrees(r, 2)/2);
#else
rsettrees(r, terrain[t].production_max * (30+rand()%40)/100);
#endif
} }
break; break;
case T_MOUNTAIN: case T_MOUNTAIN:
@ -1068,14 +1037,12 @@ terraform(region * r, terrain_t t)
break; break;
} }
#if GROWING_TREES
/* Initialisierung irgendwann über rm_-Mechamismus machen */ /* Initialisierung irgendwann über rm_-Mechamismus machen */
if(t != T_PLAIN && rand()%100 < 20) { if(t != T_PLAIN && rand()%100 < 20) {
rsettrees(r, 2, terrain[t].production_max * (30 + rand() % 40) / 100); rsettrees(r, 2, terrain[t].production_max * (30 + rand() % 40) / 100);
rsettrees(r, 1, rtrees(r, 2)/4); rsettrees(r, 1, rtrees(r, 2)/4);
rsettrees(r, 0, rtrees(r, 2)/2); rsettrees(r, 0, rtrees(r, 2)/2);
} }
#endif
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
terraform_resources(r); terraform_resources(r);

View File

@ -71,11 +71,7 @@ typedef struct land_region {
} * demands; } * demands;
const struct herb_type * herbtype; const struct herb_type * herbtype;
short herbs; short herbs;
#if GROWING_TREES
int trees[3]; /* 0 -> Samen, 1 -> Sprößlinge, 2 -> Bäume */ int trees[3]; /* 0 -> Samen, 1 -> Sprößlinge, 2 -> Bäume */
#else
int trees;
#endif
int horses; int horses;
int peasants; int peasants;
int newpeasants; int newpeasants;
@ -194,13 +190,8 @@ void rsetroad(struct region * r, direction_t d, short value);
int is_coastregion(struct region *r); int is_coastregion(struct region *r);
#if GROWING_TREES
int rtrees(const struct region * r, int ageclass); int rtrees(const struct region * r, int ageclass);
int rsettrees(const struct region *r, int ageclass, int value); int rsettrees(const struct region *r, int ageclass, int value);
#else
int rtrees(const struct region * r);
int rsettrees(const struct region * r, int value);
#endif
int rpeasants(const struct region * r); int rpeasants(const struct region * r);
void rsetpeasants(struct region * r, int value); void rsetpeasants(struct region * r, int value);

View File

@ -1359,7 +1359,6 @@ readregion(FILE * F, short x, short y)
} }
if (r->land) { if (r->land) {
int i; int i;
#if GROWING_TREES
if(global.data_version < GROWTREE_VERSION) { if(global.data_version < GROWTREE_VERSION) {
i = ri(F); rsettrees(r, 2, i); i = ri(F); rsettrees(r, 2, i);
} else { } else {
@ -1385,9 +1384,6 @@ readregion(FILE * F, short x, short y)
} }
rsettrees(r, 2, i); rsettrees(r, 2, i);
} }
#else
i = ri(F); rsettrees(r, i);
#endif
i = ri(F); rsethorses(r, i); i = ri(F); rsethorses(r, i);
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
if (global.data_version < NEWRESOURCE_VERSION) { if (global.data_version < NEWRESOURCE_VERSION) {
@ -1496,16 +1492,12 @@ writeregion(FILE * F, const region * r)
const herb_type *rht; const herb_type *rht;
struct demand * demand; struct demand * demand;
ws(F, r->land->name); ws(F, r->land->name);
#if GROWING_TREES
assert(rtrees(r,0)>=0); assert(rtrees(r,0)>=0);
assert(rtrees(r,1)>=0); assert(rtrees(r,1)>=0);
assert(rtrees(r,2)>=0); assert(rtrees(r,2)>=0);
wi(F, rtrees(r,0)); wi(F, rtrees(r,0));
wi(F, rtrees(r,1)); wi(F, rtrees(r,1));
wi(F, rtrees(r,2)); wi(F, rtrees(r,2));
#else
wi(F, rtrees(r));
#endif
wi(F, rhorses(r)); wi(F, rhorses(r));
#if NEW_RESOURCEGROWTH == 0 #if NEW_RESOURCEGROWTH == 0
wi(F, riron(r)); wi(F, riron(r));

View File

@ -947,21 +947,13 @@ sp_summonent(castorder *co)
attrib *a; attrib *a;
int ents; int ents;
#if GROWING_TREES
if (rtrees(r,2) == 0) { if (rtrees(r,2) == 0) {
#else
if (rtrees(r) == 0) {
#endif
cmistake(mage, co->order, 204, MSG_EVENT); cmistake(mage, co->order, 204, MSG_EVENT);
/* nicht ohne bäume */ /* nicht ohne bäume */
return 0; return 0;
} }
#if GROWING_TREES
ents = (int)min(power*power, rtrees(r,2)); ents = (int)min(power*power, rtrees(r,2));
#else
ents = (int)min(power*power, rtrees(r));
#endif
u = create_unit(r, mage->faction, ents, new_race[RC_TREEMAN], 0, LOC(mage->faction->locale, rc_name(new_race[RC_TREEMAN], ents!=1)), mage); u = create_unit(r, mage->faction, ents, new_race[RC_TREEMAN], 0, LOC(mage->faction->locale, rc_name(new_race[RC_TREEMAN], ents!=1)), mage);
@ -971,11 +963,7 @@ sp_summonent(castorder *co)
a_add(&u->attribs, a); a_add(&u->attribs, a);
fset(u, UFL_LOCKED); fset(u, UFL_LOCKED);
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) - ents); rsettrees(r, 2, rtrees(r,2) - ents);
#else
rsettrees(r, rtrees(r) - ents);
#endif
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
{ {
@ -1114,13 +1102,9 @@ sp_mallorn(castorder *co)
} }
/* half the trees will die */ /* half the trees will die */
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2); rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2); rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2); rsettrees(r, 0, rtrees(r,0)/2);
#else
rsettrees(r, rtrees(r)/2);
#endif
fset(r, RF_MALLORN); fset(r, RF_MALLORN);
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
@ -1205,11 +1189,7 @@ sp_hain(castorder *co)
} }
trees = lovar((int)(force * 10 * RESOURCE_QUANTITY)) + (int)force; trees = lovar((int)(force * 10 * RESOURCE_QUANTITY)) + (int)force;
#if GROWING_TREES
rsettrees(r, 1, rtrees(r,1) + trees); rsettrees(r, 1, rtrees(r,1) + trees);
#else
rsettrees(r, rtrees(r) + trees);
#endif
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
{ {
@ -1254,11 +1234,7 @@ sp_mallornhain(castorder *co)
} }
trees = lovar((int)(force * 10 * RESOURCE_QUANTITY)) + (int)force; trees = lovar((int)(force * 10 * RESOURCE_QUANTITY)) + (int)force;
#if GROWING_TREES
rsettrees(r, 1, rtrees(r,1) + trees); rsettrees(r, 1, rtrees(r,1) + trees);
#else
rsettrees(r, rtrees(r) + trees);
#endif
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
{ {
@ -1690,13 +1666,9 @@ sp_great_drought(castorder *co)
/* sterben */ /* sterben */
rsetpeasants(r, rpeasants(r)/2); /* evtl wuerfeln */ rsetpeasants(r, rpeasants(r)/2); /* evtl wuerfeln */
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2); rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2); rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2); rsettrees(r, 0, rtrees(r,0)/2);
#else
rsettrees(r, rtrees(r)/2);
#endif
rsethorses(r, rhorses(r)/2); rsethorses(r, rhorses(r)/2);
/* Arbeitslohn = 1/4 */ /* Arbeitslohn = 1/4 */
@ -2188,13 +2160,9 @@ sp_drought(castorder *co)
} else { } else {
variant effect; variant effect;
/* Baeume und Pferde sterben */ /* Baeume und Pferde sterben */
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2)/2); rsettrees(r, 2, rtrees(r,2)/2);
rsettrees(r, 1, rtrees(r,1)/2); rsettrees(r, 1, rtrees(r,1)/2);
rsettrees(r, 0, rtrees(r,0)/2); rsettrees(r, 0, rtrees(r,0)/2);
#else
rsettrees(r, rtrees(r)/2);
#endif
rsethorses(r, rhorses(r)/2); rsethorses(r, rhorses(r)/2);
effect.i = 4; effect.i = 4;
@ -2563,24 +2531,16 @@ sp_forest_fire(castorder *co)
double probability; double probability;
double percentage = (rand() % 8 + 1) * 0.1; /* 10 - 80% */ double percentage = (rand() % 8 + 1) * 0.1; /* 10 - 80% */
#if GROWING_TREES
int vernichtet_schoesslinge = (int)(rtrees(r, 1) * percentage); int vernichtet_schoesslinge = (int)(rtrees(r, 1) * percentage);
int destroyed = (int)(rtrees(r, 2) * percentage); int destroyed = (int)(rtrees(r, 2) * percentage);
#else
int destroyed = (int)(rtrees(r) * percentage);
#endif
if (destroyed<1) { if (destroyed<1) {
cmistake(mage, co->order, 198, MSG_MAGIC); cmistake(mage, co->order, 198, MSG_MAGIC);
return 0; return 0;
} }
#if GROWING_TREES
rsettrees(r, 2, rtrees(r,2) - destroyed); rsettrees(r, 2, rtrees(r,2) - destroyed);
rsettrees(r, 1, rtrees(r,1) - vernichtet_schoesslinge); rsettrees(r, 1, rtrees(r,1) - vernichtet_schoesslinge);
#else
rsettrees(r, rtrees(r) - destroyed);
#endif
probability = destroyed * 0.001; /* Chance, dass es sich ausbreitet */ probability = destroyed * 0.001; /* Chance, dass es sich ausbreitet */
/* melden, 1x pro Partei */ /* melden, 1x pro Partei */
@ -2598,15 +2558,9 @@ sp_forest_fire(castorder *co)
} }
} }
if(!fval(mage->faction, FL_DH)){ if(!fval(mage->faction, FL_DH)){
#if GROWING_TREES
sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s " sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s "
"den Flammen zum Opfer.", unitname(mage), destroyed+vernichtet_schoesslinge, "den Flammen zum Opfer.", unitname(mage), destroyed+vernichtet_schoesslinge,
destroyed+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen"); destroyed+vernichtet_schoesslinge == 1 ? "Baum fiel" : "Bäume fielen");
#else
sprintf(buf, "%s erzeugt eine verheerende Feuersbrunst. %d %s "
"den Flammen zum Opfer.", unitname(mage), destroyed,
destroyed == 1 ? "Baum fiel" : "Bäume fielen");
#endif
addmessage(0, mage->faction, buf, MSG_MAGIC, ML_INFO); addmessage(0, mage->faction, buf, MSG_MAGIC, ML_INFO);
} }
@ -2616,7 +2570,6 @@ sp_forest_fire(castorder *co)
destroyed = 0; destroyed = 0;
vernichtet_schoesslinge = 0; vernichtet_schoesslinge = 0;
#if GROWING_TREES
if(rtrees(nr,2) + rtrees(nr,1) >= 800) { if(rtrees(nr,2) + rtrees(nr,1) >= 800) {
if (chance(probability)) { if (chance(probability)) {
destroyed = (int)(rtrees(nr,2) * percentage/2); destroyed = (int)(rtrees(nr,2) * percentage/2);
@ -2640,22 +2593,6 @@ sp_forest_fire(castorder *co)
rsettrees(nr, 2, rtrees(nr,2) - destroyed); rsettrees(nr, 2, rtrees(nr,2) - destroyed);
rsettrees(nr, 1, rtrees(nr,1) - vernichtet_schoesslinge); rsettrees(nr, 1, rtrees(nr,1) - vernichtet_schoesslinge);
} }
#else
if (rtrees(nr) >= 800) {
if (chance(probability)) destroyed = (int)(rtrees(nr) * percentage/2);
} else if (rtrees(nr) >= 600) {
if(chance(probability/2)) destroyed = (int)(rtrees(nr) * percentage/4);
}
if (destroyed > 0 ) {
message * m = msg_message("forestfire_spread", "region next trees",
r, nr, destroyed);
add_message(&r->msgs, m);
add_message(&mage->faction->msgs, m);
msg_release(m);
rsettrees(nr, rtrees(nr) - destroyed);
}
#endif
} }
return cast_level; return cast_level;
} }

View File

@ -530,9 +530,23 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
newfaction ** nfp, * nextf = *players; newfaction ** nfp, * nextf = *players;
faction * f; faction * f;
unit * u; unit * u;
int n;
isize += REGIONS_PER_FACTION; isize += REGIONS_PER_FACTION;
terraform(r, preferred_terrain(nextf->race)); terraform(r, preferred_terrain(nextf->race));
n = rhorses(r);
if (n<terrain[r->terrain].production_max/20) {
n = terrain[r->terrain].production_max/20;
rsethorses(r, n);
}
n = rtrees(r, 2);
if (n<terrain[r->terrain].production_max/10) {
n = terrain[r->terrain].production_max/10;
rsettrees(r, 2, n);
rsettrees(r, 2, n/4);
rsettrees(r, 2, n/2);
}
n = rhorses(r);
++tsize; ++tsize;
assert(r->land && r->units==0); assert(r->land && r->units==0);
u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race,

View File

@ -19,7 +19,6 @@
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1
#define REDUCED_PEASANTGROWTH 1 #define REDUCED_PEASANTGROWTH 1
#define RACE_ADJUSTMENTS 1 #define RACE_ADJUSTMENTS 1
#define TEACHDIFFERENCE 2 #define TEACHDIFFERENCE 2

View File

@ -19,7 +19,6 @@
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1
#define REDUCED_PEASANTGROWTH 1 #define REDUCED_PEASANTGROWTH 1
#define RACE_ADJUSTMENTS 1 #define RACE_ADJUSTMENTS 1
#define TEACHDIFFERENCE 2 #define TEACHDIFFERENCE 2

View File

@ -19,7 +19,6 @@
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1
#define REDUCED_PEASANTGROWTH 1 #define REDUCED_PEASANTGROWTH 1
#define RACE_ADJUSTMENTS 1 #define RACE_ADJUSTMENTS 1
#define TEACHDIFFERENCE 2 #define TEACHDIFFERENCE 2

View File

@ -19,7 +19,6 @@
#define RESOURCE_CONVERSION 1 #define RESOURCE_CONVERSION 1
#define NEW_RESOURCEGROWTH 1 #define NEW_RESOURCEGROWTH 1
#define LARGE_CASTLES 1 #define LARGE_CASTLES 1
#define GROWING_TREES 1
#define REDUCED_PEASANTGROWTH 1 #define REDUCED_PEASANTGROWTH 1
#define RACE_ADJUSTMENTS 1 #define RACE_ADJUSTMENTS 1
#define TEACHDIFFERENCE 2 #define TEACHDIFFERENCE 2

View File

@ -673,7 +673,6 @@ init_resourcefix(void)
#endif #endif
#if GROWING_TREES
int int
growing_trees(void) growing_trees(void)
{ {
@ -687,7 +686,6 @@ growing_trees(void)
} }
return 0; return 0;
} }
#endif
#include <triggers/gate.h> #include <triggers/gate.h>
#include <triggers/unguard.h> #include <triggers/unguard.h>

View File

@ -237,9 +237,7 @@ addmenulist(menulist ** SP, const char *s, int *val)
static int peasants, money, trees, horses, iron, laen, chaotisch; static int peasants, money, trees, horses, iron, laen, chaotisch;
#if GROWING_TREES
static int ytrees, seeds; static int ytrees, seeds;
#endif
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
static int ironlevel, laenlevel, stone, stonelevel; static int ironlevel, laenlevel, stone, stonelevel;
@ -253,13 +251,9 @@ get_region(region *r) {
peasants = rpeasants(r); peasants = rpeasants(r);
money = rmoney(r); money = rmoney(r);
#if GROWING_TREES
trees = rtrees(r,2); trees = rtrees(r,2);
ytrees = rtrees(r,1); ytrees = rtrees(r,1);
seeds = rtrees(r,0); seeds = rtrees(r,0);
#else
trees = rtrees(r);
#endif
horses = rhorses(r); horses = rhorses(r);
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
iron = -1; iron = -1;
@ -296,13 +290,9 @@ put_region(region *r) {
rsetpeasants(r, peasants); rsetpeasants(r, peasants);
rsetmoney(r,money); rsetmoney(r,money);
#if GROWING_TREES
rsettrees(r,2,trees); rsettrees(r,2,trees);
rsettrees(r,1,ytrees); rsettrees(r,1,ytrees);
rsettrees(r,0,seeds); rsettrees(r,0,seeds);
#else
rsettrees(r,trees);
#endif
rsethorses(r, horses); rsethorses(r, horses);
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
for (res=r->resources;res;res=res->next) { for (res=r->resources;res;res=res->next) {
@ -340,16 +330,12 @@ create_region_menu(menulist ** menu, region * r)
addmenulist(menu, "Silver", &money); addmenulist(menu, "Silver", &money);
if (fval(r, RF_MALLORN)) { if (fval(r, RF_MALLORN)) {
addmenulist(menu, "Mallorntrees", &trees); addmenulist(menu, "Mallorntrees", &trees);
#if GROWING_TREES
addmenulist(menu, "Mallornsprouts", &ytrees); addmenulist(menu, "Mallornsprouts", &ytrees);
addmenulist(menu, "Mallornseeds", &seeds); addmenulist(menu, "Mallornseeds", &seeds);
#endif
} else { } else {
addmenulist(menu, "Trees", &trees); addmenulist(menu, "Trees", &trees);
#if GROWING_TREES
addmenulist(menu, "Sprouts", &ytrees); addmenulist(menu, "Sprouts", &ytrees);
addmenulist(menu, "Seeds", &seeds); addmenulist(menu, "Seeds", &seeds);
#endif
} }
addmenulist(menu, "Horses", &horses); addmenulist(menu, "Horses", &horses);
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH