I have canged the spell parser code for circle so that each spell has its own function. I did this to make increase the simplicity if implementing spell and to centralize each spells code rather than having the same spell be in several differnt switches/functions(like chill touch). Well, that worked well, but since I have been learning C++ I got a new idea. I would like to incoporate C++'s polymorphism into the spell parser. This would greatly speed up and simplify the spell code even more. Pros: * The magic funtions like mag_damage() would be hidden within the class. * The strings for the spell names and all spell info will be in the class so hopefully I can make it so that all changes for new spells will generally be in one area of code. * You would only need to make a call like spell_ptr[spellnum]->perform_spell(); and the class and polymorphism will take care of the rest. * You can make custom spells for spec procs or anywhere you would want to use one by simply making a spell object like Flame_breath AB(dam, duration, etc...); // where you can set the damage and duration etc AB->perform_spell(); // and cast it like this Cons: * Umm...well...hmmm Well thats all I could think of for now. I say again this is only and idea. I would appreciate any pros/cons/suggestions. I am learning C++ and dont have much coding time on my hands(the Army is sure to use up all my free time..frown), but if I ever succeed I will be glad to share my code. Well my brain hurts and its late so thats all for now. +------------------------------------------------------------+ | 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