(output, translate_continents): When BLITZ is enabled, country numbers

in the newcap script used to be permuted so that start islands are
ordered from top left to bottom right.  Undocumented, unobvious.
Deathtrap if a deity disables BLITZ after running fairland for a real
game.  Remove.
This commit is contained in:
Markus Armbruster 2006-01-05 16:10:39 +00:00
parent 7b6fbbc3d2
commit c6979cb0e0

View file

@ -176,7 +176,6 @@ static int write_newcap_script(void);
static int stable(void); static int stable(void);
static void elevate_land(void); static void elevate_land(void);
static void elevate_sea(void); static void elevate_sea(void);
static void translate_continents(void);
static int map_symbol(int x, int y); static int map_symbol(int x, int y);
static void fl_sct_init(coord x, coord y, s_char *ptr, static void fl_sct_init(coord x, coord y, s_char *ptr,
time_t timestamp); time_t timestamp);
@ -1144,8 +1143,6 @@ static void
output(void) output(void)
{ {
int i, j; int i, j;
if (opt_BLITZ)
translate_continents();
if (quiet == 0) { if (quiet == 0) {
for (i = 0; i < WORLD_Y; ++i) { for (i = 0; i < WORLD_Y; ++i) {
puts(""); puts("");
@ -1164,55 +1161,6 @@ output(void)
printf("\n\nEach continent is marked by a \"*\" on the map (to distinguish them from\nthe islands). You can redesignate these airfields to wilderness sectors\none at a time, each time you add a new country to the game.\n"); printf("\n\nEach continent is marked by a \"*\" on the map (to distinguish them from\nthe islands). You can redesignate these airfields to wilderness sectors\none at a time, each time you add a new country to the game.\n");
} }
/* Reorder the continents from top left to bottom right */
static void
translate_continents(void)
{
int i, j, n = 0, k, gotit, c;
int *trans, *trans_cont, *oldcapx, *oldcapy;
trans = calloc(nc, sizeof(int));
trans_cont = calloc(nc, sizeof(int));
oldcapx = calloc(nc, sizeof(int));
oldcapy = calloc(nc, sizeof(int));
for (i = 0; i < WORLD_Y; ++i) {
for (j = i % 2; j < WORLD_X; j += 2) {
if (own[j][i] > -1 && own[j][i] < nc) {
gotit = 0;
for (k = 0; k < n; ++k) {
if (trans[k] == own[j][i])
gotit = 1;
}
if (!gotit) {
if (n > nc) {
printf("fairland: BUG in translate continents! mail stevens@math.utoronto.ca\n");
exit(2);
}
trans[n] = own[j][i];
trans_cont[own[j][i]] = n;
++n;
}
}
}
}
for (i = 0; i < WORLD_Y; ++i) {
for (j = i % 2; j < WORLD_X; j += 2) {
if (own[j][i] > -1 && own[j][i] < nc) {
own[j][i] = trans_cont[own[j][i]];
}
}
}
for (c = 0; c < nc; ++c) {
oldcapx[c] = capx[c];
oldcapy[c] = capy[c];
}
for (c = 0; c < nc; ++c) {
capx[c] = oldcapx[trans[c]];
capy[c] = oldcapy[trans[c]];
}
}
static int static int
map_symbol(int x, int y) map_symbol(int x, int y)
{ {