Newsgroups: rec.arts.int-fiction
Path: gmd.de!nntp.gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!whitten
From: whitten@netcom.com (David Whitten)
Subject: Re: Bit fields in TADS(?)
Message-ID: <whittenCsvx99.65y@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
X-Newsreader: TIN [version 1.2 PL1]
References: <Bill.Edwards.96.2E22DFD1@asu> <2vvug3$d2n@sunb.ocs.mq.edu.au>
Date: Wed, 13 Jul 1994 15:19:54 GMT
Lines: 31


I think the reason you would want to do bitfields is not that you want
to save memory, but that you want to use a mask.

ie: Lets say you had a certain set of properties that reflect the emotional
state of a NPC.

You could then test if the NPC is 'activelyangry' (as opposed to passively
angry) by having a mask that has some of the properties true, some of the
properties false, and some of the properties "don't care"

It is a lot easier to code and read 

if (mask(activelyangry) && NPC1.emotionstate)

than

if NPC1.emotionstate.agitated= true
and NPC1.emotionstate.frustrated= true
and NPC1.emotionstate.sleepy = false
and NPC1.emotionstate.pensive = false

...etc.


(NOTE: I don't program TADS, but assume some variation of this makes
sense...



Dave (whitten@netcom.com) (214) 437-5255
