On Sun, 17 Jun 2001, Edward Felch wrote: > if (check_level(ch, i)) > continue; I could write a whole lot about this code. Most of it would be on matters of style, compactness, extensibility, etc. But I'll cut it to the quick and just tell you what I'm guessing the problem is. Don't you really want the above to be if (!check_level(ch, i)) continue; ? A few casual notes: use min_level[CLASS_ADVENTURER] for the minimum level instead of prereq[2]. Add a MAX_PREREQS #define, make the size of prereq[] array it, and do for (j = 0; j < MAX_PREREQS; j++) if (spell_info[i].prereq[j] > 0 && !check_level(ch, spell_info[i].prereq[j])) break; if (j < MAX_PREREQ) continue; instead of all of the if (spell_info[i].prereq[0] > 0) if (!check_level(ch, spell_info[i].prereq[0)) continue; checks over and over. And put the (computationally) simplest checks before these -- it's a good habit to have because sometimes when you're programming, it matters (it doesn't in this instance, but, still -- consistency is rarely a bad thing). -- Daniel A. Koepke (dak), dkoepke@circlemud.org Caveat emptor: I say what I mean and mean what I say. Listen well. Caveat venditor: Say what you mean, mean what you say. Say it well. -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/05/01 PST