/* ....[@@@..[@@@..............[@.................. MUD++ is a written from ....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and ....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++. ....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing ....[@......[@..[@@@@@..[@@@@@.................. development project. All ................................................ contributions are welcome. ....Copyright(C).1995.Melvin.Smith.............. Enjoy. ------------------------------------------------------------------------------ Melvin Smith (aka Fusion) msmith@hom.net MUD++ development mailing list mudpp@van.ml.org ------------------------------------------------------------------------------ skill.cc */ #include "config.h" #include "skill.h" #include "string.h" extern SkillType skill_table[]; SkillType * lookupSkill( const char * str ) { int i; while( isspace( *str ) ) str++; if( !*str ) return 0; for( i=1; skill_table[ i ].name; i++ ) { if( *skill_table[ i ].name != *str ) continue; if( !str_cmp( str, skill_table[ i ].name ) ) return &skill_table[ i ]; } return 0; } SkillType * lookupSkill( int index ) { return &skill_table[ index ]; } // This is a cool little idea I remember MercMUD using // May seem oversimple but it protects against bugs. void initSkillTable() { for( int i = 1; skill_table[i].name; i++ ) if( skill_table[i].index ) *skill_table[i].index = i; } int SK_NULL; int SK_KICK; int SK_SNEAK; // Hash this later SkillType skill_table[] = { {0, &SK_NULL, 0, 0, 0, 0, 0, 0 }, {"kick", &SK_KICK, 1, 0, 0, 0, 0, 0 }, {"sneak", &SK_SNEAK, 1, 0, 0, 0, 0, 0 }, {0, 0, 0, 0, 0, 0, 0, 0 } };