Kosmetischer Fehler im NR, Astralraum
This commit is contained in:
Enno Rehling 2004-05-21 23:02:19 +00:00
parent a75accfcd0
commit 051c705809
2 changed files with 91 additions and 92 deletions

View File

@ -111,7 +111,6 @@ MailitPath(void)
value = get_param(global.parameters, "report.mailit"); value = get_param(global.parameters, "report.mailit");
} }
return value; return value;
} }
int int
@ -1073,7 +1072,7 @@ eval_trail(struct opstack ** stack, const void * userdata) /* (int, int) -> int
const struct locale * lang = opop(stack, const struct locale*); const struct locale * lang = opop(stack, const struct locale*);
const struct region * r = opop(stack, const struct region*); const struct region * r = opop(stack, const struct region*);
const char * trail = trailinto(r, lang); const char * trail = trailinto(r, lang);
const char * rn = regionname(r, f); const char * rn = f_regionid(r, f);
char * x = balloc(strlen(trail)+strlen(rn)); char * x = balloc(strlen(trail)+strlen(rn));
sprintf(x, trail, rn); sprintf(x, trail, rn);
opush(stack, x); opush(stack, x);

View File

@ -331,114 +331,114 @@ destroy_road(unit *u, int n, const char *cmd)
void void
destroy(region * r, unit * u, const char * cmd) destroy(region * r, unit * u, const char * cmd)
{ {
ship *sh; ship *sh;
unit *u2; unit *u2;
#if 0 #if 0
const construction * con = NULL; const construction * con = NULL;
int size = 0; int size = 0;
#endif #endif
const char *s; const char *s;
int n = INT_MAX; int n = INT_MAX;
if (u->number < 1) if (u->number < 1)
return; return;
s = getstrtoken(); s = getstrtoken();
if (findparam(s, u->faction->locale)==P_ROAD) { if (findparam(s, u->faction->locale)==P_ROAD) {
destroy_road(u, INT_MAX, cmd); destroy_road(u, INT_MAX, cmd);
return; return;
} }
if (!fval(u, UFL_OWNER)) { if (!fval(u, UFL_OWNER)) {
cmistake(u, cmd, 138, MSG_PRODUCE); cmistake(u, cmd, 138, MSG_PRODUCE);
return; return;
} }
if(s && *s) { if(s && *s) {
n = atoi(s); n = atoi(s);
if(n <= 0) { if(n <= 0) {
cmistake(u, cmd, 288, MSG_PRODUCE); cmistake(u, cmd, 288, MSG_PRODUCE);
return; return;
} }
} }
if(getparam(u->faction->locale) == P_ROAD) { if(getparam(u->faction->locale) == P_ROAD) {
destroy_road(u, n, cmd); destroy_road(u, n, cmd);
return; return;
} }
if (u->building) { if (u->building) {
building *b = u->building; building *b = u->building;
#if 0 #if 0
con = b->type->construction; con = b->type->construction;
size = b->size; size = b->size;
#endif #endif
if(n >= b->size) { if(n >= b->size) {
/* destroy completly */ /* destroy completly */
/* all units leave the building */ /* all units leave the building */
for (u2 = r->units; u2; u2 = u2->next) for (u2 = r->units; u2; u2 = u2->next)
if (u2->building == b) { if (u2->building == b) {
u2->building = 0; u2->building = 0;
freset(u2, UFL_OWNER); freset(u2, UFL_OWNER);
} }
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "destroy%b:building%u:unit", b, u)); u->faction, "destroy%b:building%u:unit", b, u));
destroy_building(b); destroy_building(b);
} else { } else {
/* partial destroy */ /* partial destroy */
b->size -= n; b->size -= n;
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "destroy_partial%b:building%u:unit", b, u)); u->faction, "destroy_partial%b:building%u:unit", b, u));
} }
} else if (u->ship) { } else if (u->ship) {
sh = u->ship; sh = u->ship;
#if 0 #if 0
con = sh->type->construction; con = sh->type->construction;
size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE; size = (sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE;
#endif #endif
if (rterrain(r) == T_OCEAN) { if (rterrain(r) == T_OCEAN) {
cmistake(u, cmd, 14, MSG_EVENT); cmistake(u, cmd, 14, MSG_EVENT);
return; return;
} }
if(n >= (sh->size*100)/sh->type->construction->maxsize) { if(n >= (sh->size*100)/sh->type->construction->maxsize) {
/* destroy completly */ /* destroy completly */
/* all units leave the ship */ /* all units leave the ship */
for (u2 = r->units; u2; u2 = u2->next) for (u2 = r->units; u2; u2 = u2->next)
if (u2->ship == sh) { if (u2->ship == sh) {
u2->ship = 0; u2->ship = 0;
freset(u2, UFL_OWNER); freset(u2, UFL_OWNER);
} }
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "shipdestroy%u:unit%r:region%h:ship", u, r, sh)); u->faction, "shipdestroy%u:unit%r:region%h:ship", u, r, sh));
destroy_ship(sh, r); destroy_ship(sh, r);
} else { } else {
/* partial destroy */ /* partial destroy */
sh->size -= (sh->type->construction->maxsize * n)/100; sh->size -= (sh->type->construction->maxsize * n)/100;
add_message(&u->faction->msgs, new_message( add_message(&u->faction->msgs, new_message(
u->faction, "shipdestroy_partial%u:unit%r:region%h:ship", u, r, sh)); u->faction, "shipdestroy_partial%u:unit%r:region%h:ship", u, r, sh));
} }
} else } else
printf("* Fehler im Program! Die Einheit %s von %s\n" printf("* Fehler im Program! Die Einheit %s von %s\n"
" (Spieler: %s) war owner eines objects,\n" " (Spieler: %s) war owner eines objects,\n"
" war aber weder in einer Burg noch in einem Schiff.\n", " war aber weder in einer Burg noch in einem Schiff.\n",
unitname(u), u->faction->name, u->faction->email); unitname(u), u->faction->name, u->faction->email);
#if 0 #if 0
/* Achtung: Nicht an ZERSTÖRE mit Punktangabe angepaßt! */ /* Achtung: Nicht an ZERSTÖRE mit Punktangabe angepaßt! */
if (con) { if (con) {
/* Man sollte alle Materialien zurückkriegen können: */ /* Man sollte alle Materialien zurückkriegen können: */
int c; int c;
for (c=0;con->materials[c].number;++c) { for (c=0;con->materials[c].number;++c) {
const requirement * rq = con->materials+c; const requirement * rq = con->materials+c;
int recycle = (int)(rq->recycle * rq->number * size/con->reqsize); int recycle = (int)(rq->recycle * rq->number * size/con->reqsize);
if (recycle) if (recycle)
change_resource(u, rq->type, recycle); change_resource(u, rq->type, recycle);
} }
} }
#endif #endif
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */