Add sequence numbers to game state (experimental)

This catches output dependency violations, e.g. two threads doing a
read-modify-write without synchronization.

New struct emptypedstr member seqno.  Make sure all members of unit
empobj_storage share it.  Set it in ef_blank() and ef_set_uid(), step
it in ef_write().  fairland and files don't use ef_set_uid(); need to
set it manually in files.c's main() and file_sct_init().

Factor do_read() out of fillcache() to make it available for
new get_seqno().
This commit is contained in:
Markus Armbruster 2008-03-21 14:22:07 +01:00 committed by Markus Armbruster
parent 2aec870a14
commit dc9d847b8b
20 changed files with 124 additions and 18 deletions

View file

@ -584,7 +584,7 @@ doland(char op, int arg, char *p, struct sctstr *sect)
return RET_SYN;
sect->sct_x = newx;
sect->sct_y = newy;
sect->sct_uid = XYOFFSET(newx, newy);
ef_set_uid(EF_SECTOR, &sect, XYOFFSET(newx, newy));
break;
case 'D':
if (!sarg_xy(p, &newx, &newy))
@ -767,7 +767,7 @@ doship(char op, int arg, char *p, struct shpstr *ship)
ship->shp_rflags = arg;
break;
case 'U':
ship->shp_uid = arg;
ef_set_uid(EF_SHIP, ship, arg);
break;
case 'O':
if (ship->shp_own)
@ -871,7 +871,7 @@ dounit(char op, int arg, char *p, struct lndstr *land)
land->lnd_land = arg;
break;
case 'U':
land->lnd_uid = arg;
ef_set_uid(EF_SHIP, land, arg);
break;
case 'O':
if (land->lnd_own)