[CODE] Just a thought

From: Andrey Fidrya (andrey@alex-ua.com)
Date: 08/08/00


structs.h:
/*
* Eventually we want to be able to redefine the below to any arbitrary
* value.  This will allow us to use unsigned data types to get more
* room and also remove the '< 0' checks all over that implicitly
* assume these values. -gg 12/17/99
*/
#define NOWHERE    -1    /* nil reference for room-database */
#define NOTHING    -1    /* nil reference for objects       */
#define NOBODY     -1    /* nil reference for mobiles       */

I suggest redefining them to:

#define NOWHERE ((ush_int) -1) etc
This code is portable.

OR change all vnums to unsigned int-s and define NOWHERE as
(unsigned int) -1

Andrey

p.s. To George & Jeremy: About ascii pfiles.
I think using Sammy's pfiles for stock CircleMUD is a Very Bad idea.
A lot better is to use Windows Registry style files so field order doesn't
matter.
This type of pfile is perfectly readable by human and can be safely
modified in plain text editor.  I use registry-like pfile system in my MUD
and it works great! I'm ready to rewrite my code for CircleMUD if you
decide to replace binary pfiles with registry-like ascii ones.

Pfile sample (partially translated from Russian):
File: players/zmey:

[MAIN]

Name Zmey

Desc:
Some long desc
$

Level 35
Gold 117
Bank 15

Title Warlock of the Triple Robes
Flags.Player aefh
Flags.Preference bce
...

[EXTRA]

Num_aliases 2
Alias.1.String  somealias1
Alias.1.Replacement:
somereplacement1
$
Alias.2.String somealias2
Alias.2.Replacement:
somereplacement2
$
Poofin Zmey appears in a poof of smoke.
Poofout Zmey disappears.

[ACCESS]
Olc.Allow_build 1
Olc.Range 1000-2500, 2600-27000
Cmd disallow set, disallow where, allow ban

[MAIL]
Num_messages 1

Msg.1.Header someheader
Msg.1.Text
Hi, Zmey! Just testing the mail system.
Ignore this msg.
$

[RENT]
Num_objects 1
Obj.1.Name Some sword
Obj.1.somefield someval
.......

[SCRIPTS]
1017.Knights_quest 1
1017.Reward 1
1017.Stable.Vnum 2019
1017.Stable.Name Silver Dragon
1020.Visited 1



...in script:
  PfileSet(actor.name, "Knights_quest", 1)
  PfileGet(actor.name, "Knights_quest")

...in db.c:
  ch->level = PfileGetInt(pbuf, "MAIN", "Level")
  PfileSetInt(pbuf, "MAIN", "Level", ch->level)
etc.

Andrey


     +------------------------------------------------------------+
     | 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/11/01 PDT