removing the old NEW_RESOURCEGROWTh macro

This commit is contained in:
Enno Rehling 2005-10-24 20:06:40 +00:00
parent 5cc18d1e37
commit 4ce88dad13
15 changed files with 13 additions and 247 deletions

View File

@ -1315,9 +1315,7 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
if (sd->mode>=see_unit) {
struct demand * dmd = r->land->demands;
#if NEW_RESOURCEGROWTH
struct rawmaterial * res = r->resources;
#endif
fprintf(F, "%d;Silber\n", rmoney(r));
fprintf(F, "%d;Unterh\n", entertainmoney(r));
@ -1330,7 +1328,6 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
fprintf(F, "%d;Lohn\n", fwage(r, f, true));
}
#if NEW_RESOURCEGROWTH
while (res) {
int maxskill = 0;
int level = -1;
@ -1363,26 +1360,6 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
}
res = res->next;
}
#else
const unit * u;
int maxmining = 0;
for (u = r->units; u; u = u->next) {
if (u->faction == f) {
int s = eff_skill(u, SK_MINING, r);
maxmining = max(maxmining, s);
}
}
for (u = r->units; u; u = u->next) {
if (u->faction == f) {
int s = eff_skill(u, SK_MINING, r);
maxmining = max(maxmining, s);
}
}
if (maxmining >= 4 && riron(r) > 0)
fprintf(F, "%d;Eisen\n", riron(r));
if (maxmining >= 7 && rlaen(r) > 0)
fprintf(F, "%d;Laen\n", rlaen(r));
#endif
/* trade */
if (!TradeDisabled() && rpeasants(r)/TRADE_FRACTION > 0) {
fputs("PREISE\n", F);

View File

@ -1405,7 +1405,6 @@ required(int want, double save)
return norders;
}
#if NEW_RESOURCEGROWTH
static void
leveled_allocation(const allocator * self, region * r, allocation * alist)
{
@ -1474,7 +1473,6 @@ leveled_allocation(const allocator * self, region * r, allocation * alist)
} while (need>0);
}
}
#endif
static void
attrib_allocation(const allocator * self, region * r, allocation * alist)
@ -1537,9 +1535,7 @@ split_allocations(region * r)
assert(itype || !"not implemented for non-items");
i_change(&al->unit->items, itype, al->get);
produceexp(al->unit, itype->construction->skill, al->unit->number);
#if NEW_RESOURCEGROWTH
fset(r, RF_DH);
#endif
}
if (al->want==INT_MAX) al->want = al->get;
if (fval(al, AFL_LOWSKILL)) {
@ -3239,15 +3235,9 @@ 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));
#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));
add_allocator(make_allocator(&rt_seed, attrib_allocation));
add_allocator(make_allocator(&rt_mallornseed, attrib_allocation));
#else
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_LAEN]), attrib_allocation));
#endif
}

View File

@ -848,27 +848,6 @@ trees(region * r, const int current_season, const int last_weeks_season)
}
}
#if NEW_RESOURCEGROWTH == 0
extern attrib_type at_laen;
static void
iron(region * r)
{
if(is_cursed(r->attribs, C_CURSED_BY_THE_GODS, 0)) return;
#ifndef NO_GROWTH
if (rterrain(r) == T_MOUNTAIN) {
rsetiron(r, riron(r) + IRONPERTURN);
if(a_find(r->attribs, &at_laen)) {
rsetlaen(r, rlaen(r) + rand() % MAXLAENPERTURN);
}
} else if (rterrain(r) == T_GLACIER || rterrain(r) == T_ICEBERG_SLEEP) {
rsetiron(r, min(MAXGLIRON, riron(r)+GLIRONPERTURN));
}
#endif
}
#endif /* NEW_RESOURCEGROWTH */
void
demographics(void)
{
@ -910,11 +889,7 @@ demographics(void)
if(current_season != SEASON_WINTER) {
trees(r, current_season, last_weeks_season);
}
#if NEW_RESOURCEGROWTH
update_resources(r);
#else
iron(r);
#endif
migrate(r);
}
}

View File

@ -1089,7 +1089,6 @@ describe(FILE * F, const region * r, int partial, faction * f)
}
/* iron & stone */
#if NEW_RESOURCEGROWTH
if (partial == 0 && f != (faction *) NULL) {
struct rawmaterial * res;
for (res=r->resources;res;res=res->next) {
@ -1121,23 +1120,6 @@ describe(FILE * F, const region * r, int partial, faction * f)
res->level + itype->construction->minskill - 1);
}
}
#else
if (partial == 0 && f != (faction *) NULL) {
int maxmining = 0;
const unit * u;
for (u = r->units; u; u = u->next) {
if (u->faction == f) {
int s = eff_skill(u, SK_MINING, r);
maxmining = max(maxmining, s);
}
}
if (riron(r) > 0 && maxmining >= 4) {
bufp += sprinf(bufp, ", %d Eisen", riron(r));
}
if (rlaen(r)>=0 && maxmining >= 7) {
bufp += sprintf(bufp, ", %d Laen", rlaen(r));
}
#endif
}
/* peasants & silver */

View File

@ -1057,14 +1057,6 @@ limit_oldtypes(const region * r, const resource_type * rtype)
{
if (rtype==oldresourcetype[R_WOOD]) {
return rtrees(r,2) + rtrees(r,1);
#if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) {
return rlaen(r);
} else if (rtype==oldresourcetype[R_IRON]) {
return riron(r);
} else if (rtype==oldresourcetype[R_STONE]) {
return terrain[rterrain(r)].quarries;
#endif
} else if (rtype==oldresourcetype[R_MALLORN]) {
return rtrees(r,2) + rtrees(r,1);
} else if (rtype==oldresourcetype[R_HORSE]) {
@ -1101,16 +1093,6 @@ use_oldresource(region * r, const resource_type * rtype, int norders)
} else {
woodcounts(r, wcount*2);
}
#if NEW_RESOURCEGROWTH == 0
} else if (rtype==oldresourcetype[R_EOG]) {
int avail = rlaen(r);
assert(norders <= avail);
rsetlaen(r, avail-norders);
} else if (rtype==oldresourcetype[R_IRON]) {
int avail = riron(r);
assert(norders <= avail);
rsetiron(r, avail-norders);
#endif
} else if (rtype==oldresourcetype[R_HORSE]) {
int avail = rhorses(r);
assert(norders <= avail);

View File

@ -511,14 +511,9 @@ attrib_type at_travelunit = {
NO_READ
};
#if NEW_RESOURCEGROWTH
extern int laen_read(attrib * a, FILE * F);
# define LAEN_READ laen_read
# define LAEN_WRITE NULL
#else
# define LAEN_READ DEFAULT_READ
# define LAEN_WRITE DEFAULT_WRITE
#endif
#define LAEN_READ laen_read
#define LAEN_WRITE NULL
/***************/
/* at_laen */
@ -864,15 +859,12 @@ void
terraform(region * r, terrain_t t)
{
const struct locale * locale_de = find_locale("de");
#if NEW_RESOURCEGROWTH
rawmaterial **lrm;
int i;
#endif
/* defaults: */
rsetterrain(r, t);
#if NEW_RESOURCEGROWTH
/* Resourcen, die nicht mehr vorkommen können, löschen */
lrm = &r->resources;
while (*lrm) {
@ -887,12 +879,7 @@ terraform(region * r, terrain_t t)
lrm = &rm->next;
}
}
#endif
#if NEW_RESOURCEGROWTH == 0
rsetlaen(r, -1);
rsetiron(r, 0);
#endif
if (!landregion(t)) {
if (r->land) {
freeland(r->land);
@ -902,10 +889,6 @@ terraform(region * r, terrain_t t)
rsettrees(r, 1, 0);
rsettrees(r, 2, 0);
rsethorses(r, 0);
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, 0);
rsetlaen(r, -1);
#endif
rsetpeasants(r, 0);
rsetmoney(r, 0);
freset(r, RF_ENCOUNTER);
@ -1009,27 +992,13 @@ terraform(region * r, terrain_t t)
}
break;
case T_MOUNTAIN:
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, IRONSTART);
if (rand() % 100 < 8) rsetlaen(r, 5 + rand() % 5);
#endif
break;
case T_GLACIER:
#if NEW_RESOURCEGROWTH == 0
if (riron(r) <= 0){
rsetiron(r, GLIRONSTART);
}
#endif
break;
case T_ICEBERG_SLEEP:
/* Kann aus Gletscher entstehen und sollte diesem gleichen */
#if NEW_RESOURCEGROWTH == 0
if (riron(r) <= 0){
rsetiron(r, GLIRONSTART);
}
#endif
break;
case T_VOLCANO:
@ -1044,10 +1013,6 @@ terraform(region * r, terrain_t t)
rsettrees(r, 0, rtrees(r, 2)/2);
}
#if NEW_RESOURCEGROWTH
terraform_resources(r);
#endif
if (terrain[t].production_max && !fval(r, RF_CHAOTIC)) {
int peasants;
#if REDUCED_PEASANTGROWTH == 1

View File

@ -76,9 +76,6 @@ typedef struct land_region {
int peasants;
int newpeasants;
int money;
#if NEW_RESOURCEGROWTH == 0
int iron;
#endif
} land_region;
typedef struct donation {
@ -108,9 +105,7 @@ typedef struct region {
struct region *nexthash;
struct donation * donations;
terrain_t terrain;
#if NEW_RESOURCEGROWTH
struct rawmaterial * resources;
#endif
#ifdef FAST_CONNECT
struct region * connect[MAXDIRECTIONS];
#endif
@ -202,12 +197,6 @@ void rsethorses(const struct region * r, int value);
#define rbuildings(r) ((r)->buildings)
#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)
#endif /* NEW_RESOURCEGROWTH */
extern int rlaen(const struct region * r);
extern void rsetlaen(struct region * r, int value);

View File

@ -14,7 +14,6 @@
#include "eressea.h"
#include "resources.h"
#if NEW_RESOURCEGROWTH
/* kernel includes */
#include "build.h"
#include "item.h"
@ -193,27 +192,6 @@ struct rawmaterial_type rm_laen = {
visible_default
};
#if 0
static struct rawmaterial_type rm_mallorn = {
"rm_mallorn",
I_MALLORN, NULL,
terraform_trees,
update_trees,
use_trees,
NULL
};
static struct rawmaterial_type rm_trees = {
"rm_trees",
I_WOOD, NULL,
terraform_trees,
update_trees,
use_trees,
NULL
};
#endif
struct rawmaterial_type * rawmaterialtypes = 0;
struct rawmaterial_type *
@ -238,10 +216,4 @@ init_rawmaterials(void)
add_rawmaterial(&rm_stones);
add_rawmaterial(&rm_iron);
add_rawmaterial(&rm_laen);
#if 0
add_rawmaterial(&rm_wood);
add_rawmaterial(&rm_mallorn);
#endif
}
#endif

View File

@ -1388,7 +1388,6 @@ readregion(FILE * F, short x, short y)
rsettrees(r, 2, i);
}
i = ri(F); rsethorses(r, i);
#if NEW_RESOURCEGROWTH
if (global.data_version < NEWRESOURCE_VERSION) {
i = ri(F);
#if RESOURCE_CONVERSION
@ -1426,9 +1425,6 @@ readregion(FILE * F, short x, short y)
pres=&res->next;
}
}
#else
i = ri(F); rsetiron(r, i);
#endif
if (global.data_version>=ITEMTYPE_VERSION) {
rs(F, buf);
if (strcmp(buf, "noherb") != 0) {
@ -1502,9 +1498,7 @@ writeregion(FILE * F, const region * r)
wi(F, rtrees(r,1));
wi(F, rtrees(r,2));
wi(F, rhorses(r));
#if NEW_RESOURCEGROWTH == 0
wi(F, riron(r));
#elif RELEASE_VERSION>=NEWRESOURCE_VERSION
#if RELEASE_VERSION>=NEWRESOURCE_VERSION
{
rawmaterial * res = r->resources;
while (res) {

View File

@ -70,11 +70,9 @@ const terraindata_t terrain[] = {
1000, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LARGE_SHIPS|LAND_REGION, /* Flags */
plain_herbs,
#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} }
#endif
},
/* T_SWAMP */
{
@ -86,11 +84,9 @@ const terraindata_t terrain[] = {
200, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
swamp_herbs,
#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} }
#endif
},
/* T_DESERT */
{
@ -102,11 +98,9 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
desert_herbs,
#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} }
#endif
},
/* T_HIGHLAND */
{
@ -118,11 +112,9 @@ const terraindata_t terrain[] = {
400, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
highland_herbs,
#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} }
#endif
},
/* T_MOUNTAIN */
{
@ -134,11 +126,9 @@ const terraindata_t terrain[] = {
100, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
mountain_herbs,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 100.0 },
{ &rm_stones, "1", "100", "100", 100.0 },
{ &rm_laen, "1", "4", "100", 5.0} }
#endif
},
/* T_GLACIER */
{
@ -150,11 +140,9 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ &rm_laen, "1", "4", "100", 0.5} }
#endif
},
/* T_FIREWALL */
{
@ -220,11 +208,9 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
NULL,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 50.0 },
{ &rm_stones, "1", "100", "100", 50.0 },
{ &rm_laen, "1", "4", "100", 7.5} }
#endif
},
{
"activevolcano", 'V',
@ -235,11 +221,9 @@ const terraindata_t terrain[] = {
50, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
NULL,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "50", "50", 50.0 },
{ &rm_stones, "1", "100", "100", 50.0 },
{ &rm_laen, "1", "4", "100", 7.5} }
#endif
},
/* T_ICEBERG_SLEEP */
{
@ -251,11 +235,9 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ NULL, NULL, NULL, NULL, 100.0 } }
#endif
},
/* T_ICEBERG */
{
@ -267,11 +249,9 @@ const terraindata_t terrain[] = {
10, /* bewirtschaftbare Parzellen */
NORMAL_TERRAIN|LAND_REGION, /* Flags */
glacier_herbs,
#if NEW_RESOURCEGROWTH
{ { &rm_iron, "1", "3", "50", 100.0 },
{ &rm_stones, "1", "2", "100", 100.0 },
{ NULL, NULL, NULL, NULL, 100.0 } }
#endif
},
/* T_HALL1 */
{

View File

@ -81,7 +81,6 @@ typedef struct terraindata_t {
*/
unsigned int flags;
const char ** herbs;
#if NEW_RESOURCEGROWTH
struct {
const struct rawmaterial_type * type;
const char *startlevel;
@ -89,7 +88,6 @@ typedef struct terraindata_t {
const char *divisor;
double chance;
} rawmaterials[3];
#endif
} terraindata_t;
extern const terraindata_t terrain[];

View File

@ -1686,10 +1686,6 @@ sp_great_drought(castorder *co)
break;
case T_GLACIER:
#if NEW_RESOURCEGROWTH == 0
rsetiron(r, 0);
rsetlaen(r, -1);
#endif
if (rand() % 100 < 50){
rsetterrain(r, T_SWAMP);
destroy_all_roads(r);

View File

@ -236,9 +236,7 @@ game_init(void)
init_races();
init_itemtypes();
init_economy();
#if NEW_RESOURCEGROWTH
init_rawmaterials();
#endif
init_gmcmd();
#ifdef INFOCMD_MODULE

View File

@ -239,15 +239,11 @@ static int peasants, money, trees, horses, iron, laen, chaotisch;
static int ytrees, seeds;
#if NEW_RESOURCEGROWTH
static int ironlevel, laenlevel, stone, stonelevel;
#endif
static void
get_region(region *r) {
#if NEW_RESOURCEGROWTH
struct rawmaterial *res;
#endif
peasants = rpeasants(r);
money = rmoney(r);
@ -255,7 +251,6 @@ get_region(region *r) {
ytrees = rtrees(r,1);
seeds = rtrees(r,0);
horses = rhorses(r);
#if NEW_RESOURCEGROWTH
iron = -1;
ironlevel = -1;
laen = -1;
@ -275,18 +270,12 @@ get_region(region *r) {
stonelevel = res->level + itype->construction->minskill - 1;
}
}
#else
iron = riron(r);
laen = rlaen(r);
#endif
chaotisch = fval(r, RF_CHAOTIC);
}
static void
put_region(region *r) {
#if NEW_RESOURCEGROWTH
struct rawmaterial *res;
#endif
rsetpeasants(r, peasants);
rsetmoney(r,money);
@ -294,7 +283,7 @@ put_region(region *r) {
rsettrees(r,1,ytrees);
rsettrees(r,0,seeds);
rsethorses(r, horses);
#if NEW_RESOURCEGROWTH
for (res=r->resources;res;res=res->next) {
const item_type * itype = resource2item(res->type->rtype);
if(itype == olditemtype[I_IRON]) {
@ -308,10 +297,6 @@ put_region(region *r) {
res->level = stonelevel - itype->construction->minskill + 1;
}
}
#else
rsetiron(r, iron);
rsetlaen(r, laen);
#endif
if (chaotisch) fset(r, RF_CHAOTIC); else freset(r, RF_CHAOTIC);
}
@ -338,7 +323,7 @@ create_region_menu(menulist ** menu, region * r)
addmenulist(menu, "Seeds", &seeds);
}
addmenulist(menu, "Horses", &horses);
#if NEW_RESOURCEGROWTH
/* if(iron != -1) { */
addmenulist(menu, "Iron", &iron);
addmenulist(menu, "Ironlevel", &ironlevel);
@ -351,12 +336,6 @@ create_region_menu(menulist ** menu, region * r)
addmenulist(menu, "Stone", &stone);
addmenulist(menu, "Stonelevel", &stonelevel);
/* } */
#else
if (r->terrain == T_MOUNTAIN || r->terrain == T_GLACIER) {
addmenulist(menu, "Iron", &iron);
addmenulist(menu, "Laen", &laen);
}
#endif
addmenulist(menu, "Chaos-Factor", &chaotisch);
if (r->planep) {

View File

@ -325,7 +325,6 @@ alliancehere(region * r, int allied)
return false;
}
#if NEW_RESOURCEGROWTH
static boolean
has_laen(region *r)
{
@ -336,14 +335,6 @@ has_laen(region *r)
}
return false;
}
#else
static boolean
has_laen(region *r)
{
if(rlaen(r) >= 0) return true;
return false;
}
#endif
static int
crwritemap(void)
@ -1666,9 +1657,7 @@ main(int argc, char *argv[])
init_locales();
init_attributes();
#if NEW_RESOURCEGROWTH
init_rawmaterials();
#endif
init_gmcmd();