(cens, desi, dump, do_desi, doland, file_sct_init, grow_continents)

(grow_islands, set_coastal, update_coastal_flag, coast_sea_to_land)
(coast_land_to_sea): Determine sct_coastal flag when the sector type
is set.  Old method only updated the sct_coastal flag when doing
cens() or a dump().  Other uses of sct_coastal could get stale values,
including selector coastal.  Rework set_coastal() into NEW functions
update_coastal_flag(), coast_sea_to_land(), coast_land_to_sea() and
set_coastal().  Fix a bug where the deity designation would not
properly set the coastal flag.  Fix a bug where the one sector lake
would not properly compute coastal flag.  Fix a bug that makes
fairland treat the last sector it adds to an island as non-coastal.
This commit is contained in:
Ron Koenderink 2005-11-17 03:21:32 +00:00
parent 8f98e53a23
commit 7b94794365
9 changed files with 146 additions and 37 deletions

View file

@ -32,14 +32,8 @@
*
*/
#include "misc.h"
#include "player.h"
#include "xy.h"
#include "sect.h"
#include "nsc.h"
#include "nat.h"
#include "prototypes.h"
#include "path.h"
#include "file.h"
#include "commands.h"
#include "optlist.h"
@ -110,7 +104,6 @@ cens(void)
if (opt_FALLOUT) {
pr("%5d", sect.sct_fallout);
}
set_coastal(&sect);
if (sect.sct_coastal)
pr("%4d", sect.sct_coastal);
pr("\n");
@ -145,28 +138,3 @@ cens_hdr(void)
pr("\n");
}
void
set_coastal(struct sctstr *sp)
{
int n;
struct sctstr sect;
u_char start_flags = sp->sct_coastal;
/* It's already been set, it didn't change (you can't fill
in water, even with bridge spans they are still coastal.) */
if (sp->sct_coastal)
return;
for (n = 1; n <= 6; ++n) { /* Directions */
getsect(sp->sct_x + diroff[n][0], sp->sct_y + diroff[n][1], &sect);
if (sect.sct_type == SCT_WATER ||
sect.sct_type == SCT_BTOWER || sect.sct_type == SCT_BSPAN) {
sp->sct_coastal = 1;
if (start_flags != sp->sct_coastal)
putsect(sp);
return;
}
}
sp->sct_coastal = 0;
if (start_flags != sp->sct_coastal)
putsect(sp);
}