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

src/include/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,
  UnitActionMove, UnitActionAttack, UnitActionAttackGround, UnitActionDie,
  UnitActionSpellCast, UnitActionTrain, UnitActionUpgradeTo, UnitActionResearch,
  UnitActionBuilt, UnitActionBoard, UnitActionUnload, UnitActionPatrol,
  UnitActionBuild, UnitActionRepair, UnitActionResource, UnitActionTransformInto
}
typedef COrderCOrderPtr
unsigned SyncHash
int GetNumWaitingWorkers (const CUnit &mine)
 Hash calculated to find sync failures.
bool AutoAttack (CUnit &unit)
bool AutoRepair (CUnit &unit)
bool AutoCast (CUnit &unit)
void UnHideUnit (CUnit &unit)
int DoActionMove (CUnit &unit)
 Generic move action.
void AnimateActionAttack (CUnit &unit, COrder &order)
 Show attack animation.
void CclParseOrder (lua_State *l, CUnit &unit, COrderPtr *order)
 Parse order.
void UnitActions ()
 Handle the actions of all units each game cycle.

Typedef Documentation

typedef COrder* COrderPtr


Enumeration Type Documentation

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
UnitActionMove  unit follows units
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
UnitActionRepair  unit builds building
UnitActionResource  unit repairing
UnitActionTransformInto  unit harvesting resources

unit transform into type.


Function Documentation

void AnimateActionAttack ( CUnit unit,
COrder order 
)

Show attack animation.

Animate unit attack!

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

bool AutoAttack ( CUnit unit  ) 

Auto attack nearby units if possible

bool AutoCast ( CUnit unit  ) 

Auto cast a spell if possible

Returns:
true if a spell was auto cast, false otherwise

bool AutoRepair ( CUnit unit  ) 

Auto repair a unit if possible

Returns:
true if the unit is repairing, false otherwise

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

Parse order.

Parse order

Parameters:
l Lua state.
order OUT: resulting order.

int DoActionMove ( CUnit unit  ) 

Generic move action.

Unit moves! Generic function called from other actions.

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

int GetNumWaitingWorkers ( const CUnit mine  ) 

Hash calculated to find sync failures.

void UnHideUnit ( CUnit unit  ) 

void UnitActions (  ) 

Handle the actions of all units each game cycle.

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


Variable Documentation

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.