Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / ai_service / dyn_grp.h
blob8276e25bf761ca34a8cb3487c3c77242cf587b98
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef DYN_GRP_H
20 #define DYN_GRP_H
22 #include "continent.h"
24 //////////////////////////////////////////////////////////////////////////////
25 // CDynGrpBase //
26 //////////////////////////////////////////////////////////////////////////////
28 class CDynGrpBase
30 public:
31 CDynGrpBase();
32 virtual ~CDynGrpBase();
34 void initDynGrp(IGroupDesc const* const gd, CFamilyBehavior const* const familyBehavior);
36 void setDiscardable(bool discardable) const;
37 bool getDiscardable() const;
39 NLMISC::CSmartPtr<IGroupDesc const> const& getGroupDesc() const;
41 NLMISC::CDbgPtr<CFamilyBehavior> const& getFamilyBehavior() const;
43 float getEnergyCoef() const;
45 bool getCountMultiplierFlag() const;
47 protected:
48 /** Flag for group discardability.
49 * If this flag is set, then the group can be despawn when
50 * the family spawned energy is to high.
51 * When cleared, the group cannot be despawned automaticaly
52 * either for enegy reason nor for unadequate energy level.
54 mutable bool _Discardable;
55 /// The dynamic group model
56 NLMISC::CSmartPtr<IGroupDesc const> _GroupDesc;
58 /// The family this group belong to
59 NLMISC::CDbgPtr<CFamilyBehavior> _FamilyBehavior;
62 //////////////////////////////////////////////////////////////////////////////
63 // CDynBot //
64 //////////////////////////////////////////////////////////////////////////////
66 class CDynBot
68 public:
69 CDynBot() : _BotEnergyValue(0)
71 virtual ~CDynBot()
73 /// The energy value of this bot.
75 const uint32 &botEnergyValue () const
77 return _BotEnergyValue;
80 void setBotEnergyValue (const uint32 &energyValue)
82 _BotEnergyValue=energyValue;
85 virtual void addEnergy() const = 0;
86 virtual void removeEnergy() const = 0;
88 private:
89 uint32 _BotEnergyValue;
92 class CDynSpawnBot
94 public:
95 CDynSpawnBot(const CDynBot &dynBot) : _DynBot(dynBot)
97 _DynBot.addEnergy();
100 virtual ~CDynSpawnBot()
102 _DynBot.removeEnergy();
105 private:
106 const CDynBot &_DynBot;
110 #endif