Fixing the tunnels and cleaning up a bit.

This commit is contained in:
Enno Rehling 2008-06-16 17:29:53 +00:00
parent 615d948021
commit 328bf5a623
17 changed files with 70 additions and 67 deletions

View File

@ -468,7 +468,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
if (rc == new_race[RC_INSECT]) { if (rc == new_race[RC_INSECT]) {
gamedate date; gamedate date;
get_gamedate(turn, &date); get_gamedate(turn, &date);
if (date.season == 0 && rterrain(r) != T_DESERT) { if (date.season == 0 && r->terrain != newterrain(T_DESERT)) {
#ifdef INSECT_POTION #ifdef INSECT_POTION
boolean usepotion = false; boolean usepotion = false;
unit *u2; unit *u2;
@ -1984,7 +1984,7 @@ buy(unit * u, request ** buyorders, struct order * ord)
if (u->race == new_race[RC_INSECT]) { if (u->race == new_race[RC_INSECT]) {
/* entweder man ist insekt, oder... */ /* entweder man ist insekt, oder... */
if (r->terrain != newterrain(T_SWAMP) && rterrain(r) != T_DESERT && !rbuildings(r)) { if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT) && !rbuildings(r)) {
cmistake(u, ord, 119, MSG_COMMERCE); cmistake(u, ord, 119, MSG_COMMERCE);
return; return;
} }
@ -2113,7 +2113,7 @@ expandselling(region * r, request * sellorders, int limit)
max_products = rpeasants(r) / TRADE_FRACTION; max_products = rpeasants(r) / TRADE_FRACTION;
if (max_products <= 0) return; if (max_products <= 0) return;
if (rterrain(r) == T_DESERT && buildingtype_exists(r, bt_find("caravan"))) { if (r->terrain == newterrain(T_DESERT) && buildingtype_exists(r, bt_find("caravan"))) {
max_products = rpeasants(r) * 2 / TRADE_FRACTION; max_products = rpeasants(r) * 2 / TRADE_FRACTION;
} }
/* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro /* Verkauf: so programmiert, dass er leicht auf mehrere Gueter pro
@ -2255,7 +2255,7 @@ static boolean
if (findparam(s, u->faction->locale) == P_ANY) { if (findparam(s, u->faction->locale) == P_ANY) {
unlimited = false; unlimited = false;
n = rpeasants(r) / TRADE_FRACTION; n = rpeasants(r) / TRADE_FRACTION;
if (rterrain(r) == T_DESERT && buildingtype_exists(r, bt_find("caravan"))) if (r->terrain == newterrain(T_DESERT) && buildingtype_exists(r, bt_find("caravan")))
n *= 2; n *= 2;
if (n==0) { if (n==0) {
cmistake(u, ord, 303, MSG_COMMERCE); cmistake(u, ord, 303, MSG_COMMERCE);
@ -2278,7 +2278,7 @@ static boolean
/* In der Region muß es eine Burg geben. */ /* In der Region muß es eine Burg geben. */
if (u->race == new_race[RC_INSECT]) { if (u->race == new_race[RC_INSECT]) {
if (r->terrain != newterrain(T_SWAMP) && rterrain(r) != T_DESERT && !rbuildings(r)) { if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT) && !rbuildings(r)) {
cmistake(u, ord, 119, MSG_COMMERCE); cmistake(u, ord, 119, MSG_COMMERCE);
return false; return false;
} }
@ -3269,7 +3269,7 @@ produce(void)
if (sellorders) { if (sellorders) {
int limit = rpeasants(r) / TRADE_FRACTION; int limit = rpeasants(r) / TRADE_FRACTION;
if (rterrain(r) == T_DESERT && buildingtype_exists(r, bt_find("caravan"))) if (r->terrain == newterrain(T_DESERT) && buildingtype_exists(r, bt_find("caravan")))
limit *= 2; limit *= 2;
expandselling(r, sellorders, limited?limit:INT_MAX); expandselling(r, sellorders, limited?limit:INT_MAX);
} }

View File

@ -408,7 +408,7 @@ calculate_emigration(region *r)
int rp = rpeasants(r); int rp = rpeasants(r);
int max_immigrants = MAX_IMMIGRATION(maxp-rp); int max_immigrants = MAX_IMMIGRATION(maxp-rp);
if (rterrain(r) == T_VOLCANO || rterrain(r) == T_VOLCANO_SMOKING) { if (r->terrain == newterrain(T_VOLCANO) || r->terrain == newterrain(T_VOLCANO_SMOKING)) {
max_immigrants = max_immigrants/10; max_immigrants = max_immigrants/10;
} }

View File

@ -1063,7 +1063,7 @@ spawn_dragons(void)
equip_unit(u, get_equipment("monster_seaserpent")); equip_unit(u, get_equipment("monster_seaserpent"));
} }
if ((rterrain(r) == T_GLACIER || r->terrain == newterrain(T_SWAMP) || rterrain(r) == T_DESERT) && rng_int() % 10000 < (5 + 100 * chaosfactor(r))) if ((r->terrain == newterrain(T_GLACIER) || r->terrain == newterrain(T_SWAMP) || r->terrain == newterrain(T_DESERT)) && rng_int() % 10000 < (5 + 100 * chaosfactor(r)))
{ {
if (chance(0.80)) { if (chance(0.80)) {
u = createunit(r, monsters, nrand(60, 20) + 1, new_race[RC_FIREDRAGON]); u = createunit(r, monsters, nrand(60, 20) + 1, new_race[RC_FIREDRAGON]);

View File

@ -491,7 +491,7 @@ chaos(region * r)
while (r->buildings) { while (r->buildings) {
remove_building(&r->buildings, r->buildings); remove_building(&r->buildings, r->buildings);
} }
terraform(r, T_OCEAN); terraform_region(r, newterrain(T_OCEAN));
} }
} else { } else {
direction_t dir; direction_t dir;
@ -778,7 +778,7 @@ melt_iceberg(region *r)
} }
/* in Ozean wandeln */ /* in Ozean wandeln */
terraform(r, T_OCEAN); terraform_region(r, newterrain(T_OCEAN));
/* Einheiten, die nicht schwimmen können oder in Schiffen sind, /* Einheiten, die nicht schwimmen können oder in Schiffen sind,
* ertrinken */ * ertrinken */
@ -904,7 +904,7 @@ move_icebergs(void)
region *r; region *r;
for (r=regions; r; r=r->next) { for (r=regions; r; r=r->next) {
if (rterrain(r) == T_ICEBERG && !fval(r, RF_SELECT)) { if (r->terrain == newterrain(T_ICEBERG) && !fval(r, RF_SELECT)) {
int select = rng_int() % 10; int select = rng_int() % 10;
if (select < 4) { if (select < 4) {
/* 4% chance */ /* 4% chance */
@ -925,7 +925,7 @@ create_icebergs(void)
region *r; region *r;
for (r=regions; r; r=r->next) { for (r=regions; r; r=r->next) {
if (rterrain(r) == T_ICEBERG_SLEEP && chance(0.05)) { if (r->terrain == newterrain(T_ICEBERG_SLEEP) && chance(0.05)) {
boolean has_ocean_neighbour = false; boolean has_ocean_neighbour = false;
direction_t dir; direction_t dir;
region *rc; region *rc;
@ -1216,7 +1216,7 @@ randomevents(void)
/* Vulkane qualmen, brechen aus ... */ /* Vulkane qualmen, brechen aus ... */
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
if (rterrain(r)==T_VOLCANO_SMOKING && a_find(r->attribs, &at_reduceproduction)) { if (r->terrain == newterrain(T_VOLCANO_SMOKING) && a_find(r->attribs, &at_reduceproduction)) {
ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r)); ADDMSG(&r->msgs, msg_message("volcanostopsmoke", "region", r));
rsetterrain(r, T_VOLCANO); rsetterrain(r, T_VOLCANO);
} else switch(rterrain(r)) { } else switch(rterrain(r)) {

View File

@ -348,9 +348,9 @@ make_summary(void)
if (fval(r, RF_ORCIFIED)) { if (fval(r, RF_ORCIFIED)) {
s->orkifizierte_regionen++; s->orkifizierte_regionen++;
} }
if (rterrain(r) == T_VOLCANO) { if (r->terrain == newterrain(T_VOLCANO)) {
s->inactive_volcanos++; s->inactive_volcanos++;
} else if(rterrain(r) == T_VOLCANO_SMOKING) { } else if (r->terrain == newterrain(T_VOLCANO_SMOKING)) {
s->active_volcanos++; s->active_volcanos++;
} }
} }

View File

@ -3523,9 +3523,9 @@ static void
flee(const troop dt) flee(const troop dt)
{ {
fighter * fig = dt.fighter; fighter * fig = dt.fighter;
unit * u = fig->unit;
#ifndef SIMPLE_ESCAPE #ifndef SIMPLE_ESCAPE
unit * u = fig->unit;
int carry = personcapacity(u) - u->race->weight; int carry = personcapacity(u) - u->race->weight;
int money; int money;

View File

@ -1783,8 +1783,10 @@ sail(unit * u, order * ord, boolean move_on_land, region_list **routep)
} }
if (sh->damage>=sh->size * DAMAGE_SCALE) { if (sh->damage>=sh->size * DAMAGE_SCALE) {
if (sh->region) {
ADDMSG(&f->msgs, msg_message("shipsink", "ship", sh)); ADDMSG(&f->msgs, msg_message("shipsink", "ship", sh));
remove_ship(&sh->region->ships, sh); remove_ship(&sh->region->ships, sh);
}
sh = NULL; sh = NULL;
} }

View File

@ -1046,12 +1046,6 @@ setluxuries(region * r, const luxury_type * sale)
} }
} }
void
terraform(region * r, terrain_t t)
{
terraform_region(r, newterrain(t));
}
void void
terraform_region(region * r, const terrain_type * terrain) terraform_region(region * r, const terrain_type * terrain)
{ {

View File

@ -222,7 +222,6 @@ extern const char * write_regionname(const struct region * r, const struct facti
extern struct region * new_region(short x, short y, unsigned int uid); extern struct region * new_region(short x, short y, unsigned int uid);
extern void remove_region(region ** rlist, region * r); extern void remove_region(region ** rlist, region * r);
extern void terraform(struct region * r, terrain_t terrain);
extern void terraform_region(struct region * r, const struct terrain_type * terrain); extern void terraform_region(struct region * r, const struct terrain_type * terrain);
extern const short delta_x[MAXDIRECTIONS]; extern const short delta_x[MAXDIRECTIONS];

View File

@ -145,8 +145,6 @@ init_terrains(void)
newterrain = get_terrain(terraindata[t]); newterrain = get_terrain(terraindata[t]);
if (newterrain!=NULL) { if (newterrain!=NULL) {
newterrains[t] = newterrain; newterrains[t] = newterrain;
} else {
log_warning(("missing classic terrain %s\n", terraindata[t]));
} }
} }
} }

View File

@ -291,14 +291,15 @@ read_newfactions(const char * filename)
extern int numnewbies; extern int numnewbies;
static terrain_t static const terrain_type *
preferred_terrain(const struct race * rc) preferred_terrain(const struct race * rc)
{ {
if (rc==rc_find("dwarf")) return T_MOUNTAIN; terrain_t t = T_PLAIN;
if (rc==rc_find("insect")) return T_DESERT; if (rc==rc_find("dwarf")) t = T_MOUNTAIN;
if (rc==rc_find("halfling")) return T_SWAMP; if (rc==rc_find("insect")) t = T_DESERT;
if (rc==rc_find("troll")) return T_MOUNTAIN; if (rc==rc_find("halfling")) t = T_SWAMP;
return T_PLAIN; if (rc==rc_find("troll")) t = T_MOUNTAIN;
return newterrain(t);
} }
#define REGIONS_PER_FACTION 2 #define REGIONS_PER_FACTION 2
@ -413,20 +414,20 @@ free_newfaction(newfaction * nf)
* returns the number of players placed on the new island. * returns the number of players placed on the new island.
*/ */
static void static void
frame_regions(int age, terrain_t terrain) frame_regions(int age, const terrain_type * terrain)
{ {
region * r = regions; region * r = regions;
for (r=regions;r;r=r->next) { for (r=regions;r;r=r->next) {
direction_t d; direction_t d;
if (r->age<age) continue; if (r->age<age) continue;
if (r->planep) continue; if (r->planep) continue;
if (rterrain(r)==terrain) continue; if (r->terrain == terrain) continue;
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d); region * rn = rconnect(r, d);
if (rn==NULL) { if (rn==NULL) {
rn = new_region(r->x+delta_x[d], r->y+delta_y[d], 0); rn = new_region(r->x+delta_x[d], r->y+delta_y[d], 0);
terraform(rn, terrain); terraform_region(rn, terrain);
rn->age=r->age; rn->age=r->age;
} }
} }
@ -475,7 +476,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
int psize = 0; /* players on this island */ int psize = 0; /* players on this island */
const terrain_type * volcano_terrain = get_terrain("volcano"); const terrain_type * volcano_terrain = get_terrain("volcano");
frame_regions(16, T_FIREWALL); frame_regions(16, newterrain(T_FIREWALL));
if (listlen(*players)<MINFACTIONS) return 0; if (listlen(*players)<MINFACTIONS) return 0;
@ -486,7 +487,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
*/ */
for (r=regions;r;r=r->next) { for (r=regions;r;r=r->next) {
struct plane * p = r->planep; struct plane * p = r->planep;
if (r->age<=max_agediff && rterrain(r)==T_OCEAN && p==NULL && virgin_region(r)) { if (r->age<=max_agediff && r->terrain == newterrain(T_OCEAN) && p==NULL && virgin_region(r)) {
direction_t d; direction_t d;
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d); region * rn = rconnect(r, d);
@ -533,7 +534,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
*/ */
for (r=regions;r;r=r->next) { for (r=regions;r;r=r->next) {
struct plane * p = r->planep; struct plane * p = r->planep;
if (rterrain(r)==T_OCEAN && p==0 && (rmin==NULL || r->age<=max_agediff)) { if (r->terrain == newterrain(T_OCEAN) && p==0 && (rmin==NULL || r->age<=max_agediff)) {
direction_t d; direction_t d;
for (d=0;d!=MAXDIRECTIONS;++d) { for (d=0;d!=MAXDIRECTIONS;++d) {
region * rn = rconnect(r, d); region * rn = rconnect(r, d);
@ -554,7 +555,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
x = rmin->x + delta_x[dmin]; x = rmin->x + delta_x[dmin];
y = rmin->y + delta_y[dmin]; y = rmin->y + delta_y[dmin];
r = new_region(x, y, 0); r = new_region(x, y, 0);
terraform(r, T_OCEAN); /* we change the terrain later */ terraform_region(r, newterrain(T_OCEAN));
} }
} }
if (r!=NULL) { if (r!=NULL) {
@ -580,7 +581,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
if (rn && fval(rn, RF_MARK)) continue; if (rn && fval(rn, RF_MARK)) continue;
if (rn==NULL) { if (rn==NULL) {
rn = new_region(r->x + delta_x[d], r->y + delta_y[d], 0); rn = new_region(r->x + delta_x[d], r->y + delta_y[d], 0);
terraform(rn, T_OCEAN); terraform_region(rn, newterrain(T_OCEAN));
} }
if (virgin_region(rn)) { if (virgin_region(rn)) {
add_regionlist(&rlist, rn); add_regionlist(&rlist, rn);
@ -596,7 +597,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
unit * u; unit * u;
isize += REGIONS_PER_FACTION; isize += REGIONS_PER_FACTION;
terraform(r, preferred_terrain(nextf->race)); terraform_region(r, preferred_terrain(nextf->race));
prepare_starting_region(r); prepare_starting_region(r);
++tsize; ++tsize;
assert(r->land && r->units==0); assert(r->land && r->units==0);
@ -689,7 +690,7 @@ autoseed(newfaction ** players, int nsize, int max_agediff)
if (i!=MAXFILLDIST) { if (i!=MAXFILLDIST) {
while (--i) { while (--i) {
region * rn = new_region(r->x + i*delta_x[d], r->y + i*delta_y[d], 0); region * rn = new_region(r->x + i*delta_x[d], r->y + i*delta_y[d], 0);
terraform(rn, T_OCEAN); terraform_region(rn, newterrain(T_OCEAN));
} }
} }
} }

View File

@ -643,11 +643,11 @@ gm_addquest(const char * email, const char * name, short radius, unsigned int fl
freset(r, RF_ENCOUNTER); freset(r, RF_ENCOUNTER);
r->planep = p; r->planep = p;
if (distance(r, center)==radius) { if (distance(r, center)==radius) {
terraform(r, T_FIREWALL); terraform_region(r, newterrain(T_FIREWALL));
} else if (r==center) { } else if (r==center) {
terraform(r, T_PLAIN); terraform_region(r, newterrain(T_PLAIN));
} else { } else {
terraform(r, T_OCEAN); terraform_region(r, newterrain(T_OCEAN));
} }
} }
} }
@ -757,11 +757,11 @@ gm_addplane(short radius, unsigned int flags, const char * name)
freset(r, RF_ENCOUNTER); freset(r, RF_ENCOUNTER);
r->planep = p; r->planep = p;
if (distance(r, center)==radius) { if (distance(r, center)==radius) {
terraform(r, T_FIREWALL); terraform_region(r, newterrain(T_FIREWALL));
} else if (r==center) { } else if (r==center) {
terraform(r, T_PLAIN); terraform_region(r, newterrain(T_PLAIN));
} else { } else {
terraform(r, T_OCEAN); terraform_region(r, newterrain(T_OCEAN));
} }
} }
} }

View File

@ -2135,7 +2135,7 @@ sp_ironkeeper(castorder *co)
int cast_level = co->level; int cast_level = co->level;
message * msg; message * msg;
if (rterrain(r) != T_MOUNTAIN && rterrain(r) != T_GLACIER) { if (r->terrain != newterrain(T_MOUNTAIN) && r->terrain != newterrain(T_GLACIER)) {
report_failure(mage, co->order); report_failure(mage, co->order);
return 0; return 0;
} }
@ -2547,8 +2547,8 @@ sp_summondragon(castorder *co)
f = get_monsters(); f = get_monsters();
if (r->terrain != newterrain(T_SWAMP) && rterrain(r) != T_DESERT if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
&& rterrain(r) != T_GLACIER) { && r->terrain != newterrain(T_GLACIER)) {
report_failure(mage, co->order); report_failure(mage, co->order);
return 0; return 0;
} }

View File

@ -97,7 +97,7 @@ curse_emptiness(void)
unit * u = r->units; unit * u = r->units;
if (r->land==NULL) continue; if (r->land==NULL) continue;
if (fval(r, RF_CHAOTIC)) continue; if (fval(r, RF_CHAOTIC)) continue;
if (rterrain(r)==T_GLACIER) continue; if (r->terrain == newterrain(T_GLACIER)) continue;
if (r->age<=200) continue; if (r->age<=200) continue;
if (get_curse(r->attribs, ct)) continue; if (get_curse(r->attribs, ct)) continue;
while (u && is_monsters(u->faction)) u=u->next; while (u && is_monsters(u->faction)) u=u->next;
@ -440,13 +440,13 @@ road_decay(void)
half = true; half = true;
} }
} }
else if (rterrain(r) == T_DESERT) { else if (r->terrain == newterrain(T_DESERT)) {
/* wenn keine Karawanserei existiert */ /* wenn keine Karawanserei existiert */
if (!buildingtype_exists(r, bt_caravan)) { if (!buildingtype_exists(r, bt_caravan)) {
half = true; half = true;
} }
} }
else if (rterrain(r) == T_GLACIER) { else if (r->terrain == newterrain(T_GLACIER)) {
/* wenn kein Tunnel existiert */ /* wenn kein Tunnel existiert */
if (!buildingtype_exists(r, bt_tunnel)) { if (!buildingtype_exists(r, bt_tunnel)) {
half = true; half = true;
@ -484,7 +484,7 @@ iceberg(region * r)
} }
} }
if (d==MAXDIRECTIONS) { if (d==MAXDIRECTIONS) {
terraform(r, T_ICEBERG_SLEEP); terraform_region(r, newterrain(T_ICEBERG_SLEEP));
} }
} }
@ -528,9 +528,9 @@ fix_astralplane(void)
while (*rs_p) { while (*rs_p) {
region * rs = *rs_p; region * rs = *rs_p;
if (rterrain(rs)==T_FIREWALL && rplane(rs)==NULL) { if (rs->terrain == newterrain(T_FIREWALL) && rplane(rs)==NULL) {
region * ra = r_standard_to_astral(rs); region * ra = r_standard_to_astral(rs);
if (ra && rterrain(ra)!=T_ASTRALB) { if (ra && ra->terrain != newterrain(T_ASTRALB)) {
unit * u; unit * u;
++fixes; ++fixes;
for (u=ra->units;u;u=u->next) { for (u=ra->units;u;u=u->next) {
@ -544,7 +544,7 @@ fix_astralplane(void)
remove_unit(&ra->units, ra->units); remove_unit(&ra->units, ra->units);
} }
log_printf("protecting firewall in %s by blocking astral space in %s.\n", regionname(rs, NULL), regionname(ra, NULL)); log_printf("protecting firewall in %s by blocking astral space in %s.\n", regionname(rs, NULL), regionname(ra, NULL));
terraform(ra, T_ASTRALB); terraform_region(ra, newterrain(T_ASTRALB));
} }
} }
} }
@ -747,8 +747,8 @@ fix_astral_firewalls(void)
{ {
region * r; region * r;
for (r = regions; r; r=r->next) { for (r = regions; r; r=r->next) {
if (r->planep==get_astralplane() && rterrain(r)==T_FIREWALL) { if (r->planep==get_astralplane() && r->terrain == newterrain(T_FIREWALL)) {
terraform(r, T_ASTRALB); terraform_region(r, newterrain(T_ASTRALB));
} }
} }
return 0; return 0;

View File

@ -169,7 +169,7 @@ static eressea::list<unit *, unit *, buildingunit>
building_units(const building& b) { building_units(const building& b) {
region * r = b.region; region * r = b.region;
unit * u = r->units; unit * u = r->units;
while (u!=NULL && u->building!=&b) u=u->next; while (u!=NULL && (!u->building || u->building->no!=b.no)) u=u->next;
return eressea::list<unit *, unit *, buildingunit>(u); return eressea::list<unit *, unit *, buildingunit>(u);
} }

View File

@ -358,6 +358,10 @@
</string> </string>
<!-- igjarjuk queste end --> <!-- igjarjuk queste end -->
<string name="rm_adamantium">
<text locale="de">Adamantium</text>
<text locale="en">adamantium</text>
</string>
<string name="adamantium"> <string name="adamantium">
<text locale="de">Adamantium</text> <text locale="de">Adamantium</text>
<text locale="en">adamantium</text> <text locale="en">adamantium</text>

View File

@ -1,6 +1,9 @@
local function tunnel_travellers(b) local function tunnel_travelers(b)
local units = {} local units = nil
for u in b.units do for u in b.units do
if units==nil then
units = {}
end
units[u] = u units[u] = u
end end
return units return units
@ -10,6 +13,7 @@ targets = nil
ntargets = 0 ntargets = 0
local function get_target(param) local function get_target(param)
-- print("finding targets: " .. param)
if targets == nil then if targets == nil then
targets = {} targets = {}
local r local r
@ -17,6 +21,7 @@ local function get_target(param)
if r:get_key(param) then if r:get_key(param) then
targets[ntargets] = r targets[ntargets] = r
ntargets = ntargets + 1 ntargets = ntargets + 1
-- print("target: " .. tostring(r))
end end
end end
end end
@ -30,12 +35,12 @@ end
-- export, will be called from lc_age() -- export, will be called from lc_age()
function tunnel_action(b, param) function tunnel_action(b, param)
local r = nil local r = nil
print("Tunnel from " .. tostring(b) .. " [" .. param .. "]")
if tonumber(param)~=nil then if tonumber(param)~=nil then
r = get_region_by_id(tonumber(param)) r = get_region_by_id(tonumber(param))
end end
if r~=nil then
local units = tunnel_travelers(b) local units = tunnel_travelers(b)
if units~=nil then
print("Tunnel from " .. tostring(b) .. " [" .. param .. "]")
for key, u in pairs(units) do for key, u in pairs(units) do
local rto = r local rto = r
if r==nil then if r==nil then