_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
actions.h File Reference
#include "unitptr.h"
#include "vec2i.h"

Go to the source code of this file.

Classes

class  COrder
 

actions.h - The actions headerfile.

enum  UnitAction {
  UnitActionNone, UnitActionStill, UnitActionStandGround, UnitActionFollow,
  UnitActionDefend, UnitActionMove, UnitActionAttack, UnitActionAttackGround,
  UnitActionDie, UnitActionSpellCast, UnitActionTrain, UnitActionUpgradeTo,
  UnitActionResearch, UnitActionBuilt, UnitActionBoard, UnitActionUnload,
  UnitActionPatrol, UnitActionBuild, UnitActionExplore, UnitActionRepair,
  UnitActionResource, UnitActionTransformInto
}
 
typedef COrderCOrderPtr
 
unsigned SyncHash
 
int GetNumWaitingWorkers (const CUnit &mine)
 Hash calculated to find sync failures. More...
 
bool AutoAttack (CUnit &unit)
 
bool AutoRepair (CUnit &unit)
 
bool AutoCast (CUnit &unit)
 
void UnHideUnit (CUnit &unit)
 
int DoActionMove (CUnit &unit)
 Generic move action. More...
 
void AnimateActionAttack (CUnit &unit, COrder &order)
 Show attack animation. More...
 
void CclParseOrder (lua_State *l, CUnit &unit, COrderPtr *order)
 Parse order. More...
 
void UnitActions ()
 Handle the actions of all units each game cycle. More...
 

Typedef Documentation

◆ COrderPtr

typedef COrder* COrderPtr

Enumeration Type Documentation

◆ UnitAction

enum UnitAction

All possible unit actions.

Note
Always change the table ::HandleActionTable
See also
HandleActionTable
Enumerator
UnitActionNone 
UnitActionStill 

No valid action.

UnitActionStandGround 

unit stand still, does nothing

UnitActionFollow 

unit stands ground

UnitActionDefend 

unit follows units

UnitActionMove 

unit defends unit

UnitActionAttack 

unit moves to position/unit

UnitActionAttackGround 

unit attacks position/unit

UnitActionDie 

unit attacks ground

UnitActionSpellCast 

unit dies

UnitActionTrain 

unit casts spell

UnitActionUpgradeTo 

building is training

UnitActionResearch 

building is upgrading itself

UnitActionBuilt 

building is researching spell

UnitActionBoard 

building is under construction

UnitActionUnload 

unit entering transporter

UnitActionPatrol 

unit leaving transporter

UnitActionBuild 

unit paroling area

UnitActionExplore 

unit builds building

UnitActionRepair 

unit explores map

UnitActionResource 

unit repairing

UnitActionTransformInto 

unit harvesting resources

unit transform into type.

Function Documentation

◆ AnimateActionAttack()

void AnimateActionAttack ( CUnit unit,
COrder order 
)

Show attack animation.

Animate unit attack!

Parameters
unitUnit, for that the attack animation is played.
Todo:
manage correctly unit with no animation attack.

◆ AutoAttack()

bool AutoAttack ( CUnit unit)

Auto attack nearby units if possible

◆ AutoCast()

bool AutoCast ( CUnit unit)

Auto cast a spell if possible

Returns
true if a spell was auto cast, false otherwise

◆ AutoRepair()

bool AutoRepair ( CUnit unit)

Auto repair a unit if possible

Returns
true if the unit is repairing, false otherwise

◆ CclParseOrder()

void CclParseOrder ( lua_State *  l,
CUnit unit,
COrderPtr orderPtr 
)

Parse order.

Parse order

Parameters
lLua state.
orderOUT: resulting order.

◆ DoActionMove()

int DoActionMove ( CUnit unit)

Generic move action.

Unit moves! Generic function called from other actions.

Parameters
unitPointer to unit.
Returns
>0 remaining path length, 0 wait for path, -1 reached goal, -2 can't reach the goal.

◆ GetNumWaitingWorkers()

int GetNumWaitingWorkers ( const CUnit mine)

Hash calculated to find sync failures.

◆ UnHideUnit()

void UnHideUnit ( CUnit unit)

◆ UnitActions()

void UnitActions ( )

Handle the actions of all units each game cycle.

Update the actions of all units each game cycle/second.

Variable Documentation

◆ SyncHash

unsigned SyncHash
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.