forked from github/server
- Intakte Straßen trotz zerstörter Karawanserei
This commit is contained in:
parent
94a703a375
commit
3858781bd5
|
@ -841,20 +841,7 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
int opfer = 0;
|
int opfer = 0;
|
||||||
int road = 0;
|
int road = 0;
|
||||||
struct message * msg;
|
struct message * msg;
|
||||||
/*
|
|
||||||
"$building($crashed) stürzte ein.$if($road," Beim Einsturz wurde die halbe Straße vernichtet.","")$if($victims,"$int($victims) $if($eq($victims,1),"ist","sind"),"") zu beklagen."
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
|
|
||||||
* gebaute Straße zur Hälfte vernichtet */
|
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0 &&
|
|
||||||
(b->type == bt_find("caravan") ||
|
|
||||||
b->type == bt_find("dam") ||
|
|
||||||
b->type == bt_find("tunnel")))
|
|
||||||
{
|
|
||||||
rsetroad(r, d, rroad(r, d) / 2);
|
|
||||||
road = 1;
|
|
||||||
}
|
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if (u->building == b) {
|
if (u->building == b) {
|
||||||
int loss = 0;
|
int loss = 0;
|
||||||
|
@ -873,6 +860,15 @@ gebaeude_stuerzt_ein(region * r, building * b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
|
||||||
|
* gebaute Straße zur Hälfte vernichtet */
|
||||||
|
if (b->type == bt_find("caravan") || b->type == bt_find("dam") || b->type == bt_find("tunnel")) {
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0) {
|
||||||
|
road = 1;
|
||||||
|
/* vernichtung findet erst in destroy_building statt! */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
msg = msg_message("buildingcrash", "region building opfer road", r, b, opfer, road);
|
msg = msg_message("buildingcrash", "region building opfer road", r, b, opfer, road);
|
||||||
add_message(&r->msgs, msg);
|
add_message(&r->msgs, msg);
|
||||||
for (u=r->units; u; u=u->next) {
|
for (u=r->units; u; u=u->next) {
|
||||||
|
|
|
@ -469,16 +469,35 @@ void
|
||||||
destroy_building(building * b)
|
destroy_building(building * b)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
direction_t d;
|
||||||
|
static const struct building_type * bt_caravan, * bt_dam, * bt_tunnel;
|
||||||
|
boolean init = false;
|
||||||
|
|
||||||
if(!bfindhash(b->no)) return;
|
if (!init) {
|
||||||
for(u=b->region->units; u; u=u->next) {
|
init = true;
|
||||||
if(u->building == b) leave(b->region, u);
|
bt_caravan = bt_find("caravan");
|
||||||
|
bt_dam = bt_find("dam");
|
||||||
|
bt_tunnel = bt_find("tunnel");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bfindhash(b->no)) return;
|
||||||
|
for (u=b->region->units; u; u=u->next) {
|
||||||
|
if (u->building == b) leave(b->region, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
b->size = 0;
|
b->size = 0;
|
||||||
update_lighthouse(b);
|
update_lighthouse(b);
|
||||||
bunhash(b);
|
bunhash(b);
|
||||||
|
|
||||||
|
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
|
||||||
|
* gebaute Straße zur Hälfte vernichtet */
|
||||||
|
if (b->type == bt_caravan || b->type == bt_dam || b->type == bt_tunnel) {
|
||||||
|
region * r = b->region;
|
||||||
|
for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0) {
|
||||||
|
rsetroad(r, d, rroad(r, d) / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */
|
#if 0 /* Memoryleak. Aber ohne klappt das Rendern nicht! */
|
||||||
removelist(&b->region->buildings, b);
|
removelist(&b->region->buildings, b);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1366,42 +1366,42 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
|
||||||
ut = getunit(first, u->faction);
|
ut = getunit(first, u->faction);
|
||||||
if (ut) {
|
if (ut) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (get_keyword(ut->thisorder) == K_DRIVE
|
if (get_keyword(ut->thisorder) == K_DRIVE) {
|
||||||
&& !fval(ut, UFL_LONGACTION) && !LongHunger(ut)) {
|
if (!fval(ut, UFL_LONGACTION) && !LongHunger(ut)) {
|
||||||
init_tokens(ut->thisorder);
|
init_tokens(ut->thisorder);
|
||||||
skip_token();
|
skip_token();
|
||||||
u2 = getunit(first, ut->faction);
|
u2 = getunit(first, ut->faction);
|
||||||
if(u2 == u) {
|
if (u2 == u) {
|
||||||
found = true;
|
found = true;
|
||||||
add_message(&u->faction->msgs, new_message(
|
add_message(&u->faction->msgs, new_message(
|
||||||
u->faction, "transport%u:unit%u:target%r:start%r:end",
|
u->faction, "transport%u:unit%u:target%r:start%r:end",
|
||||||
u, ut, first, current));
|
u, ut, first, current));
|
||||||
if(!(terrain[current->terrain].flags & WALK_INTO)
|
if (!(terrain[current->terrain].flags & WALK_INTO) && get_item(ut, I_HORSE)) {
|
||||||
&& get_item(ut, I_HORSE)) {
|
cmistake(u, u->thisorder, 67, MSG_MOVE);
|
||||||
cmistake(u, u->thisorder, 67, MSG_MOVE);
|
cmistake(ut, ut->thisorder, 67, MSG_MOVE);
|
||||||
cmistake(ut, ut->thisorder, 67, MSG_MOVE);
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
if (can_survive(ut, current)) {
|
||||||
if (can_survive(ut, current)) {
|
travel_route(ut, ut->region, route);
|
||||||
travel_route(ut, ut->region, route);
|
move_unit(ut, current, NULL);
|
||||||
move_unit(ut, current, NULL);
|
if (fval(ut, UFL_FOLLOWED) && route!=NULL) {
|
||||||
if (fval(ut, UFL_FOLLOWED) && route!=NULL) {
|
followers += notify_followers(first, ut, route);
|
||||||
followers += notify_followers(first, ut, route);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cmistake(u, u->thisorder, 287, MSG_MOVE);
|
|
||||||
cmistake(ut, ut->thisorder, 230, MSG_MOVE);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
cmistake(u, u->thisorder, 287, MSG_MOVE);
|
||||||
|
cmistake(ut, ut->thisorder, 230, MSG_MOVE);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
}
|
||||||
if(cansee(u->faction, u->region, ut, 0)) {
|
if (!found) {
|
||||||
cmistake(u, u->thisorder, 90, MSG_MOVE);
|
if (cansee(u->faction, u->region, ut, 0)) {
|
||||||
} else {
|
cmistake(u, u->thisorder, 90, MSG_MOVE);
|
||||||
cmistake(u, u->thisorder, 63, MSG_MOVE);
|
} else {
|
||||||
}
|
cmistake(u, u->thisorder, 63, MSG_MOVE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ut) {
|
if (ut) {
|
||||||
cmistake(u, u->thisorder, 63, MSG_MOVE);
|
cmistake(u, u->thisorder, 63, MSG_MOVE);
|
||||||
|
|
Loading…
Reference in New Issue