Re: [NEWBIEish][CODE][LONG] defining racial size

From: Lars (lars@temperedweaves.com)
Date: 03/22/02


>
>> I've implemented races in my code (working fine), but wanted
>> to implement racial sizes i.e. Gnomes are small, elves are
>> medium, etc etc.
>
Just out of curiousity... If all of your races are different sizes, and
none are the same size, could you arrange the race defines in order of
smallest to largest and use it for both race name and size?

ie:

#define RACE_ELF 0
#define RACE_GNOME 1
#define RACE_HUMAN 2
#define RACE_GIANT 3

#define SIZE_SMALLEST RACE_ELF
#define SIZE_SMALL RACE_GNOME
#define SIZE_BIG RACE_HUMAN
#define SIZE_BIGGEST RACE GIANT

const char *race_size(int racename) {
  "smallest",
  "small",
  "big",
  "biggest"
};

sprintf(buf, "You are the %s %s.\r\n", race_size(GET_RACE(ch)),
pc_race_types(GET_RACE(ch)));

if ch were an elf... buf would contain:

You are the smallest elf.

Unless you actually do some calculations or whatever that would benifit
from using SIZE_[size of race], you might not even need the size
defines... and it saves a miniscule amount of diskspace and memory for
one less field to remember for chars (and npc's?)... if you did do
calculations that say affected thaco or hitroll (larger sized chars are
easier to hit) you could do a simple formula to add it in...

GET_AC(ch) += (GET_RACE(ch) * 2)

...with the larger sized races being towards the bottom of the defines
(having larger values), it would up their ac depending on how much
larger the race is...

...just an idea...

Lars

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT