- Mapper, Neue-Einheiten-Dialog verbessert.

- Eine Menge 'shadows local variable'-Warnings beseitigt.
This commit is contained in:
Christian Schlittchen 2001-02-09 13:53:53 +00:00
parent 777977b975
commit c04678f0d1
20 changed files with 198 additions and 169 deletions

View File

@ -19,7 +19,7 @@ ARFLAGS = cr
CTAGSFLAGS = --langmap=c:.c.h --c-types=-m CTAGSFLAGS = --langmap=c:.c.h --c-types=-m
CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \ CFLAGS = -I$(ERESSEA) -Wall -Wwrite-strings -Wstrict-prototypes \
-Wpointer-arith -Werror-implicit-function-declaration \ -Wpointer-arith -Werror-implicit-function-declaration \
-Wno-char-subscripts \ -Wno-char-subscripts -Wshadow \
-march=pentiumpro -fPIC $(INCLUDES) -march=pentiumpro -fPIC $(INCLUDES)
LDFLAGS = $(LIBS) LDFLAGS = $(LIBS)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: alchemy.c,v 1.3 2001/02/03 13:45:30 enno Exp $ * $Id: alchemy.c,v 1.4 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -220,8 +220,8 @@ set_effect (unit * u, const potion_type * effect, int value)
a=a->nexttype; a=a->nexttype;
} }
if (!a && value) { if (!a && value) {
attrib * a = a_add(ap, a_new(&at_effect)); attrib * an = a_add(ap, a_new(&at_effect));
data = (effect_data*)a->data.v; data = (effect_data*)an->data.v;
data->type = effect; data->type = effect;
data->value = value; data->value = value;
} else if (a && !value) { } else if (a && !value) {
@ -252,8 +252,8 @@ change_effect (unit * u, const potion_type * effect, int delta)
} else if (a!=NULL) { } else if (a!=NULL) {
data->value += delta; data->value += delta;
} else { } else {
attrib * a = a_add(ap, a_new(&at_effect)); attrib * an = a_add(ap, a_new(&at_effect));
data = (effect_data*)a->data.v; data = (effect_data*)an->data.v;
data->type = effect; data->type = effect;
data->value = delta; data->value = delta;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: battle.c,v 1.6 2001/02/05 16:11:57 enno Exp $ * $Id: battle.c,v 1.7 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -627,7 +627,7 @@ weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, boole
} }
if (wtype->modifiers) { if (wtype->modifiers) {
/* Pferdebonus, Lanzenbonus, usw. */ /* Pferdebonus, Lanzenbonus, usw. */
int w; int m;
unsigned int flags = WMF_SKILL|(attacking?WMF_OFFENSIVE:WMF_DEFENSIVE); unsigned int flags = WMF_SKILL|(attacking?WMF_OFFENSIVE:WMF_DEFENSIVE);
if (riding(t)) flags |= WMF_RIDING; if (riding(t)) flags |= WMF_RIDING;
@ -635,9 +635,9 @@ weapon_effskill(troop t, troop enemy, const weapon * w, boolean attacking, boole
if (riding(enemy)) flags |= WMF_AGAINST_RIDING; if (riding(enemy)) flags |= WMF_AGAINST_RIDING;
else flags |= WMF_AGAINST_WALKING; else flags |= WMF_AGAINST_WALKING;
for (w=0;wtype->modifiers[w].value;++w) { for (m=0;wtype->modifiers[m].value;++m) {
if ((wtype->modifiers[w].flags & flags) == flags) { if ((wtype->modifiers[m].flags & flags) == flags) {
skill += wtype->modifiers[w].value; skill += wtype->modifiers[m].value;
} }
} }
} }
@ -2832,19 +2832,20 @@ make_fighter(battle * b, unit * u, boolean attack)
#if TACTICS_RANDOM #if TACTICS_RANDOM
if (t > 0) { if (t > 0) {
int bonus = 0; int bonus = 0;
int r;
for (i = 0; i < fig->alive; i++) { for (i = 0; i < fig->alive; i++) {
int p_bonus = 0; int p_bonus = 0;
int rnd;
do { do {
r = rand()%100; rnd = rand()%100;
if (r >= 40 && r <= 69) if (rnd >= 40 && rnd <= 69)
p_bonus += 1; p_bonus += 1;
else if (r <= 89) else if (rnd <= 89)
p_bonus += 2; p_bonus += 2;
else else
p_bonus += 3; p_bonus += 3;
} while(r >= 97); } while(rnd >= 97);
bonus = max(p_bonus, bonus); bonus = max(p_bonus, bonus);
} }
t += bonus; t += bonus;
@ -3196,54 +3197,54 @@ do_battle(void)
for (u = r->units; u != NULL; u = u->next) { for (u = r->units; u != NULL; u = u->next) {
if (fval(u, FL_HADBATTLE)) continue; if (fval(u, FL_HADBATTLE)) continue;
if (u->number > 0) { if (u->number > 0) {
strlist *s; strlist *sl;
list_foreach(strlist, u->orders, s) { list_foreach(strlist, u->orders, sl) {
if (igetkeyword(s->s) == K_ATTACK) { if (igetkeyword(sl->s) == K_ATTACK) {
unit *u2; unit *u2;
fighter *c1, *c2; fighter *c1, *c2;
if(r->planep && fval(r->planep, PFL_NOATTACK)) { if(r->planep && fval(r->planep, PFL_NOATTACK)) {
cmistake(u, s->s, 271, MSG_BATTLE); cmistake(u, sl->s, 271, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Fehlerbehandlung Angreifer */ /* Fehlerbehandlung Angreifer */
if (is_spell_active(r, C_PEACE)) { if (is_spell_active(r, C_PEACE)) {
sprintf(buf, "Hier ist es so schön friedlich, %s möchte " sprintf(buf, "Hier ist es so schön friedlich, %s möchte "
"hier niemanden angreifen.", unitname(u)); "hier niemanden angreifen.", unitname(u));
mistake(u, s->s, buf, MSG_BATTLE); mistake(u, sl->s, buf, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
if (fval(u, FL_HUNGER)) { if (fval(u, FL_HUNGER)) {
cmistake(u, s->s, 225, MSG_BATTLE); cmistake(u, sl->s, 225, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
if (u->status == ST_AVOID || u->status == ST_FLEE) { if (u->status == ST_AVOID || u->status == ST_FLEE) {
cmistake(u, s->s, 226, MSG_BATTLE); cmistake(u, sl->s, 226, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* ist ein Flüchtling aus einem andern Kampf */ /* ist ein Flüchtling aus einem andern Kampf */
if (fval(u, FL_MOVED)) list_continue(s); if (fval(u, FL_MOVED)) list_continue(sl);
if (is_cursed(u->attribs, C_SLAVE, 0)) { if (is_cursed(u->attribs, C_SLAVE, 0)) {
sprintf(buf, "%s kämpft nicht.", unitname(u)); sprintf(buf, "%s kämpft nicht.", unitname(u));
mistake(u, s->s, buf, MSG_BATTLE); mistake(u, sl->s, buf, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Fehler: "Das Schiff muß erst verlassen werden" */ /* Fehler: "Das Schiff muß erst verlassen werden" */
if (u->ship != NULL && rterrain(r) != T_OCEAN) { if (u->ship != NULL && rterrain(r) != T_OCEAN) {
cmistake(u, s->s, 19, MSG_BATTLE); cmistake(u, sl->s, 19, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
if (leftship(u)) { if (leftship(u)) {
cmistake(u, s->s, 234, MSG_BATTLE); cmistake(u, sl->s, 234, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Ende Fehlerbehandlung Angreifer */ /* Ende Fehlerbehandlung Angreifer */
@ -3255,36 +3256,36 @@ do_battle(void)
/* Fehler: "Die Einheit wurde nicht gefunden" */ /* Fehler: "Die Einheit wurde nicht gefunden" */
if (!u2 || fval(u2, FL_MOVED) || u2->number == 0 if (!u2 || fval(u2, FL_MOVED) || u2->number == 0
|| !cansee(u->faction, u->region, u2, 0)) { || !cansee(u->faction, u->region, u2, 0)) {
cmistake(u, s->s, 64, MSG_BATTLE); cmistake(u, sl->s, 64, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Fehler: "Die Einheit ist eine der unsrigen" */ /* Fehler: "Die Einheit ist eine der unsrigen" */
if (u2->faction == u->faction) { if (u2->faction == u->faction) {
cmistake(u, s->s, 45, MSG_BATTLE); cmistake(u, sl->s, 45, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Fehler: "Die Einheit ist mit uns alliert" */ /* Fehler: "Die Einheit ist mit uns alliert" */
if (allied(u, u2->faction, HELP_FIGHT)) { if (allied(u, u2->faction, HELP_FIGHT)) {
cmistake(u, s->s, 47, MSG_BATTLE); cmistake(u, sl->s, 47, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* xmas */ /* xmas */
if (u2->no==atoi36("xmas") && u2->irace==RC_GNOME) { if (u2->no==atoi36("xmas") && u2->irace==RC_GNOME) {
a_add(&u->attribs, a_new(&at_key))->data.i = atoi36("coal"); a_add(&u->attribs, a_new(&at_key))->data.i = atoi36("coal");
sprintf(buf, "%s ist böse gewesen...", unitname(u)); sprintf(buf, "%s ist böse gewesen...", unitname(u));
mistake(u, s->s, buf, MSG_BATTLE); mistake(u, sl->s, buf, MSG_BATTLE);
list_continue(s); list_continue(sl);
}if (u2->faction->age < IMMUN_GEGEN_ANGRIFF) { }if (u2->faction->age < IMMUN_GEGEN_ANGRIFF) {
sprintf(buf, "Eine Partei muß mindestens %d " sprintf(buf, "Eine Partei muß mindestens %d "
"Wochen alt sein, bevor sie angegriffen werden kann", "Wochen alt sein, bevor sie angegriffen werden kann",
IMMUN_GEGEN_ANGRIFF); IMMUN_GEGEN_ANGRIFF);
mistake(u, s->s, buf, MSG_BATTLE); mistake(u, sl->s, buf, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Fehler: "Die Einheit ist mit uns alliert" */ /* Fehler: "Die Einheit ist mit uns alliert" */
if (is_cursed(u->attribs, C_CALM, u2->faction->unique_id)) { if (is_cursed(u->attribs, C_CALM, u2->faction->unique_id)) {
cmistake(u, s->s, 47, MSG_BATTLE); cmistake(u, sl->s, 47, MSG_BATTLE);
list_continue(s); list_continue(sl);
} }
/* Ende Fehlerbehandlung */ /* Ende Fehlerbehandlung */
@ -3315,7 +3316,7 @@ do_battle(void)
} }
} }
} }
list_next(s); list_next(sl);
} }
} }
if (!b) if (!b)

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: build.c,v 1.6 2001/02/04 10:04:51 enno Exp $ * $Id: build.c,v 1.7 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -288,7 +288,6 @@ destroy(region * r, unit * u, const char * cmd)
return; return;
if (getparam()==P_ROAD) { if (getparam()==P_ROAD) {
direction_t d = getdirection(); direction_t d = getdirection();
unit * u2;
for (u2=r->units;u2;u2=u2->next) { for (u2=r->units;u2;u2=u2->next) {
if (u2->faction!=u->faction && getguard(u2)&GUARD_TAX && if (u2->faction!=u->faction && getguard(u2)&GUARD_TAX &&
!allied(u, u2->faction, HELP_GUARD)) { !allied(u, u2->faction, HELP_GUARD)) {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: building.c,v 1.5 2001/02/03 18:46:15 enno Exp $ * $Id: building.c,v 1.6 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -827,17 +827,17 @@ bt_read(FILE * F)
if (!strcmp(semi, "name") && !bt->_name) bt->_name = strdup(s); if (!strcmp(semi, "name") && !bt->_name) bt->_name = strdup(s);
} }
else { else {
int i = atoi(buf); int j = atoi(buf);
switch (semi[0]) { switch (semi[0]) {
case 'c': case 'c':
if (!strcmp(semi, "capacity")) bt->capacity=i; if (!strcmp(semi, "capacity")) bt->capacity=j;
break; break;
case 'f': case 'f':
if (!strcmp(semi, "flags")) bt->flags=i; if (!strcmp(semi, "flags")) bt->flags=j;
break; break;
case 'm': case 'm':
if (!strcmp(semi, "maxcapacity")) bt->maxcapacity=i; if (!strcmp(semi, "maxcapacity")) bt->maxcapacity=j;
else if (!strcmp(semi, "maxsize")) bt->maxsize=i; else if (!strcmp(semi, "maxsize")) bt->maxsize=j;
break; break;
} }
} }

View File

@ -1032,7 +1032,7 @@ sp_tiredsoldiers(fighter * fi, int level, int force, spell * sp)
unit *mage = fi->unit; unit *mage = fi->unit;
int n = 0; int n = 0;
force = force * force * 10; force = force * force * 4;
sprintf(buf, "%s zaubert %s", unitname(mage), sp->name); sprintf(buf, "%s zaubert %s", unitname(mage), sp->name);
if (!count_enemies(fi->side, FS_ENEMY, FIGHT_ROW, if (!count_enemies(fi->side, FS_ENEMY, FIGHT_ROW,

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: magic.c,v 1.5 2001/02/04 18:50:59 corwin Exp $ * $Id: magic.c,v 1.6 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -2436,8 +2436,8 @@ set_familiar(unit * mage, unit * familiar)
a = a->nexttype; a = a->nexttype;
} }
if (a==NULL) { if (a==NULL) {
attrib * a = a_add(&mage->attribs, a_new(&at_skillmod)); attrib * an = a_add(&mage->attribs, a_new(&at_skillmod));
skillmod_data * smd = (skillmod_data *)a->data.v; skillmod_data * smd = (skillmod_data *)an->data.v;
smd->special = sm_familiar; smd->special = sm_familiar;
smd->skill=NOSKILL; smd->skill=NOSKILL;
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: message.c,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: message.c,v 1.3 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -179,11 +179,11 @@ xmistake(const unit * u, const char *s, const char *comment, int mtype)
void void
cmistake(const unit * u, const char *cmd, int mno, int mtype) cmistake(const unit * u, const char *cmd, int mno, int mtype)
{ {
static char buf[64]; static char lbuf[64];
if (u->faction->no == MONSTER_FACTION) return; if (u->faction->no == MONSTER_FACTION) return;
sprintf(buf, "error%d", mno); sprintf(lbuf, "error%d", mno);
strcat(buf, "%s:command%i:errno%u:unit%r:region"); strcat(lbuf, "%s:command%i:errno%u:unit%r:region");
add_message(&u->faction->msgs, new_message(u->faction, buf, cmd, mno, u, u->region)); add_message(&u->faction->msgs, new_message(u->faction, lbuf, cmd, mno, u, u->region));
} }
void void
@ -205,10 +205,11 @@ new_messagetype(const char * name, int level, const char * section)
mt->hashkey = hashstring(mt->name); mt->hashkey = hashstring(mt->name);
#ifndef NDEBUG #ifndef NDEBUG
{ {
messagetype * mt = messagetypes; messagetype * mt2 = messagetypes;
while(mt && strcmp(mt->name, name)) mt = mt->next; while(mt2 && mt2->hashkey != mt->hashkey) mt2 = mt2->next;
if (mt) { if (mt2) {
fprintf(stderr, "duplicate hashkey for messagetype %s and %s", name, mt->name); fprintf(stderr, "duplicate hashkey for messagetype %s and %s\n",
name, mt2->name);
} }
} }
#endif #endif

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: movement.c,v 1.7 2001/02/07 20:42:31 corwin Exp $ * $Id: movement.c,v 1.8 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -576,16 +576,16 @@ drifting_ships(region * r)
char * char *
coords_or_direction(region *r, faction *f, int dir) coords_or_direction(region *r, faction *f, int dir)
{ {
static char buf[32]; static char lbuf[32];
plane *pl = getplane(r); plane *pl = getplane(r);
if(fval(pl, PFL_NOCOORDS)) { if(fval(pl, PFL_NOCOORDS)) {
strcpy(buf, directions[dir]); strcpy(lbuf, directions[dir]);
} else { } else {
sprintf(buf, "(%d,%d)",region_x(r,f), region_y(r,f)); sprintf(lbuf, "(%d,%d)",region_x(r,f), region_y(r,f));
} }
return buf; return lbuf;
} }
void void
@ -941,22 +941,22 @@ travel(region * first, unit * u, region * next, int flucht)
break; break;
default: default:
{ {
int m = 1; int mp = 1;
if (get_effect(u, oldpotiontype[P_FAST]) >= u->number) if (get_effect(u, oldpotiontype[P_FAST]) >= u->number)
m *= 2; /* Siebenmeilentee */ mp *= 2; /* Siebenmeilentee */
if (u->number <= get_item(u, I_FEENSTIEFEL)) if (u->number <= get_item(u, I_FEENSTIEFEL))
m *= 2; mp *= 2;
/* Im Astralraum sind Tyb und Ill-Magier doppelt so schnell. /* Im Astralraum sind Tyb und Ill-Magier doppelt so schnell.
* Nicht kumulativ mit anderen Beschleunigungen! */ * Nicht kumulativ mit anderen Beschleunigungen! */
if ( m == 1 && getplane(next) == astral_plane && is_mage(u)) { if ( mp == 1 && getplane(next) == astral_plane && is_mage(u)) {
if(get_mage(u)->magietyp == M_ASTRAL if(get_mage(u)->magietyp == M_ASTRAL
|| get_mage(u)->magietyp == M_TRAUM) { || get_mage(u)->magietyp == M_TRAUM) {
m *= 2; mp *= 2;
} }
} }
k = (int)(dk*m*BP_WALKING); k = (int)(dk*mp*BP_WALKING);
} }
break; break;
} }
@ -986,10 +986,10 @@ travel(region * first, unit * u, region * next, int flucht)
if (b->type==&bt_wisps) { if (b->type==&bt_wisps) {
region * rl = rconnect(current, (direction_t)((dir+MAXDIRECTIONS-1)%MAXDIRECTIONS)); region * rl = rconnect(current, (direction_t)((dir+MAXDIRECTIONS-1)%MAXDIRECTIONS));
region * rr = rconnect(current, (direction_t)((dir+1)%MAXDIRECTIONS)); region * rr = rconnect(current, (direction_t)((dir+1)%MAXDIRECTIONS));
int i = rand() % 3; int j = rand() % 3;
if (i==0) break; if (j==0) break;
else if (i==1 && rl && landregion(rterrain(rl))==landregion(rterrain(next))) next = rl; else if (j==1 && rl && landregion(rterrain(rl))==landregion(rterrain(next))) next = rl;
else if (i==2 && rr && landregion(rterrain(rr))==landregion(rterrain(next))) next = rr; else if (j==2 && rr && landregion(rterrain(rr))==landregion(rterrain(next))) next = rr;
break; break;
} }
b = b->next; b = b->next;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: pool.c,v 1.2 2001/01/26 16:19:40 enno Exp $ * $Id: pool.c,v 1.3 2001/02/09 13:53:51 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -330,9 +330,9 @@ change_resource(unit * u, resource_t res, int change)
} }
#ifdef NEW_ITEMS #ifdef NEW_ITEMS
else if (itype!=NULL) { else if (itype!=NULL) {
item * i = i_change(&u->items, itype, change); item * it = i_change(&u->items, itype, change);
if (i==NULL) return 0; if (it==NULL) return 0;
return i->number; return it->number;
} }
#else #else
else if (is_item(res)) else if (is_item(res))

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: reports.c,v 1.3 2001/01/31 07:59:42 enno Exp $ * $Id: reports.c,v 1.4 2001/02/09 13:53:52 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -244,10 +244,10 @@ bufunit(const faction * f, const unit * u, int indent,
if (u->faction==f || telepath_see) { if (u->faction==f || telepath_see) {
attrib * a = a_find(u->attribs, &at_follow); attrib * a = a_find(u->attribs, &at_follow);
if (a) { if (a) {
unit * u = (unit*)a->data.v; unit * uf = (unit*)a->data.v;
if (u) { if (uf) {
scat(", folgt "); scat(", folgt ");
scat(itoa36(u->no)); scat(itoa36(uf->no));
} }
} }
} }

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: base36.c,v 1.2 2001/01/26 16:19:41 enno Exp $ * $Id: base36.c,v 1.3 2001/02/09 13:53:52 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -60,10 +60,10 @@ itoab(int i, int base)
int neg = 0; int neg = 0;
if (!as) { if (!as) {
int i; int j;
char * x = calloc(sizeof(char), 8*4); char * x = calloc(sizeof(char), 8*4);
as = calloc(sizeof(char*), 4); as = calloc(sizeof(char*), 4);
for (i=0;i!=4;++i) as[i] = x+i*8; for (j=0;j!=4;++j) as[j] = x+j*8;
} }
s = as[index]; s = as[index];
index = (index+1) % 4; index = (index+1) % 4;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: goodies.c,v 1.2 2001/01/26 16:19:41 enno Exp $ * $Id: goodies.c,v 1.3 2001/02/09 13:53:52 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -70,6 +70,22 @@ hashstring(const char* s)
return key & 0x7fff; return key & 0x7fff;
} }
/* Standardfunktion aus Sedgewick: Algorithmen in C++ */
#define HASH_MAX 100001
int
hashstring_new(const char* s)
{
int key = 0;
int i = strlen(s);
while (i) {
--i;
key = (256 * key + s[i])%HASH_MAX;
}
return key /* & 0x7fffffff */;
}
char * char *
escape_string(char * str, char replace) escape_string(char * str, char replace)
{ {

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: korrektur.c,v 1.14 2001/02/04 11:18:27 corwin Exp $ * $Id: korrektur.c,v 1.15 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -1786,7 +1786,6 @@ fix_targetregion_resolve(void)
} }
} }
#include <modules/gmcmd.h> #include <modules/gmcmd.h>
void setup_gm_faction(void); void setup_gm_faction(void);

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_modify.c,v 1.3 2001/02/03 13:45:34 enno Exp $ * $Id: map_modify.c,v 1.4 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -492,7 +492,7 @@ NeuesSchiff(region * r)
/* Ist das richtig so, Henning? */ /* Ist das richtig so, Henning? */
addlist(&r->ships, s); addlist(&r->ships, s);
strcpy(buf, my_input(win, 2, 2, "Name: ")); strcpy(buf, my_input(win, 2, 2, "Name: ", NULL));
if (strlen(buf) > 0) if (strlen(buf) > 0)
set_string(&s->name, buf); set_string(&s->name, buf);
if (clipunit) { if (clipunit) {
@ -555,7 +555,7 @@ NeueBurg(region * r)
b->size = map_input(win, 2, 2, "Größe", 1, 999, 1); b->size = map_input(win, 2, 2, "Größe", 1, 999, 1);
strcpy(buf, my_input(win, 2, 3, "Name: ")); strcpy(buf, my_input(win, 2, 3, "Name: ", NULL));
if (strlen(buf) > 0) if (strlen(buf) > 0)
set_string(&b->name, buf); set_string(&b->name, buf);
if (clipunit) { if (clipunit) {
@ -722,7 +722,7 @@ modify_region(region * r)
bottom = line - 1; bottom = line - 1;
break; break;
case '/': case '/':
suchtext = my_input(0, 0, 0, (char*)"Suchtext: "); suchtext = my_input(0, 0, 0, (char*)"Suchtext: ", NULL);
such = eh; such = eh;
case 'n': case 'n':
line = 0; line = 0;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_partei.c,v 1.3 2001/02/03 13:45:34 enno Exp $ * $Id: map_partei.c,v 1.4 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -46,7 +46,7 @@ RemovePartei(void) {
region *r; region *r;
win = openwin(SX - 20, 5, "< Partei löschen >"); win = openwin(SX - 20, 5, "< Partei löschen >");
fac_nr36 = my_input(win, 2, 1, "Partei Nummer: "); fac_nr36 = my_input(win, 2, 1, "Partei Nummer: ", NULL);
x = atoi36(fac_nr36); x = atoi36(fac_nr36);
@ -361,7 +361,7 @@ NeuePartei(region * r)
} }
win = openwin(SX - 10, 9, "< Neue Partei einfügen >"); win = openwin(SX - 10, 9, "< Neue Partei einfügen >");
strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ")); strcpy(buf, my_input(win, 2, 1, "EMail-Adresse (Leer->Ende): ", NULL));
if (!buf[0]) { if (!buf[0]) {
delwin(win); delwin(win);
return; return;
@ -507,7 +507,7 @@ ModifyPartei(faction * f)
wrefresh(win); wrefresh(win);
break; break;
case 'e': case 'e':
strcpy(buf, my_input(0, 0, 0, "Neue eMail: ")); strcpy(buf, my_input(0, 0, 0, "Neue eMail: ", NULL));
touchwin(stdscr); touchwin(stdscr);
touchwin(win); touchwin(win);
if (strlen(buf)) { if (strlen(buf)) {
@ -675,7 +675,7 @@ ParteiListe(void)
x = -1; x = -1;
break; break;
case '/': case '/':
strcpy(buf, my_input(0, 0, 0, "Partei Nr. oder Name: ")); strcpy(buf, my_input(0, 0, 0, "Partei Nr. oder Name: ", NULL));
touchwin(stdscr); /* redraw erzwingen */ touchwin(stdscr); /* redraw erzwingen */
for (tmp = P; tmp; tmp = tmp->next) { for (tmp = P; tmp; tmp = tmp->next) {
s = tmp->s; s = tmp->s;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_tools.c,v 1.3 2001/02/03 13:45:34 enno Exp $ * $Id: map_tools.c,v 1.4 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -186,23 +186,34 @@ yes_no(WINDOW * win, const char *text, const char def)
} }
char * char *
my_input(WINDOW * win, int x, int y, const char *text) my_input(WINDOW * win, int x, int y, const char *text, const char *def)
{ {
static char buf[INPUT_BUFSIZE+1]; static char lbuf[INPUT_BUFSIZE+1];
int val, ch, p, nw = 0; int val, ch, p, nw = 0;
if (!win) { if (!win) {
win = openwin(SX - 10, 3, 0); win = openwin(SX - 10, 3, 0);
y = nw = 1; y = nw = 1;
x = 2; x = 2;
} }
wmove(win, y, x); wmove(win, y, x);
wAddstr(text); wAddstr(text);
wmove(win, y, x + strlen(text)); if(def) {
strcpy(lbuf, def);
wAddstr(lbuf);
p = x + strlen(text);
val = strlen(lbuf);
wmove(win, y, p + val);
} else {
p = x + strlen(text);
wmove(win, y, p);
val = 0;
}
wrefresh(win); wrefresh(win);
curs_set(1); curs_set(1);
wcursyncup(win); wcursyncup(win);
p = strlen(text) + x;
val = 0;
do { do {
ch = getch(); ch = getch();
if (ch == KEY_BACKSPACE || ch == KEY_LEFT) { if (ch == KEY_BACKSPACE || ch == KEY_LEFT) {
@ -221,7 +232,7 @@ my_input(WINDOW * win, int x, int y, const char *text)
beep(); beep();
} else if (isprint(ch)) { } else if (isprint(ch)) {
waddch(win, ch); waddch(win, ch);
buf[val] = (char) ch; lbuf[val] = (char) ch;
val++; val++;
} else } else
beep(); beep();
@ -230,8 +241,8 @@ my_input(WINDOW * win, int x, int y, const char *text)
if (nw) if (nw)
delwin(win); delwin(win);
curs_set(0); curs_set(0);
buf[val] = 0; lbuf[val] = 0;
return buf; return lbuf;
} }
void void

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: map_units.c,v 1.2 2001/01/26 16:19:41 enno Exp $ * $Id: map_units.c,v 1.3 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -31,6 +31,7 @@
#include <ship.h> #include <ship.h>
#include <skill.h> #include <skill.h>
#include <unit.h> #include <unit.h>
#include <base36.h>
/* libc includes */ /* libc includes */
#include <ctype.h> #include <ctype.h>
@ -47,20 +48,22 @@ make_new_unit(region * r)
unit *u; unit *u;
faction *f; faction *f;
WINDOW *win; WINDOW *win;
char *fac_nr36;
int i, p, anz, q, y; int i, p, anz, q, y;
win = openwin(SX - 10, 8, "< Neue Einheit erschaffen >"); win = openwin(SX - 10, 8, "< Neue Einheit erschaffen >");
if (r->units)
p = r->units->faction->no;
else
p = 0;
do { do {
if (r->units) fac_nr36 = my_input(win, 2, 1, "Parteinummer: ", itoa36(p));
p = r->units->faction->no; if(fac_nr36 == NULL || *fac_nr36 == 0) {
else
p = 0;
p = map_input(win, 2, 1, "Parteinummer", -1, 999, p);
if (p < 0) {
delwin(win); delwin(win);
return 0; return 0;
} }
f = findfaction(p); f = findfaction(atoi36(fac_nr36));
} while (!f); } while (!f);
wmove(win, 1, 2); wmove(win, 1, 2);
wclrtoeol(win); wclrtoeol(win);
@ -102,7 +105,7 @@ make_new_unit(region * r)
} }
buf[0] = 0; buf[0] = 0;
strcpy(buf, my_input(win, 2, 4, "Name: ")); strcpy(buf, my_input(win, 2, 4, "Name: ", NULL));
if (buf[0]) if (buf[0])
set_string(&u->name, buf); set_string(&u->name, buf);
if (!strlen(u->name)) if (!strlen(u->name))
@ -730,7 +733,7 @@ dblparagraph(dbllist ** SP, char *s, int indent, char mark)
{ {
int i, j, width, delta = 0; int i, j, width, delta = 0;
int firstline; int firstline;
static char buf[128]; static char lbuf[128];
width = SX - 5 - indent; width = SX - 5 - indent;
firstline = 1; firstline = 1;
@ -753,7 +756,7 @@ dblparagraph(dbllist ** SP, char *s, int indent, char mark)
j = 0; j = 0;
if (firstline) { if (firstline) {
if (*s == '\025') { /* \023 ist ^U => Unit-Kennung */ if (*s == '\025') { /* \023 ist ^U => Unit-Kennung */
buf[0] = '\025'; /* Kennung nach vorne lbuf[0] = '\025'; /* Kennung nach vorne
* holen */ * holen */
delta = 1; delta = 1;
} }
@ -761,16 +764,16 @@ dblparagraph(dbllist ** SP, char *s, int indent, char mark)
delta = 0; delta = 0;
for (j = 0; j != indent; j++) for (j = 0; j != indent; j++)
buf[j + delta] = ' '; lbuf[j + delta] = ' ';
if (firstline && mark) if (firstline && mark)
buf[indent - 2 + delta] = mark; lbuf[indent - 2 + delta] = mark;
for (j = 0; j != i - 1; j++) for (j = 0; j != i - 1; j++)
buf[indent + j + delta] = s[j + delta]; lbuf[indent + j + delta] = s[j + delta];
buf[indent + j + delta] = 0; lbuf[indent + j + delta] = 0;
adddbllist(SP, buf); adddbllist(SP, lbuf);
if (!s[i - 1 + delta]) if (!s[i - 1 + delta])
break; break;
@ -849,17 +852,16 @@ mapper_spunit(dbllist ** SP, unit * u, int indent)
dh = 0; dh = 0;
for (itm = u->items;itm;itm=itm->next) { for (itm = u->items;itm;itm=itm->next) {
int i = itm->number;
sncat(buf, ", ", BUFSIZE); sncat(buf, ", ", BUFSIZE);
if (!dh) { if (!dh) {
sncat(buf, "hat: ", BUFSIZE); sncat(buf, "hat: ", BUFSIZE);
dh = 1; dh = 1;
} }
if (i == 1) if (itm->number == 1)
sncat(buf, locale_string(NULL, resourcename(itm->type->rtype, 0)), BUFSIZE); sncat(buf, locale_string(NULL, resourcename(itm->type->rtype, 0)), BUFSIZE);
else { else {
icat(i); icat(itm->number);
sncat(buf, " ", BUFSIZE); sncat(buf, " ", BUFSIZE);
sncat(buf, locale_string(NULL, resourcename(itm->type->rtype, GR_PLURAL)), BUFSIZE); sncat(buf, locale_string(NULL, resourcename(itm->type->rtype, GR_PLURAL)), BUFSIZE);
} }
@ -910,7 +912,7 @@ showunits(region * r)
dbllist *eh = NULL, *unten, *oben, *hlp = NULL, *such = NULL, *tmp; dbllist *eh = NULL, *unten, *oben, *hlp = NULL, *such = NULL, *tmp;
int line, ch, bottom, bot, f, f2; int line, ch, bottom, bot, f, f2;
size_t lt; size_t lt;
char *s = NULL, *txt, *suchtext = 0, str[45], buf[256]; char *s = NULL, *txt, *suchtext = 0, str[45], lbuf[256];
clear(); clear();
strncpy(str, rname(r, NULL), 44); strncpy(str, rname(r, NULL), 44);
@ -923,16 +925,16 @@ showunits(region * r)
for (b = r->buildings; b; b = b->next) { for (b = r->buildings; b; b = b->next) {
if (b->type == &bt_castle) { if (b->type == &bt_castle) {
sprintf(buf, "\002%s, Größe %d, %s", buildingname(b), b->size, buildingtype(b, b->size, NULL)); sprintf(lbuf, "\002%s, Größe %d, %s", buildingname(b), b->size, buildingtype(b, b->size, NULL));
} else { } else {
sprintf(buf, "\002%s, Größe %d, %s", buildingname(b), sprintf(lbuf, "\002%s, Größe %d, %s", buildingname(b),
b->size, buildingtype(b, b->size, NULL)); b->size, buildingtype(b, b->size, NULL));
if (b->type->maxsize > 0 && if (b->type->maxsize > 0 &&
b->size < b->type->maxsize) { b->size < b->type->maxsize) {
sncat(buf, " (im Bau)", BUFSIZE); sncat(lbuf, " (im Bau)", BUFSIZE);
} }
} }
adddbllist(&eh, buf); adddbllist(&eh, lbuf);
adddbllist(&eh, " "); adddbllist(&eh, " ");
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->building == b && fval(u, FL_OWNER)) { if (u->building == b && fval(u, FL_OWNER)) {
@ -950,20 +952,20 @@ showunits(region * r)
f=0; f=0;
for (u = r->units; u; u = u->next) for (u = r->units; u; u = u->next)
if (u->ship == sh) f += weight(u); if (u->ship == sh) f += weight(u);
sprintf(buf, "\023%s, %s, (%d/%d)", shipname(sh), sh->type->name[0], sprintf(lbuf, "\023%s, %s, (%d/%d)", shipname(sh), sh->type->name[0],
(f+99)/100, shipcapacity(sh)/100); (f+99)/100, shipcapacity(sh)/100);
if (sh->size!=sh->type->construction->maxsize) { if (sh->size!=sh->type->construction->maxsize) {
f = 100 * (sh->size) / sh->type->construction->maxsize; f = 100 * (sh->size) / sh->type->construction->maxsize;
sncat(buf, ", im Bau (", BUFSIZE); sncat(lbuf, ", im Bau (", BUFSIZE);
icat(f); icat(f);
sncat(buf, "%) ", BUFSIZE); sncat(lbuf, "%) ", BUFSIZE);
} }
if (sh->damage) { if (sh->damage) {
sncat(buf, ", ", BUFSIZE); sncat(lbuf, ", ", BUFSIZE);
icat(sh->damage); icat(sh->damage);
sncat(buf, "% beschädigt", BUFSIZE); sncat(lbuf, "% beschädigt", BUFSIZE);
} }
adddbllist(&eh, buf); adddbllist(&eh, lbuf);
adddbllist(&eh, " "); adddbllist(&eh, " ");
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->ship == sh && fval(u, FL_OWNER)) { if (u->ship == sh && fval(u, FL_OWNER)) {
@ -1084,7 +1086,7 @@ showunits(region * r)
f = -1; f = -1;
break; break;
case '/': case '/':
suchtext = my_input(0, 0, 0, "Suchtext: "); suchtext = my_input(0, 0, 0, "Suchtext: ", NULL);
such = eh; such = eh;
case 'n': case 'n':
if (suchtext) { if (suchtext) {
@ -1175,8 +1177,8 @@ showunits(region * r)
switch (pointer->s[0]) { switch (pointer->s[0]) {
case '\002': case '\002':
b = findbuilding(f); b = findbuilding(f);
sprintf(buf, "Einheit in %s als Eigner?", BuildingName(b)); sprintf(lbuf, "Einheit in %s als Eigner?", BuildingName(b));
if (yes_no(0, buf, 'j')) { if (yes_no(0, lbuf, 'j')) {
for (x = r->units; x; x = x->next) for (x = r->units; x; x = x->next)
if (x->building == b && fval(x, FL_OWNER)) { if (x->building == b && fval(x, FL_OWNER)) {
freset(x, FL_OWNER); freset(x, FL_OWNER);
@ -1188,8 +1190,8 @@ showunits(region * r)
break; break;
case '\023': case '\023':
sh = findship(f); sh = findship(f);
sprintf(buf, "Einheit auf%s als Eigner?", shipname(sh)); sprintf(lbuf, "Einheit auf%s als Eigner?", shipname(sh));
if (yes_no(0, buf, 'j')) { if (yes_no(0, lbuf, 'j')) {
for (x = r->units; x; x = x->next) for (x = r->units; x; x = x->next)
if (x->ship == sh && fval(x, FL_OWNER)) { if (x->ship == sh && fval(x, FL_OWNER)) {
freset(x, FL_OWNER); freset(x, FL_OWNER);
@ -1203,12 +1205,12 @@ showunits(region * r)
x = findunit(f, r); x = findunit(f, r);
if(x) { if(x) {
if (x->building) { if (x->building) {
sprintf(buf, "Einheit in %s rein?", buildingname(x->building)); sprintf(lbuf, "Einheit in %s rein?", buildingname(x->building));
if (yes_no(0, buf, 'j')) if (yes_no(0, lbuf, 'j'))
u->building = x->building; u->building = x->building;
} else if (x->ship) { } else if (x->ship) {
sprintf(buf, "Einheit auf%s rauf?", shipname(x->ship)); sprintf(lbuf, "Einheit auf%s rauf?", shipname(x->ship));
if (yes_no(0, buf, 'j')) if (yes_no(0, lbuf, 'j'))
u->ship = x->ship; u->ship = x->ship;
} }
} }
@ -1228,8 +1230,8 @@ showunits(region * r)
if (!clipship) if (!clipship)
beep(); beep();
else { else {
sprintf(buf, "Schiff%s löschen?", shipname(clipship)); sprintf(lbuf, "Schiff%s löschen?", shipname(clipship));
if (yes_no(0, buf, 'n')) { if (yes_no(0, lbuf, 'n')) {
modified = 1; modified = 1;
for (x = shipregion->units; x; x = x->next) for (x = shipregion->units; x; x = x->next)
leave(shipregion, x); leave(shipregion, x);
@ -1248,8 +1250,8 @@ showunits(region * r)
case 's': case 's':
if (clipship && shipregion != r) { if (clipship && shipregion != r) {
unit *un; unit *un;
sprintf(buf, "Schiff %s einfügen?", shipname(clipship)); sprintf(lbuf, "Schiff %s einfügen?", shipname(clipship));
if (yes_no(0, buf, 'j')) { if (yes_no(0, lbuf, 'j')) {
boolean owner_set = false; boolean owner_set = false;
for (x = shipregion->units; x;) { for (x = shipregion->units; x;) {
@ -1294,8 +1296,8 @@ showunits(region * r)
if (f) { if (f) {
b = findbuilding(f); b = findbuilding(f);
if (b) { if (b) {
sprintf(buf, "Gebäude %s löschen?", BuildingName(b)); sprintf(lbuf, "Gebäude %s löschen?", BuildingName(b));
if (yes_no(0, buf, 'n')) { if (yes_no(0, lbuf, 'n')) {
modified = 1; modified = 1;
for (x = r->units; x; x = x->next) for (x = r->units; x; x = x->next)
if (x->building == b) if (x->building == b)
@ -1401,8 +1403,8 @@ showunits(region * r)
if (!clipunit) if (!clipunit)
beep(); beep();
else { else {
sprintf(buf, "Einheit %s löschen?", Unitid(clipunit)); sprintf(lbuf, "Einheit %s löschen?", Unitid(clipunit));
if (yes_no(0, buf, 'n')) { if (yes_no(0, lbuf, 'n')) {
modified = 1; modified = 1;
destroy_unit(clipunit); destroy_unit(clipunit);
clipunit = 0; clipunit = 0;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: mapper.c,v 1.6 2001/02/05 16:11:58 enno Exp $ * $Id: mapper.c,v 1.7 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -498,7 +498,7 @@ SetHighlight(void)
c = tolower(getch()); c = tolower(getch());
switch (c) { switch (c) {
case 'p': case 'p':
fac_nr36 = my_input(win, 2, 2, "Partei-Nummer: "); fac_nr36 = my_input(win, 2, 2, "Partei-Nummer: ", NULL);
hl = atoi36(fac_nr36); hl = atoi36(fac_nr36);
break; break;
case 'e': case 'e':
@ -741,7 +741,7 @@ movearound(int rx, int ry) {
switch(sel) { switch(sel) {
case 'e': case 'e':
case 'E': case 'E':
q = atoi36(my_input(win, 2, 2, "Welche Einheit suchen: ")); q = atoi36(my_input(win, 2, 2, "Welche Einheit suchen: ", NULL));
if (q) { if (q) {
u = findunitg(q, NULL); u = findunitg(q, NULL);
if (!u) { if (!u) {
@ -755,7 +755,7 @@ movearound(int rx, int ry) {
break; break;
case 'p': case 'p':
case 'P': case 'P':
q = atoi36(my_input(win, 2, 2, "Welche Partei suchen: ")); q = atoi36(my_input(win, 2, 2, "Welche Partei suchen: ", NULL));
if(q) { if(q) {
u2 = NULL; u2 = NULL;
for(r2=regions; r2; r2=r2->next) { for(r2=regions; r2; r2=r2->next) {
@ -773,7 +773,7 @@ movearound(int rx, int ry) {
break; break;
case 'r': case 'r':
case 'R': case 'R':
selc = my_input(win, 2, 2, "Welchen Regionsnamen suchen: "); selc = my_input(win, 2, 2, "Welchen Regionsnamen suchen: ", NULL);
if(*selc) { if(*selc) {
for(r2=regions; r2; r2=r2->next) for(r2=regions; r2; r2=r2->next)
if(strcmp(selc, rname(r2, NULL)) == 0) break; if(strcmp(selc, rname(r2, NULL)) == 0) break;

View File

@ -1,6 +1,6 @@
/* vi: set ts=2: /* vi: set ts=2:
* *
* $Id: mapper.h,v 1.3 2001/02/03 13:45:34 enno Exp $ * $Id: mapper.h,v 1.4 2001/02/09 13:53:53 corwin Exp $
* Eressea PB(E)M host Copyright (C) 1998-2000 * Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de) * Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de) * Katja Zedel (katze@felidae.kn-bremen.de)
@ -56,7 +56,7 @@ void NeuesSchiff(struct region * r);
void create_island(struct region *r, int n, terrain_t t); void create_island(struct region *r, int n, terrain_t t);
void make_new_block(int x, int y); void make_new_block(int x, int y);
void moveln(const int x); void moveln(const int x);
char *my_input(WINDOW * win, int x, int y, const char *text); char *my_input(WINDOW * win, int x, int y, const char *text, const char *def);
void make_new_region(int x, int y); void make_new_region(int x, int y);
int map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre); int map_input(WINDOW * win, int x, int y, const char *text, int mn, int mx, int pre);
boolean yes_no(WINDOW * win, const char *text, const char def); boolean yes_no(WINDOW * win, const char *text, const char def);