Phillip A. Ames wrote:
>
> Er... This is a kind of stupid question, but what _is_ a shint?
Short integer. I think they meant sh_int, the type CircleMUD defines.
Just forgot the underscore is all.
> Are any of these worth buying, or did I waste $5.00? :)
Is it possible to waste $5 on a group of things that would normally
cost hundreds more if purchased through traditional means?
> (GET_LEVEL(tch) >= LVL_IMMORT ? CCGRN(ch, C_SPR) : ""),
> (GET_LEVEL(tch) >= LVL_YELLOW ? CCYEL(ch, C_SPR) : ""),
> (GET_LEVEL(tch) >= LVL_MAGENTA ? CCMAG(ch, C_SPR) :""),
> (GET_LEVEL(tch) >= LVL_BLUE ? CCBLU(ch, C_SPR) : ""),
> (GET_LEVEL(tch) >= LVL_CYAN ? CCCYN(ch, C_SPR) : ""),
> (GET_LEVEL(tch) >= LVL_RED ? CCRED(ch, C_SPR) : ""),
> (GET_LEVEL(tch) > LVL_WHITE ? CCWHT(ch, C_SPR) : ""),
<cough> Ugly. :) No offense, of course, but in order for this to work
you'd have one ugly format. "%s%s%s%s%s%s%s[%2d %2s] %s %s%s" is just
hideous. So we want,
sprintf(buf, "%s[%2d %2s] %s %s%s",
(GET_LEVEL(tch) >= LVL_IMMORT ? CCGRN(ch, C_SPR)) :
(GET_LEVEL(tch) >= LVL_YELLOW ? CCYEL(ch, C_SPR)) :
(GET_LEVEL(tch) >= LVL_MAGENTA? CCMAG(ch, C_SPR)) :
(GET_LEVEL(tch) >= LVL_BLUE ? CCBLU(ch, C_SPR)) :
(GET_LEVEL(tch) >= LVL_CYAN ? CCCYN(ch, C_SPR)) :
(GET_LEVEL(tch) >= LVL_RED ? CCRED(ch, C_SPR)) :
(GET_LEVEL(tch) > LVL_WHITE ? CCWHT(ch, C_SPR)) : "",
You'll note that this is still quite verbose. If you have a
regular interval (i.e., 1-9 is white, 10-19 is red, 20-29 is cyan,
etc.) you can do it using a table,
/* LVL_IMMORT/10 because we want a new color for every 10 levels */
const int level_colors[(LVL_IMMORT / 10)+1] = {
CCWHT(ch, C_SPR), /* 1-9 */
CCRED(ch, C_SPR), /* 10-19 */
CCCYN(ch, C_SPR), /* 20-29 */
CCBLU(ch, C_SPR), /* 30-39 */
CCMAG(ch, C_SPR), /* 40-49 */
CCYEL(ch, C_SPR), /* 50-59 */
CCGRN(ch, C_SPR), /* 60-69 */
};
and instead of the "(GET_LEVEL(tch) >= ... ? ...) : ..." use,
level_colors[(GET_LEVEL(tch)/10)],
Or if they are sequential for the immortal levels, instead of
(LVL_IMMORT / 10) use (LVL_IMPL - LVL_IMMORT) and rather than
dividing by 10 for the index of level_colors[] subtract by
GET_LEVEL(tch).
-dak
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST