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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
/****************************************************************
**
** Attal : Lords of Doom
**
** genericMapCreature.h
** Manages creatures on map
**
** Version : $Id: genericMapCreature.h,v 1.12 2004/12/04 13:34:47 audoux Exp $
**
** Author(s) : Pascal Audoux
**
** Date : 11/09/2002
**
** Licence :
** 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, 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 GENERICMAPCREATURE_H
#define GENERICMAPCREATURE_H
// generic include files
// include files for QT
#include <qptrvector.h>
// application specific include files
#include "libCommon/creature.h"
#include "libCommon/log.h"
class GenericCell;
/** ------------------------------
* GenericMapCreature
** ------------------------------ */
class GenericMapCreature
{
public:
/** Creature's behavior */
enum CreatureBehaviour
{
Obedient = 0,
Friendly,
Neutral,
Aggressive,
Hostile
};
/** Creature growth mode */
enum GrowthMode
{
Stable,
FixedPercentage,
VariablePercentage
};
/** Constructor */
GenericMapCreature();
virtual ~GenericMapCreature();
/** Save lord */
void save( QTextStream *, int indent = 0 );
/** \return Return the creature associated to this creature on map */
Creature * getCreature() {
return _creature;
}
/** Sets the creature associated to this creature on map */
void setCreature( int race, int level );
/** \return Returns the race of the creature associated */
int getRace();
/** \return Returns the level of the creature associated */
int getLevel();
void setBehaviour ( CreatureBehaviour behaviour ) {
_behaviour = behaviour;
}
CreatureBehaviour getBehaviour () {
return _behaviour;
}
QString getBehaviourString();
static QString getBehaviourString( CreatureBehaviour behaviour );
static QString getGrowthString( GrowthMode growth );
bool isFleeing() {
return _flee;
}
void setFleeing( bool state ) {
_flee = state;
}
bool isEstimated() { return _estimated; }
//unsigned int getMinEstimatedNumber();
//unsigned int getMaxEstimatedNumber();
/** \return Returns the category of size of this unit */
unsigned int getCategoryNumber();
unsigned int getCreatureNumber();
void setCategoryNumber( unsigned int nb ) {
_categoryNumber = nb;
}
/** Set the value of the 'numStack' stack of creatures */
void setStack( uint numStack, uint value );
/** \return Returns the number of creature in the stack 'num' */
uint getStack( unsigned int num );
/** \return Returns the cell of the map where this creature is */
GenericCell * getCell() const {
return _cell;
}
/** Sets the cell where this creature is */
virtual void setCell( GenericCell * cell ) {
_cell = cell;
}
uint computeForceIndicator();
bool isLookingRight() { return _lookingRight; }
virtual void setLookingRight( bool state ) { _lookingRight = state; }
void setGrowthMode( GrowthMode growth ) { _growth = growth; }
GrowthMode getGrowthMode() { return _growth; }
void setGrowthParam( uint param, uint value );
uint getGrowthParam( uint param );
void grow();
protected:
QPtrVector<unsigned int> _stacks;
Creature * _creature;
GenericCell * _cell;
unsigned int _categoryNumber;
CreatureBehaviour _behaviour;
GrowthMode _growth;
uint _growthParam0, _growthParam1;
bool _flee;
bool _lookingRight;
bool _estimated;
};
#endif // GENERICMAPCREATURE_H
|