On Sat, 27 Sep 1997, Rasdan wrote:
-+switch (GET_CLASS(ch)) {
-+ case CLASS_MAGIC_USER:
-+ thaco = MAX(0, (20 - ((int)GET_LEVEL(ch)/6);
-+ break;
-+ case CLASS_CLERIC:
-+ thaco = MAX(0, (20 - ((int)GET_LEVEL(ch)/4)));
-+ break;
-+ case CLASS_THIEF:
-+ thaco = MAX(0, (20 - ((int)GET_LEVEL(ch)/3)));
-+ break;
-+ case CLASS_WARRIOR:
-+ thaco = MAX(0, (20 - (GET_LEVEL(ch)/2));
-+ break;
-+ default:
-+ thaco = 20; /* Error so thaco is max */
-+ break;
-+ }
The only difference here is what you are dividing by, then? I
would suggest condensing that to use a table for that info.
int class_thac0[NUM_CLASSES] = {
6,
4,
3,
2
};
void figure_thac0(struct char_data *ch) {
return (MAX(0, (20-((int)GET_LEVEL(ch) / class_thac0[GET_CLASS(ch)]))));
}
Or something like that. Put the table at the top of class.c, and
now adding classes requires even less code...:)~
--
Daniel Koepke -:- dkoepke@california.com -:- [Shadowlord/Nether]
Think.
+------------------------------------------------------------+
| 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/08/00 PST