public: void fromCharacterLevel(uint32 level) { if (level < 21) _Value = sl_a; // 0..20 else if (level < 51) _Value = sl_b; // 21..50 else if (level < 101) _Value = sl_c; // 51..100 else if (level < 151) _Value = sl_d; // 101..150 else if (level < 201) _Value = sl_e; // 151..200 else _Value = sl_f; // 201..oo } void fromSkillName(const std::string &skillName) { // we considere the lenght of the skill name to be proportional to the level if (skillName.size() < 2) { // skill name too short _Value = invalid_val; } uint32 size = skillName.size()-1; if (size < end_of_enum) _Value = TValues(size); else // max the level _Value = sl_f; } // return a value corresponding to the top of the game level range for the given value uint32 asLevel() { switch (_Value) { case sl_a: return 20; case sl_b: return 50; case sl_c: return 100; case sl_d: return 150; case sl_e: return 200; case sl_f: return 250; default: BOMB("Invalid value being converted to level - returning 1",return 1); } }