Unit Data Structure
by Dale M.A. Johnson
created 9/16/06
This is an overview of the intended structure for units.
The Structure and Its Members
The data for unit classes are stored in CUnits and accessed using the object handle unit[#].member. There can be up to 500 units at any given time. Each unit has the following information stored for it.
General
- string tName
- The name of the unit.
- BITMAP mBitmap
- The actual bitmap image of the unit.
- int iClass
- The unit's class.
- int iFaction
- Which faction this unit is a member of.
Status
- int iLocX
- The unit's location (in tiles) on the x axis.
- int iLocY
- The unit's location (in tiles) on the y axis.
- int iX
- The unit's location (in pixels) on the x axis.
- int iY
- The unit's location (in pixels) on the y axis.
- int iMoves
- How many movement points this unit has left.
- int iCondition
- What condition this unit is in. 0 = normal.
- int iConTurns
- How many more turns this unit's condition will last.
- int iInv[#]
- What item is in each of the unit's item slots.
- bool bEquip[#]
- Whether the item in each slot is equiped.
Stats
- int iLev
- This unit's current level.
- int iHP
- This unit's current hit points.
- int iMP
- This unit's current magic points.
- int iMaxHP
- Current max hit points.
- int iMaxMP
- Current max magic points.
- int iSTR
- Current strength.
- int iMAG
- Current magic.
- int iDEF
- Current defense.
- int iRES
- Current resistance.
- int iSKL
- Current skill.
- int iSPD
- Current speed.
- int iLUK
- Current luck.
- int iCON
- Current constitution.
- int iMOV
- Current movement points.
- int iNear
- The closest point (in tiles) this unit can attack when unarmed. 0 means they cannot attack unarmed.
- int iRange
- The range (in tiles) that this unit can attack, starting from the iNear point. 0 means they have a range of 1 tile, the iNear tile.
Growth Rates
- int iGHP
- Hit point growth.
- int iGMP
- Magic point growth.
- int iGSTR
- Strength growth.
- int iGMAG
- Magic growth.
- int iGDEF
- Defense growth.
- int iGRES
- Resistance growth.
- int iSKL
- Skill growth.
- int iSPD
- Speed growth.
- int iGLUK
- Luck growth.
- int iGCON
- Constitution growth.
- int iMOV
- Movement points growth.