crashbug gefixt

This commit is contained in:
Enno Rehling 2001-12-15 20:40:41 +00:00
parent 2e67b979de
commit fe9ef7457e
2 changed files with 45 additions and 5 deletions

View File

@ -585,7 +585,11 @@ ParteiListe(void)
return 0; return 0;
case 13: case 13:
case 10: case 10:
ModifyPartei(findfaction(atoi(pointer->s))); {
char fno[5];
strncpy(fno, pointer->s, 4);
ModifyPartei(findfaction(atoi36(fno)));
}
break; break;
case 'D': case 'D':
RemovePartei(); RemovePartei();

View File

@ -296,6 +296,35 @@ crwritemap(void)
return 0; return 0;
} }
static void
readfactions(void)
{
FILE * F = fopen("factions.txt", "r");
region * r;
locale * german = find_locale("de");
while (!feof(F)) {
int x, y;
region * r;
unit * u;
const race * rc;
locale * lang;
char email[64];
char racename[32];
char langname[32];
fscanf(F, "%d %d %s %s %s\n", &x, &y, langname, racename, email);
rc = findrace(racename, german);
r = findregion(x, y);
lang = find_locale(langname);
assert(rc && r && lang);
u = addplayer(r, email, rc, lang);
assert(u);
i_change(&u->items, finditemtype("stein", german), 30);
i_change(&u->items, finditemtype("holz", german), 30);
}
fclose(F);
modified = 1;
}
void void
drawmap(boolean maponly) { drawmap(boolean maponly) {
@ -554,7 +583,7 @@ modify_block(void)
r=t->r; r=t->r;
if (production(r)) { if (production(r)) {
switch (c) { switch (c) {
case 'n': case 'n':
rsetname(r, name); rsetname(r, name);
break; break;
case 'p': case 'p':
@ -732,7 +761,10 @@ movearound(int rx, int ry) {
DisplayRegList(1); DisplayRegList(1);
ch = 999999; ch = 999999;
break; break;
case '': case 18: /* ctrl-r*/
readfactions();
break;
case 23: /* ctrl-w*/
crwritemap(); crwritemap();
break; break;
case 'q': case 'q':
@ -1020,7 +1052,7 @@ movearound(int rx, int ry) {
unit *u, *un; unit *u, *un;
region *target_r; region *target_r;
static int tx = 0, ty = 0; static int tx = 0, ty = 0;
tx=map_input(0,0,0,"Versetzen nach X-Koordinate", MINX, MAXX, tx); tx=map_input(0,0,0,"Versetzen nach X-Koordinate", MINX, MAXX, tx);
ty=map_input(0,0,0,"Versetzen nach Y-Koordinate", MINY, MAXY, ty); ty=map_input(0,0,0,"Versetzen nach Y-Koordinate", MINY, MAXY, ty);
target_r = findregion(tx,ty); target_r = findregion(tx,ty);
@ -1310,6 +1342,7 @@ extern boolean quiet;
extern char * g_reportdir; extern char * g_reportdir;
extern char * g_datadir; extern char * g_datadir;
extern char * g_resourcedir;
extern char * g_basedir; extern char * g_basedir;
int int
@ -1354,6 +1387,9 @@ main(int argc, char *argv[])
case 'd': case 'd':
g_datadir = argv[++i]; g_datadir = argv[++i];
break; break;
case 'r':
g_resourcedir = argv[++i];
break;
case 'o': case 'o':
strcpy(datafile, argv[++i]); strcpy(datafile, argv[++i]);
break; break;
@ -1392,7 +1428,7 @@ main(int argc, char *argv[])
init_attributes(); init_attributes();
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
init_rawmaterials(); init_rawmaterials();
#endif #endif
init_museum(); init_museum();
init_arena(); init_arena();