[code] Stock Code Bug [NT/win95 only?]

From: Sigurdur R. Helgason (sigurdur.helgason@isp.his.se)
Date: 12/13/96


Prob. like almost everything else this has been posted to the list.
But I haven't seen it before so if it has .. press the delete mail button.
At Iron Hills we were stumped that the mud crashed (GASP!) and always
when new PC's logged in.

The problem was/is:
the class variable in the char struct is defined as 'byte'.
In MSVC++ 'byte' is typedef:ed as 'unsigned char' (ranges from 0..255).
This cases problems.
When new players type wrong class letter (want to make an [C]leric but type
V instead) parse_class() is returns CLASS_UNDEFINED. CLASS_UNDEFINED is
defined to -1. But class is 'unsigned char' which becomes 255 ....
So when the check for CLASS_UNDEFINED is run:
if ( GET_CLASS(d->character) = parse_class(*arg) == CLASS_UNDEFINED )
                             ^                            ^
                         becomes 255                is defined as -1

Alas the class (and if wrongly type race) is accepted ...
And when the new PC enters the game.... crash bang bum ... you have an nice
little dialogue with Dr. Watson.

I solved it by setting CLASS_UNDEFINED (and RACE_UNDEFINED if you have races) 
to 127 (or why not 255?).
There is prob a much better solution to this.

I don't know about the unix side pf this (haven't had time to check on
'byte' def there).

yupp ... thats it I think ... uhmm .. yeah 

Sigurdur R. Helgason  - sigurdur.helgason@isp.his.se
University of Skovde  - Sweden
phone: +46-(0)500- 464600

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |

This archive was generated by hypermail 2b30 : 12/18/00 PST