Re: [CODE] Bits in general

From: Zeavon (zeavon@kilnar.com)
Date: 03/21/00


On Tue, 21 Mar 2000, Josh Anderson wrote:

> I have literally spent the entire day reading the list archives
> (approximately 300 posts on the subject) to determine the best course of
> action for adding flags past the first 32 of a type one way or another to my
> mud code.  I have come across three solutions.
>

Josh,
        You've done the research and your summaries are better than
anything else that I could come up with. I used the 128 bit code from
Niese-Petersen <Tenp@cris.com> and it took me about 46 hours (18 hours of
code/4 hours of sleep/16 hours of code/4 hours of sleep/12 hours of
code/12 hours of sleep) to put it in by hand, get the OLC working and fix
all of the compile-time problems that I encountered.
        I had been coding in C for about three months (and using Linux for
the same period of time [1]) when I did this. Anyone that understands C
syntax, has a decent reference book (or three) handy and is knowledgeable
in how to write decent procedural code (I had been coding for over a
decade in BASIC and Pascal prior to C) can handle doing this.
        The AFF2 solution works, but it is not the best solution because
you will eventually have to have AFF3 and AFF4 and your if(AFF_FLAGGED())
statements will get REALLY ugly if you go that route.
        Having never looked at the bitfield solution (it was published
after I already at the other method implemented.) I can't comment on its
ease and effectiveness.

        My advice to you is to try the bitfield or 128 bit solutions since
they are better solutions to the problem at hand. Backup your code before
trying, give it a good week's worth of work and if you fail, you know that
you have your backup available to restore. Once you restore, do the AFF2
method since you know that you can get it to work. So long as you make
backups of your ENTIRE MUD (not just the source) you won't have to worry
about messing up something. All you'll lose is time and if you learn
something while failing to accomplish a goal, then the time is not wasted.



[1] Waste of bandwidth story:
        I learned Linux because I wanted to learn how to code in C, but I
didn't want to give Microsoft money for their compiler. A guy I worked
with gave me a CD and a book about this thing called "Linux." I assumed
that it was a development environment for Windows that would let me code
in C (Man, was I wet behind the ears!) I got home and started reading only
to discover that this "Linux thing" was a replacement for DOS and Windows.
I backed up my DOS and Win 3.11 stuff (my machine couldn't hack Win95 at
the time.) and installed Linux. That was December of 1996.
        I found out that you could write your own mud the next month and
so I went in search for code. I found lots to choose from (nowhere near as
much as there is now) and Circle came out on top because it compiled
cleaner than any other mud out there (only one error in olc.c about a
variable being used when uninitialized or something like that.) I compiled
my mud for first time and dove into making changes. That was February 8,
1997.... Lots has changed since then.
        The point of the story is that if you don't have to be a master of
Linux to code under it and you don't have to be a master of C to perform
difficult tasks in the language. Just THINK about everything that you are
trying to do and you will eventually make it work. Always use working
examples that are already in the code and things will be much easier. Of
course, being stubborn (like me) helps when attempting to debug code as
well.

--
Zeavon Calatin, MageMaster of the Realms
Spear of Insanity
http://spear.kilnar.com/    telnet://spear.kilnar.com:1066


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT