1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
// Description:
// Skill settings.
//
// Copyright (C) 2001 Frank Becker
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
//
#ifndef _Skill_hpp_
#define _Skill_hpp_
#include <string>
#include <Singleton.hpp>
using std::string;
const string SKILL_ROOKIE = "ROOKIE";
const string SKILL_NORMAL = "NORMAL";
const string SKILL_EXPERT = "EXPERT";
const string SKILL_INSANE = "INSANE";
const string SKILL_ERROR = "*ERROR*";
class Skill
{
friend class Singleton<Skill>;
public:
enum SkillEnum
{
eUnknown = 0,
eRookie = 1,
eNormal = 2,
eExpert = 3,
eInsane = 4,
eLAST
};
inline static const string &getString( SkillEnum e)
{
switch( e)
{
case eRookie:
return SKILL_ROOKIE;
case eNormal:
return SKILL_NORMAL;
case eExpert:
return SKILL_EXPERT;
case eInsane:
return SKILL_INSANE;
case eUnknown:
case eLAST:
default:
break;
}
return SKILL_ERROR;
}
static inline int getFireProbability( void);
static inline int getMaxBullets( void);
static inline int getMaxAttacking( void);
void updateSkill( const Skill::SkillEnum &skill);
void updateSkill( void);
void incrementSkill( void);
private:
~Skill();
Skill( void);
Skill( const Skill&);
Skill &operator=(const Skill&);
SkillEnum convertStringToSkill( const string &skill);
int _fireProbability;
int _maxBullets;
int _maxAttacking;
};
typedef Singleton<Skill> SkillS;
int Skill::getFireProbability( void)
{
return SkillS::instance()->_fireProbability;
}
int Skill::getMaxBullets( void)
{
return SkillS::instance()->_maxBullets;
}
int Skill::getMaxAttacking( void)
{
return SkillS::instance()->_maxAttacking;
}
#endif
|