CS101:player_specials_saved (fwd)

From: Billy H. Chan (bhchan@po.EECS.Berkeley.EDU)
Date: 06/13/96


In regards to switching ints to sh_ints or longs, etc... well, here's 
probably more detail than you'll ever need (and i might be off a bit here
myself) but here's what's happening with the player_specials_saved
First, p_s_s are saved to FILE (file called lib/etc/players, in fact), 
changing which necessitates the pwipes.  It has nothing to do with memory
per se (memory being RAM) but how something is written to and read from
disk.
Now, the player file looks somewhat like this:
    __________
   | player 1 | where the blocks are of set size
   | data     | so that the program knows that after x bytes, the next
   |__________| player's info is found.
   | player 2 | 
   | data     |
   |__________|
   | etc...   |

Thus, adding and removing stuff from some of the structs in struct.h will
cause much grief as it'll probably change the offset (between when the file
was written and the new program) unless you just rename the spares.

For sh_int to int, it depends on your operatingsystem (actually, machine
architecture) and compiler what happens there.
Some compilers have 16 bit ints and 16 bit sh_ints.  Thus, they're actually
the same.  (old 16bit machines are like this)  (these usually have 32bit
longs, but don't quote me on that one)
Others have 32 bit ints and 16 bit sh_ints and 32 bit longs.  In which case,
changing a long to an int doesn't do diddly (most 32bit systems do this...
but I have a hunch it also depends on the compiler.... from my interview a
few days ago: "shorts are guarenteed to be equal-to or less than an int.
Longs are guarenteed to be equal-to or bigger than an int.")
Some crazies are on 64 bit systems... they get 64bit ints to play with.
(or so I heard)
Hope everything's 100%, but if not, feel free to correct me.
(btw: please try to keep .sigs under 4 lines as requested by general
 netiquette.  there's a newsgroup on it, but I can't quite remember the
 name.  It has some useful FAQ's on newsgroups that normally applies to
 mailinglists too... for instance, this digression being 5 lines long is
 a probably bad thing.  Trimming quotes is a good thing :)  )
BTW: Worst case about adding to the save structure is a player wipe... if
your mud's client base is small, just record everyone's stats, wipe, and
then reimburse.
-- Billy  H. Chan     bhchan@po.eecs.berkeley.edu  bhchan@csua.berkeley.edu
   CogSci/CompSci     http://www.csua.berkeley.edu/~bhchan     ResumeInside

---------- Forwarded message ----------
Date: Thu, 13 Jun 1996 22:39:41 -0400
From: Dave Musser <dmusser@donet.com>
Subject: player_specials_saved

In Structs.h there is a spot for adding variables to the pfiles
without screwing them up and screwing up memory alocation.
My question.. can I change the type of variable without killing
the allocation?
Anyway.. there are no sh_int types in the spares... and I know I
could just use int, but I want to use the sh_int.  So if I change
2 or 3 of the int types to sh_int types in that structure... am I 
going to screw everything up?



This archive was generated by hypermail 2b30 : 12/18/00 PST