forked from github/server
fix a bug reading gamedata
n is not a loop variable, it is purely for use as a temporary here.
This commit is contained in:
parent
6b5a28cd98
commit
96b3e302be
|
@ -652,7 +652,7 @@ int read_borders(struct storage *store)
|
||||||
|
|
||||||
type = find_bordertype(zText);
|
type = find_bordertype(zText);
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
log_error("[read_borders] unknown connection type %s in %s\n", zText, regionname(from, NULL));
|
log_error("[read_borders] unknown connection type '%s' in %s\n", zText, regionname(from, NULL));
|
||||||
assert(type || !"connection type not registered");
|
assert(type || !"connection type not registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1404,7 +1404,7 @@ void writefaction(struct gamedata *data, const faction * f)
|
||||||
|
|
||||||
int readgame(const char *filename, int backup)
|
int readgame(const char *filename, int backup)
|
||||||
{
|
{
|
||||||
int i, n, p;
|
int i, n, p, nread;
|
||||||
faction *f, **fp;
|
faction *f, **fp;
|
||||||
region *r;
|
region *r;
|
||||||
building *b, **bp;
|
building *b, **bp;
|
||||||
|
@ -1465,13 +1465,13 @@ int readgame(const char *filename, int backup)
|
||||||
log_printf(stdout, " - reading turn %d\n", turn);
|
log_printf(stdout, " - reading turn %d\n", turn);
|
||||||
rng_init(turn);
|
rng_init(turn);
|
||||||
++global.cookie;
|
++global.cookie;
|
||||||
READ_INT(&store, &n); /* max_unique_id = ignore */
|
READ_INT(&store, &nread); /* max_unique_id = ignore */
|
||||||
READ_UINT(&store, &nextborder);
|
READ_UINT(&store, &nextborder);
|
||||||
|
|
||||||
/* Planes */
|
/* Planes */
|
||||||
planes = NULL;
|
planes = NULL;
|
||||||
READ_INT(&store, &n);
|
READ_INT(&store, &nread);
|
||||||
while (--n >= 0) {
|
while (--nread >= 0) {
|
||||||
int id;
|
int id;
|
||||||
variant fno;
|
variant fno;
|
||||||
plane *pl;
|
plane *pl;
|
||||||
|
@ -1526,13 +1526,13 @@ int readgame(const char *filename, int backup)
|
||||||
if (gdata.version >= ALLIANCES_VERSION) {
|
if (gdata.version >= ALLIANCES_VERSION) {
|
||||||
read_alliances(&store);
|
read_alliances(&store);
|
||||||
}
|
}
|
||||||
READ_INT(&store, &n);
|
READ_INT(&store, &nread);
|
||||||
log_printf(stdout, " - Einzulesende Parteien: %d\n", n);
|
log_printf(stdout, " - Einzulesende Parteien: %d\n", nread);
|
||||||
fp = &factions;
|
fp = &factions;
|
||||||
while (*fp)
|
while (*fp)
|
||||||
fp = &(*fp)->next;
|
fp = &(*fp)->next;
|
||||||
|
|
||||||
while (--n >= 0) {
|
while (--nread >= 0) {
|
||||||
faction *f = readfaction(&gdata);
|
faction *f = readfaction(&gdata);
|
||||||
|
|
||||||
*fp = f;
|
*fp = f;
|
||||||
|
@ -1551,20 +1551,20 @@ int readgame(const char *filename, int backup)
|
||||||
|
|
||||||
/* Regionen */
|
/* Regionen */
|
||||||
|
|
||||||
READ_INT(&store, &n);
|
READ_INT(&store, &nread);
|
||||||
assert(n < MAXREGIONS);
|
assert(nread < MAXREGIONS);
|
||||||
if (rmax < 0) {
|
if (rmax < 0) {
|
||||||
rmax = n;
|
rmax = nread;
|
||||||
}
|
}
|
||||||
log_printf(stdout, " - Einzulesende Regionen: %d/%d\r", rmax, n);
|
log_printf(stdout, " - Einzulesende Regionen: %d/%d\r", rmax, nread);
|
||||||
while (--n >= 0) {
|
while (--nread >= 0) {
|
||||||
unit **up;
|
unit **up;
|
||||||
int x, y;
|
int x, y;
|
||||||
READ_INT(&store, &x);
|
READ_INT(&store, &x);
|
||||||
READ_INT(&store, &y);
|
READ_INT(&store, &y);
|
||||||
|
|
||||||
if ((n & 0x3FF) == 0) { /* das spart extrem Zeit */
|
if ((nread & 0x3FF) == 0) { /* das spart extrem Zeit */
|
||||||
log_printf(stdout, " - Einzulesende Regionen: %d/%d * %d,%d \r", rmax, n, x, y);
|
log_printf(stdout, " - Einzulesende Regionen: %d/%d * %d,%d \r", rmax, nread, x, y);
|
||||||
}
|
}
|
||||||
--rmax;
|
--rmax;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue