forked from github/server
Schiffe mit Insekten können nciht mehr in Gletscher einlaufen.
This commit is contained in:
parent
7bf7b22446
commit
44bf6ab22b
|
@ -405,6 +405,7 @@ cansail(const region * r, ship * sh)
|
||||||
}
|
}
|
||||||
if (n > shipcapacity(sh)) return false;
|
if (n > shipcapacity(sh)) return false;
|
||||||
if (p > sh->type->cabins) return false;
|
if (p > sh->type->cabins) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,19 +572,44 @@ check_working_buildingtype(const region * r, const building_type * bt)
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
ship_allowed(const struct ship_type * type, const region * r)
|
is_freezing(const unit * u)
|
||||||
|
{
|
||||||
|
if (old_race(u->race)!=RC_INSECT) return false;
|
||||||
|
if (is_cursed(u->attribs, C_KAELTESCHUTZ, 0)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
ship_allowed(const struct ship * sh, const region * r)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
terrain_t t = rterrain(r);
|
terrain_t t = rterrain(r);
|
||||||
|
|
||||||
static const building_type * bt_harbour=NULL;
|
static const building_type * bt_harbour=NULL;
|
||||||
|
|
||||||
if (bt_harbour==NULL) bt_harbour=bt_find("harbour");
|
if (bt_harbour==NULL) bt_harbour=bt_find("harbour");
|
||||||
|
|
||||||
if (check_working_buildingtype(r, bt_harbour)) return true;
|
if (r_insectstalled(r)) {
|
||||||
|
/* insekten dürfen nicht hier rein. haben wir welche? */
|
||||||
|
unit * u;
|
||||||
|
|
||||||
for (c=0;type->coast[c]!=NOTERRAIN;++c) {
|
for (u=sh->region->units;u!=NULL;u=u->next) {
|
||||||
if (type->coast[c]==t) return true;
|
if (u->ship!=sh) continue;
|
||||||
|
|
||||||
|
if (is_freezing(u)) {
|
||||||
|
unit * captain = shipowner(sh);
|
||||||
|
ADDMSG(&captain->faction->msgs, msg_message("detectforbidden",
|
||||||
|
"unit region", u, r));
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check_working_buildingtype(r, bt_harbour)) return true;
|
||||||
|
for (c=0;sh->type->coast[c]!=NOTERRAIN;++c) {
|
||||||
|
if (sh->type->coast[c]==t) return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +666,7 @@ drifting_ships(region * r)
|
||||||
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
region * rn = rconnect(r, (direction_t)((d + d_offset) % MAXDIRECTIONS));
|
region * rn = rconnect(r, (direction_t)((d + d_offset) % MAXDIRECTIONS));
|
||||||
terrain_t t = rterrain(rn);
|
terrain_t t = rterrain(rn);
|
||||||
if (rn!=NULL && (terrain[t].flags & SAIL_INTO) && ship_allowed(sh->type, rn)) {
|
if (rn!=NULL && (terrain[t].flags & SAIL_INTO) && ship_allowed(sh, rn)) {
|
||||||
rnext = rn;
|
rnext = rn;
|
||||||
if (t!=T_OCEAN) break;
|
if (t!=T_OCEAN) break;
|
||||||
}
|
}
|
||||||
|
@ -1234,8 +1260,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_race(u->race) == RC_INSECT && r_insectstalled(next) && !is_cursed(u->attribs, C_KAELTESCHUTZ,0))
|
if (is_freezing(u)) {
|
||||||
{
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("detectforbidden",
|
ADDMSG(&u->faction->msgs, msg_message("detectforbidden",
|
||||||
"unit region", u, next));
|
"unit region", u, next));
|
||||||
break;
|
break;
|
||||||
|
@ -1604,7 +1629,7 @@ sail(unit * u, region * next_point, boolean move_on_land)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ship_allowed(sh->type, next_point)) {
|
if (!ship_allowed(sh, next_point)) {
|
||||||
/* for some reason or another, we aren't allowed in there.. */
|
/* for some reason or another, we aren't allowed in there.. */
|
||||||
if (check_leuchtturm(current_point, NULL)) {
|
if (check_leuchtturm(current_point, NULL)) {
|
||||||
ADDMSG(&f->msgs, msg_message("sailnolandingstorm", "ship", sh));
|
ADDMSG(&f->msgs, msg_message("sailnolandingstorm", "ship", sh));
|
||||||
|
|
|
@ -327,10 +327,14 @@ boolean is_undead(const unit *u)
|
||||||
boolean
|
boolean
|
||||||
r_insectstalled(const region * r)
|
r_insectstalled(const region * r)
|
||||||
{
|
{
|
||||||
if (rterrain(r)==T_GLACIER || rterrain(r)==T_ICEBERG_SLEEP
|
switch (rterrain(r)) {
|
||||||
|| rterrain(r)==T_ICEBERG)
|
case T_GLACIER:
|
||||||
|
case T_ICEBERG_SLEEP:
|
||||||
|
case T_ICEBERG:
|
||||||
return true;
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue