Spezialfall: Einheiten, die nicht laufen können.

LUA: Rasse ändern ändert auch irace.
This commit is contained in:
Enno Rehling 2005-12-31 16:13:20 +00:00
parent 90e8fb11fd
commit 9bf60a5451
2 changed files with 24 additions and 16 deletions

View File

@ -1302,7 +1302,9 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
/* check movement from/to oceans.
* aquarian special, flying units, horses, the works */
if ((u->race->flags & RCF_FLY) == 0) {
if (fval(current->terrain, SEA_REGION) && !fval(next->terrain, SEA_REGION)) {
if (!fval(next->terrain, SEA_REGION)) {
/* next region is land */
if (fval(current->terrain, SEA_REGION)) {
int moving = u->race->flags & (RCF_SWIM|RCF_WALK|RCF_COASTAL);
/* Die Einheit kann nicht fliegen, ist im Ozean, und will an Land */
if (moving != (RCF_SWIM|RCF_WALK) && (moving|RCF_COASTAL) == 0) {
@ -1310,6 +1312,21 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
if (ord!=NULL) cmistake(u, ord, 44, MSG_MOVE);
break;
}
} else if ((u->race->flags & RCF_WALK) == 0) {
/* Spezialeinheiten, die nicht laufen können. */
int moving = u->race->flags & (RCF_SWIM|RCF_WALK|RCF_COASTAL);
ADDMSG(&u->faction->msgs, msg_message("detectocean",
"unit region", u, next));
break;
}
} else {
/* Ozeanfelder können nur von Einheiten mit Schwimmen und ohne
* Pferde betreten werden. */
if (!(canswim(u) || canfly(u))) {
ADDMSG(&u->faction->msgs, msg_message("detectocean",
"unit region", u, next));
break;
}
}
if (fval(current->terrain, SEA_REGION) || fval(next->terrain, SEA_REGION)) {
@ -1321,16 +1338,6 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
}
}
/* Ozeanfelder können nur von Einheiten mit Schwimmen und ohne
* Pferde betreten werden. */
if (fval(next->terrain, SEA_REGION)) {
if (!(canswim(u) || canfly(u))) {
ADDMSG(&u->faction->msgs, msg_message("detectocean",
"unit region", u, next));
break;
}
}
}
/* movement blocked by a wall */

View File

@ -175,6 +175,7 @@ unit_setrace(unit& u, const char * rcname)
{
race * rc = rc_find(rcname);
if (rc!=NULL) {
if (u.irace==u.race) u.irace = rc;
u.race = rc;
}
}