(swaps): Failed to update coastal flags. Was missed in the changeset
containing coastal.c rev. 1.1. (set_coastal): New parameter olddes, to simplify fixing swaps(). Callers changed.
This commit is contained in:
parent
ad0a37eca4
commit
6db2e6ec63
5 changed files with 26 additions and 17 deletions
|
@ -44,8 +44,7 @@ static void print_res(struct sctstr *);
|
|||
int
|
||||
swaps(void)
|
||||
{
|
||||
struct sctstr secta, sectb;
|
||||
coord x, y;
|
||||
struct sctstr secta, sectb, tmp;
|
||||
char buf[1024];
|
||||
char *p;
|
||||
|
||||
|
@ -61,20 +60,25 @@ swaps(void)
|
|||
print_res(§b);
|
||||
if (!confirm ("Are you sure these are the two sectors you wish to swap? "))
|
||||
return RET_FAIL;
|
||||
/* save x and y from secta */
|
||||
x = secta.sct_x;
|
||||
y = secta.sct_y;
|
||||
tmp = secta;
|
||||
/* change the location of secta to that of sectb */
|
||||
secta.sct_x = sectb.sct_x;
|
||||
secta.sct_y = sectb.sct_y;
|
||||
secta.sct_dist_x = sectb.sct_x;
|
||||
secta.sct_dist_y = sectb.sct_y;
|
||||
secta.sct_coastal = sectb.sct_coastal;
|
||||
/* change the location of sectb to where secta was */
|
||||
sectb.sct_x = x;
|
||||
sectb.sct_y = y;
|
||||
sectb.sct_dist_x = x;
|
||||
sectb.sct_dist_y = y;
|
||||
sectb.sct_x = tmp.sct_x;
|
||||
sectb.sct_y = tmp.sct_y;
|
||||
sectb.sct_dist_x = tmp.sct_x;
|
||||
sectb.sct_dist_y = tmp.sct_y;
|
||||
sectb.sct_coastal = tmp.sct_coastal;
|
||||
/* update coastal flag & put sectors */
|
||||
putsect(§b);
|
||||
set_coastal(§a, sectb.sct_type, secta.sct_type);
|
||||
putsect(§a);
|
||||
getsect(sectb.sct_x, sectb.sct_y, §b);
|
||||
set_coastal(§b, secta.sct_type, sectb.sct_type);
|
||||
putsect(§b);
|
||||
pr("done\n");
|
||||
return RET_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue