forked from github/server
newterrain sucks.
This commit is contained in:
parent
440679da87
commit
96ff0815c4
2 changed files with 13 additions and 16 deletions
|
@ -1067,7 +1067,7 @@ static int required(int want, variant save)
|
||||||
{
|
{
|
||||||
int req = (int)(want * save.sa[0] / save.sa[1]);
|
int req = (int)(want * save.sa[0] / save.sa[1]);
|
||||||
int r = want * save.sa[0] % save.sa[1];
|
int r = want * save.sa[0] % save.sa[1];
|
||||||
if (r>0) ++req;
|
if (r > 0) ++req;
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1173,7 +1173,7 @@ attrib_allocation(const resource_type * rtype, region * r, allocation * alist)
|
||||||
int x = avail * want / nreq;
|
int x = avail * want / nreq;
|
||||||
int rx = (avail * want) % nreq;
|
int rx = (avail * want) % nreq;
|
||||||
/* Wenn Rest, dann wuerfeln, ob ich was bekomme: */
|
/* Wenn Rest, dann wuerfeln, ob ich was bekomme: */
|
||||||
if (rx>0 && rng_int() % nreq < rx) ++x;
|
if (rx > 0 && rng_int() % nreq < rx) ++x;
|
||||||
avail -= x;
|
avail -= x;
|
||||||
nreq -= want;
|
nreq -= want;
|
||||||
al->get = x * al->save.sa[1] / al->save.sa[0];
|
al->get = x * al->save.sa[1] / al->save.sa[0];
|
||||||
|
@ -1590,17 +1590,10 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u_race(u) == get_race(RC_INSECT)) {
|
/* Entweder man ist Insekt in Sumpf/Wueste, oder es muss
|
||||||
/* entweder man ist insekt, oder... */
|
* einen Handelsposten in der Region geben: */
|
||||||
if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
|
if (u_race(u) != get_race(RC_INSECT) || (r->terrain == newterrain(T_SWAMP) || r->terrain == newterrain(T_DESERT))) {
|
||||||
&& !rbuildings(r)) {
|
building *b = NULL;
|
||||||
cmistake(u, ord, 119, MSG_COMMERCE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* ...oder in der Region mu<6D> es eine Burg geben. */
|
|
||||||
building *b = 0;
|
|
||||||
if (r->buildings) {
|
if (r->buildings) {
|
||||||
static int cache;
|
static int cache;
|
||||||
static const struct building_type *bt_castle;
|
static const struct building_type *bt_castle;
|
||||||
|
@ -2719,7 +2712,7 @@ static void expandloot(region * r, request * lootorders)
|
||||||
|
|
||||||
/* Lowering morale by 1 depending on the looted money (+20%) */
|
/* Lowering morale by 1 depending on the looted money (+20%) */
|
||||||
m = region_get_morale(r);
|
m = region_get_morale(r);
|
||||||
if (m && startmoney>0) {
|
if (m && startmoney > 0) {
|
||||||
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
|
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
|
||||||
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
|
/*Nur Moral -1, turns is not changed, so the first time nothing happens if the morale is good*/
|
||||||
region_set_morale(r, m - 1, -1);
|
region_set_morale(r, m - 1, -1);
|
||||||
|
|
|
@ -181,7 +181,9 @@ static void setup_terrains(CuTest *tc) {
|
||||||
test_create_terrain("ocean", SEA_REGION | SWIM_INTO | FLY_INTO);
|
test_create_terrain("ocean", SEA_REGION | SWIM_INTO | FLY_INTO);
|
||||||
test_create_terrain("swamp", LAND_REGION | WALK_INTO | FLY_INTO);
|
test_create_terrain("swamp", LAND_REGION | WALK_INTO | FLY_INTO);
|
||||||
test_create_terrain("desert", LAND_REGION | WALK_INTO | FLY_INTO);
|
test_create_terrain("desert", LAND_REGION | WALK_INTO | FLY_INTO);
|
||||||
|
test_create_terrain("mountain", LAND_REGION | WALK_INTO | FLY_INTO);
|
||||||
init_terrains();
|
init_terrains();
|
||||||
|
CuAssertPtrNotNull(tc, newterrain(T_MOUNTAIN));
|
||||||
CuAssertPtrNotNull(tc, newterrain(T_OCEAN));
|
CuAssertPtrNotNull(tc, newterrain(T_OCEAN));
|
||||||
CuAssertPtrNotNull(tc, newterrain(T_PLAIN));
|
CuAssertPtrNotNull(tc, newterrain(T_PLAIN));
|
||||||
CuAssertPtrNotNull(tc, newterrain(T_SWAMP));
|
CuAssertPtrNotNull(tc, newterrain(T_SWAMP));
|
||||||
|
@ -225,7 +227,7 @@ static void test_trade_insect(CuTest *tc) {
|
||||||
init_resources();
|
init_resources();
|
||||||
test_create_locale();
|
test_create_locale();
|
||||||
setup_terrains(tc);
|
setup_terrains(tc);
|
||||||
r = setup_trade_region(tc, test_create_terrain("swamp", LAND_REGION));
|
r = setup_trade_region(tc, get_terrain("swamp"));
|
||||||
init_terrains();
|
init_terrains();
|
||||||
|
|
||||||
it_luxury = r_luxury(r);
|
it_luxury = r_luxury(r);
|
||||||
|
@ -240,6 +242,8 @@ static void test_trade_insect(CuTest *tc) {
|
||||||
produce(u->region);
|
produce(u->region);
|
||||||
CuAssertIntEquals(tc, 1, get_item(u, it_luxury));
|
CuAssertIntEquals(tc, 1, get_item(u, it_luxury));
|
||||||
CuAssertIntEquals(tc, 5, get_item(u, it_silver));
|
CuAssertIntEquals(tc, 5, get_item(u, it_silver));
|
||||||
|
|
||||||
|
terraform_region(r, get_terrain("swamp"));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue