Commit graph

21 commits

Author SHA1 Message Date
dc9d847b8b 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().
2008-05-07 10:33:41 +02:00
0dd6702df1 Update known contributors comments 2008-03-14 20:25:44 +01:00
a680c81110 Put a timestamp into struct emptypedstr
Make sure all members of unit empobj_storage share it.

Add matching timestamp member to struct comstr, struct empobj, struct
gamestr, struct lonstr, struct natstr, struct nwsstr, struct trdstr,
struct trtstr.  The timestamp isn't yet set for these.  To be fixed.

Move the timestamp member to the right place in struct lndstr, struct
loststr, struct realmstr, struct nukstr, struct plnstr, struct sctstr,
struct shpstr.
2008-03-14 20:25:43 +01:00
f99adf4b3c Rename emp_obj_chr_name() to empobj_chr_name() 2008-03-14 20:25:09 +01:00
6cd3d55c4e Initialize ef_type and uid automatically in ef_extend()
New struct emptypedstr to avoid depending on empobj.h there.

Remove now superfluous manual initializations elsewhere.

This doesn't fix any missing initializations.
2008-03-05 22:48:23 +01:00
49780e2c6c Extend the common header of struct empobj to include uid
Make sure all members of unit empobj_storage share uid in addition to
ef_type.

Add matching uid member to struct gamestr, struct natstr and struct
sctstr, and set them.

Swap struct empobj members uid and own to make that easier, and update
struct comstr, struct lndstr, struct lonstr, struct loststr, struct
nwsstr, struct nukstr, struct plnstr, struct realmstr, struct shpstr,
struct trdstr, struct trtstr accordingly.

Note that the uid isn't properly set for struct nwsstr, struct lonstr,
struct trdstr, struct comstr and struct loststr.  To be fixed.
2008-03-05 22:48:20 +01:00
7bbbcc8643 Define common get/put macros for empobj
This turns existing functions get_empobjp() and put_empobj() into
equivalent macros.
2008-02-26 21:07:58 +01:00
59c65239f7 Fix put_empobj() for types other than units
put_empobj() used struct empobj member uid, which is valid only for
units.  Existing users pass only units, fortunately.  Fix by making it
take type and uid parameters.
2008-02-26 21:07:58 +01:00
74e873e96c Make sector types signed
get_empobj_chr() and emp_obj_chr_name() access struct sctstr member
sct_type through struct empobj member type.  This is technically
non-portable, because the two differ in signedness.  It was also
undocumented.  Fix by making sct_type signed.  sct_newtype as well,
for consistency.

map_char() uses unsigned char for a sector type argument.  Change that
to int.  Matches how this is done elsewhere.
2008-02-26 21:07:57 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
654335c621 New Empire table game, to be used for global stuff:
(gamestr, EF_GAME, game_ca): New.
(empfile): Declare the table.
(ef_open_srv, ef_close_srv): Open and close it.
(main): Create it.
(empobj_storage): New member game.

(EF_DYNMAX): New.
(EF_IS_GAME_STATE): Use it.
2007-07-14 14:49:58 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
Ron Koenderink
ebf588b713 (empobj_chr): New, create a new (imcomplete) structure for
empobj characteristics.
(get_empobj_chr):  Update get_empobj_chr() to use new
struct empobj_chr.
2006-08-18 23:32:45 +00:00
Ron Koenderink
34f29824eb (get_empobj_mob_max): Switch ef_type to type to be more consistent
with other functions.
2006-07-26 00:40:33 +00:00
Ron Koenderink
fec9878ca4 (get_empobjp): New. Returns a pointer an empobj.
(emp_obj_chr_name): New. Returns a pointer to the characteristics name
for an empobj.
(unit_map):  Simplify unit_map() by using get_empobjp() and
emp_obj_chr_name().
(map,  cmd_move_map):  Switch to EF_SHIP as unit_map does not default
to EF_SHIP for EF_BAD anymore.
2006-07-26 00:21:58 +00:00
Ron Koenderink
b70653815c (get_empobj_mob_max): New. Return maximum mobility based on ef_type.
(miss): Use new get_empobj_mob_max().
2006-07-24 13:40:12 +00:00
Ron Koenderink
a62989d4a3 (put_empobj): New. Put generic empobj into the appropriate data file.
(get_empobj_chr): New.  Get characteristics for empobj.
(mission, build_mission_list_type): Switch to use new
functions put_empobj() and get_empobj_chr().
2006-07-20 14:12:35 +00:00
Ron Koenderink
6d90861aae (obj_nameof): New.
(nameofitem): Remove, switch callers to to obj_nameof().
(mission, show_mission): Convert functions to use obj_nameof()
instead of nameofitem().
2006-07-10 23:14:26 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
Ron Koenderink
1b0ff6cbac Correct file name in the comments to match the actual file name. 2006-07-08 00:27:20 +00:00
Ron Koenderink
79ee88f7c6 (nxtitemp, trade_getitem, trade_desc, trade_check_item_ok, nxtitem,
oprange, show_mission, nameofitem, build_mission_list_type,
unit_map, xdvisible, trdswitchown, ontradingblock, trad, check_trade,
unit_type_name, start_stop_unit, scut, scra, mission, multifire,
perform_mission, fuel, NSC_GENITEM): Replace struct genitem with
struct empobj.  Remove genitem.h and create a new file empobj.h.
Replace multiple instances of unions of ef_type structures with
one standard union empobj_storage which is a superset of the individual
instances.
2006-07-07 15:15:43 +00:00
Renamed from include/genitem.h (Browse further)