Expose unit variables PosBottom and PosRight
This commit is contained in:
parent
0b10ad59d8
commit
e6c0a18486
3 changed files with 12 additions and 2 deletions
src
|
@ -38,7 +38,7 @@
|
|||
class CAnimation_Wiggle : public CAnimation
|
||||
{
|
||||
public:
|
||||
CAnimation_Wiggle() : CAnimation(AnimationWiggle), isHeading(false) {}
|
||||
CAnimation_Wiggle() : CAnimation(AnimationWiggle), isHeading(false), speed(0), ifNotReached(NULL) {}
|
||||
|
||||
virtual void Action(CUnit &unit, int &move, int scale) const;
|
||||
virtual void Init(const char *s, lua_State *l);
|
||||
|
@ -47,6 +47,8 @@ private:
|
|||
std::string x;
|
||||
std::string y;
|
||||
bool isHeading;
|
||||
std::string speed;
|
||||
CAnimation *ifNotReached;
|
||||
};
|
||||
|
||||
//@}
|
||||
|
|
|
@ -202,6 +202,8 @@ enum {
|
|||
BASICDAMAGE_INDEX,
|
||||
POSX_INDEX,
|
||||
POSY_INDEX,
|
||||
POS_RIGHT_INDEX,
|
||||
POS_BOTTOM_INDEX,
|
||||
TARGETPOSX_INDEX,
|
||||
TARGETPOSY_INDEX,
|
||||
RADAR_INDEX,
|
||||
|
|
|
@ -120,6 +120,8 @@ static const char PIERCINGDAMAGE_KEY[] = "PiercingDamage";
|
|||
static const char BASICDAMAGE_KEY[] = "BasicDamage";
|
||||
static const char POSX_KEY[] = "PosX";
|
||||
static const char POSY_KEY[] = "PosY";
|
||||
static const char POS_RIGHT_KEY[] = "PosRight";
|
||||
static const char POS_BOTTOM_KEY[] = "PosBottom";
|
||||
static const char TARGETPOSX_KEY[] = "TargetPosX";
|
||||
static const char TARGETPOSY_KEY[] = "TargetPosY";
|
||||
static const char RADARRANGE_KEY[] = "RadarRange";
|
||||
|
@ -174,7 +176,7 @@ CUnitTypeVar::CVariableKeys::CVariableKeys()
|
|||
RESEARCH_KEY, TRAINING_KEY, UPGRADETO_KEY, GIVERESOURCE_KEY,
|
||||
CARRYRESOURCE_KEY, XP_KEY, KILL_KEY, SUPPLY_KEY, DEMAND_KEY, ARMOR_KEY,
|
||||
SIGHTRANGE_KEY, ATTACKRANGE_KEY, PIERCINGDAMAGE_KEY,
|
||||
BASICDAMAGE_KEY, POSX_KEY, POSY_KEY, TARGETPOSX_KEY, TARGETPOSY_KEY, RADARRANGE_KEY,
|
||||
BASICDAMAGE_KEY, POSX_KEY, POSY_KEY, POS_RIGHT_KEY, POS_BOTTOM_KEY, TARGETPOSX_KEY, TARGETPOSY_KEY, RADARRANGE_KEY,
|
||||
RADARJAMMERRANGE_KEY, AUTOREPAIRRANGE_KEY, BLOODLUST_KEY, HASTE_KEY,
|
||||
SLOW_KEY, INVISIBLE_KEY, UNHOLYARMOR_KEY, SLOT_KEY, SHIELD_KEY, POINTS_KEY,
|
||||
MAXHARVESTERS_KEY, POISON_KEY, SHIELDPERMEABILITY_KEY, SHIELDPIERCING_KEY, ISALIVE_KEY, PLAYER_KEY,
|
||||
|
@ -2234,6 +2236,10 @@ void UpdateUnitVariables(CUnit &unit)
|
|||
unit.Variable[POSX_INDEX].Max = Map.Info.MapWidth;
|
||||
unit.Variable[POSY_INDEX].Value = unit.tilePos.y;
|
||||
unit.Variable[POSY_INDEX].Max = Map.Info.MapHeight;
|
||||
unit.Variable[POS_RIGHT_INDEX].Value = unit.tilePos.x + unit.Type->TileWidth;
|
||||
unit.Variable[POS_RIGHT_INDEX].Max = Map.Info.MapWidth;
|
||||
unit.Variable[POS_BOTTOM_INDEX].Value = unit.tilePos.y + unit.Type->TileHeight;
|
||||
unit.Variable[POS_BOTTOM_INDEX].Max = Map.Info.MapHeight;
|
||||
|
||||
// Target Position
|
||||
const Vec2i goalPos = unit.CurrentOrder()->GetGoalPos();
|
||||
|
|
Loading…
Add table
Reference in a new issue