forked from github/server
Steinbauer bekommen Steinbruchbonus obwohl Gebäude zu klein Personen, die gerade erst in ein Schiff oder Gebaeude neu hineinkommen, werden jetzt UNTEN an die existierenden Personen dransortiert.
This commit is contained in:
parent
8cd3685b56
commit
42ede42656
|
@ -1156,23 +1156,26 @@ leave_cmd(unit * u, struct order * ord)
|
|||
}
|
||||
|
||||
static boolean
|
||||
entership(unit * u, ship * sh, struct order * ord, boolean lasttry)
|
||||
enter_ship(unit * u, struct order * ord, int id, boolean report)
|
||||
{
|
||||
region * r = u->region;
|
||||
ship * sh;
|
||||
|
||||
/* Muß abgefangen werden, sonst könnten Schwimmer an
|
||||
* Bord von Schiffen an Land gelangen. */
|
||||
if( !fval(u->race, RCF_WALK) &&
|
||||
!fval(u->race, RCF_FLY)) {
|
||||
if (!fval(u->race, RCF_WALK) && !fval(u->race, RCF_FLY)) {
|
||||
cmistake(u, ord, 233, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sh) {
|
||||
if (lasttry) cmistake(u, ord, 20, MSG_MOVE);
|
||||
sh = findship(id);
|
||||
if (sh == NULL || sh->region!=r) {
|
||||
if (report) cmistake(u, ord, 20, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
if (sh==u->ship) return true;
|
||||
if (!mayboard(u, sh)) {
|
||||
if (lasttry) cmistake(u, ord, 34, MSG_MOVE);
|
||||
if (report) cmistake(u, ord, 34, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
if (CheckOverload()) {
|
||||
|
@ -1186,7 +1189,7 @@ entership(unit * u, ship * sh, struct order * ord, boolean lasttry)
|
|||
sweight = ((sweight+99) / 100) * 100; /* Silberreste aufrunden */
|
||||
|
||||
if (sweight > mweight || scabins > mcabins) {
|
||||
if (lasttry) cmistake(u, ord, 34, MSG_MOVE);
|
||||
if (report) cmistake(u, ord, 34, MSG_MOVE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1195,9 +1198,59 @@ entership(unit * u, ship * sh, struct order * ord, boolean lasttry)
|
|||
leave(u->region, u);
|
||||
u->ship = sh;
|
||||
|
||||
if (shipowner(sh) == 0) {
|
||||
if (shipowner(sh) == NULL) {
|
||||
fset(u, UFL_OWNER);
|
||||
}
|
||||
fset(u, UFL_ENTER);
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean
|
||||
enter_building(unit * u, order * ord, int id, boolean report)
|
||||
{
|
||||
region * r = u->region;
|
||||
building * b;
|
||||
|
||||
/* Schwimmer können keine Gebäude betreten, außer diese sind
|
||||
* auf dem Ozean */
|
||||
if (!fval(u->race, RCF_WALK) && !fval(u->race, RCF_FLY)) {
|
||||
if (!fval(r->terrain, SEA_REGION)) {
|
||||
if (report) {
|
||||
cmistake(u, ord, 232, MSG_MOVE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
b = findbuilding(id);
|
||||
if (b==NULL || b->region!=r) {
|
||||
if (report) {
|
||||
cmistake(u, ord, 6, MSG_MOVE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!mayenter(r, u, b)) {
|
||||
if (report) {
|
||||
sprintf(buf, "Der Eintritt in %s wurde verwehrt",
|
||||
buildingname(b));
|
||||
mistake(u, ord, buf, MSG_MOVE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!slipthru(r, u, b)) {
|
||||
if (report) {
|
||||
sprintf(buf, "%s wird belagert", buildingname(b));
|
||||
mistake(u, ord, buf, MSG_MOVE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
leave(r, u);
|
||||
u->building = b;
|
||||
if (buildingowner(r, b) == 0) {
|
||||
fset(u, UFL_OWNER);
|
||||
}
|
||||
fset(u, UFL_ENTER);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1205,93 +1258,90 @@ void
|
|||
do_misc(boolean lasttry)
|
||||
{
|
||||
region *r;
|
||||
ship *sh;
|
||||
building *b;
|
||||
|
||||
/* lasttry: Fehler nur im zweiten Versuch melden. Sonst konfus. */
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
unit **uptr, *uc;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
for (uc = r->units; uc; uc = uc->next) {
|
||||
order * ord;
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
for (ord = uc->orders; ord; ord = ord->next) {
|
||||
switch (get_keyword(ord)) {
|
||||
case K_CONTACT:
|
||||
contact_cmd(u, ord, lasttry);
|
||||
contact_cmd(uc, ord, lasttry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
for (uptr = &r->units; *uptr;) {
|
||||
unit * u = *uptr;
|
||||
order ** ordp = &u->orders;
|
||||
|
||||
while (*ordp) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord) == K_ENTER) {
|
||||
param_t p;
|
||||
int id;
|
||||
unit * ulast = NULL;
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
switch (getparam(u->faction->locale)) {
|
||||
p = getparam(u->faction->locale);
|
||||
id = getid();
|
||||
|
||||
switch (p) {
|
||||
case P_BUILDING:
|
||||
case P_GEBAEUDE:
|
||||
/* Schwimmer können keine Gebäude betreten, außer diese sind
|
||||
* auf dem Ozean */
|
||||
if( !fval(u->race, RCF_WALK) && !fval(u->race, RCF_FLY)) {
|
||||
if (!fval(r->terrain, SEA_REGION)) {
|
||||
if (lasttry) cmistake(u, ord, 232, MSG_MOVE);
|
||||
break;
|
||||
if (u->building && u->building->no==id) break;
|
||||
if (enter_building(u, ord, id, lasttry)) {
|
||||
unit *ub;
|
||||
for (ub=u;ub;ub=ub->next) {
|
||||
if (ub->building==u->building) {
|
||||
ulast = ub;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b = getbuilding(r);
|
||||
|
||||
if (!b) {
|
||||
if(lasttry) cmistake(u, ord, 6, MSG_MOVE);
|
||||
break;
|
||||
}
|
||||
if (!mayenter(r, u, b)) {
|
||||
if(lasttry) {
|
||||
sprintf(buf, "Der Eintritt in %s wurde verwehrt",
|
||||
buildingname(b));
|
||||
mistake(u, ord, buf, MSG_MOVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!slipthru(r, u, b)) {
|
||||
if(lasttry) {
|
||||
sprintf(buf, "%s wird belagert", buildingname(b));
|
||||
mistake(u, ord, buf, MSG_MOVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wenn wir hier angekommen sind, war der Befehl
|
||||
* erfolgreich und wir löschen ihn, damit er im
|
||||
* zweiten Versuch nicht nochmal ausgeführt wird. */
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
leave(r, u);
|
||||
u->building = b;
|
||||
if (buildingowner(r, b) == 0) {
|
||||
fset(u, UFL_OWNER);
|
||||
}
|
||||
fset(u, UFL_ENTER);
|
||||
break;
|
||||
|
||||
case P_SHIP:
|
||||
sh = getship(r);
|
||||
entership(u, sh, ord, lasttry);
|
||||
fset(u, UFL_ENTER);
|
||||
if (u->ship && u->ship->no==id) break;
|
||||
if (enter_ship(u, ord, id, lasttry)) {
|
||||
unit *ub;
|
||||
ulast = u;
|
||||
for (ub=u;ub;ub=ub->next) {
|
||||
if (ub->ship==u->ship) {
|
||||
ulast = ub;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (lasttry) cmistake(u, ord, 79, MSG_MOVE);
|
||||
|
||||
}
|
||||
if (ulast!=NULL) {
|
||||
/* Wenn wir hier angekommen sind, war der Befehl
|
||||
* erfolgreich und wir löschen ihn, damit er im
|
||||
* zweiten Versuch nicht nochmal ausgeführt wird. */
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
|
||||
if (ulast!=u) {
|
||||
/* put u behind ulast so it's the last unit in the building */
|
||||
*uptr = u->next;
|
||||
u->next = ulast->next;
|
||||
ulast->next = u;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*ordp==ord) ordp = &ord->next;
|
||||
}
|
||||
if (*uptr==u) uptr = &u->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue