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;
case 13:
case 10:
ModifyPartei(findfaction(atoi(pointer->s)));
{
char fno[5];
strncpy(fno, pointer->s, 4);
ModifyPartei(findfaction(atoi36(fno)));
}
break;
case 'D':
RemovePartei();

View File

@ -296,6 +296,35 @@ crwritemap(void)
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
drawmap(boolean maponly) {
@ -732,7 +761,10 @@ movearound(int rx, int ry) {
DisplayRegList(1);
ch = 999999;
break;
case '':
case 18: /* ctrl-r*/
readfactions();
break;
case 23: /* ctrl-w*/
crwritemap();
break;
case 'q':
@ -1310,6 +1342,7 @@ extern boolean quiet;
extern char * g_reportdir;
extern char * g_datadir;
extern char * g_resourcedir;
extern char * g_basedir;
int
@ -1354,6 +1387,9 @@ main(int argc, char *argv[])
case 'd':
g_datadir = argv[++i];
break;
case 'r':
g_resourcedir = argv[++i];
break;
case 'o':
strcpy(datafile, argv[++i]);
break;