$treeview $search $mathjax
Stratagus  2.2.6
$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/action/action_still.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include "stratagus.h"
#include "missile.h"
#include "unittype.h"
#include "animation.h"
#include "actions.h"
#include "unit.h"
#include "tileset.h"
#include "map.h"
#include "pathfinder.h"
#include "spells.h"
#include "player.h"

action_still.cpp - The stand still action.

#define SUB_STILL_INIT   0
#define SUB_STILL_STANDBY   1
#define SUB_STILL_ATTACK   2
static void MapMarkTileGuard (const CPlayer &player, const unsigned int index)
static void MapUnmarkTileGuard (const CPlayer &player, const unsigned int index)
void MapMarkUnitGuard (CUnit &unit)
void MapUnmarkUnitGuard (CUnit &unit)
void UnHideUnit (CUnit &unit)
static bool MoveRandomly (CUnit &unit)
bool AutoCast (CUnit &unit)
static CUnitUnitToRepairInRange (CUnit &unit, int range)
bool AutoRepair (CUnit &unit)
static bool AutoAttack (CUnit &unit, bool stand_ground)
void AutoAttack (CUnit &unit, CUnitCache &targets, bool stand_ground)
void ActionStillGeneric (CUnit &unit, bool stand_ground)
 Generic still action.
void HandleActionStill (CUnit &unit)
 Handle command still.

Define Documentation

#define SUB_STILL_ATTACK   2

#define SUB_STILL_INIT   0

#define SUB_STILL_STANDBY   1


Function Documentation

void ActionStillGeneric ( CUnit unit,
bool  stand_ground 
)

Generic still action.

Unit stands still or stand ground.

Parameters:
unit Unit pointer for action.
stand_ground true if unit is standing ground.

void AutoAttack ( CUnit unit,
CUnitCache targets,
bool  stand_ground 
)

static bool AutoAttack ( CUnit unit,
bool  stand_ground 
) [static]

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 HandleActionStill ( CUnit unit  ) 

Handle command still.

Unit stands still!

Parameters:
unit Unit pointer for still action.

static void MapMarkTileGuard ( const CPlayer player,
const unsigned int  index 
) [static]

void MapMarkUnitGuard ( CUnit unit  ) 

static void MapUnmarkTileGuard ( const CPlayer player,
const unsigned int  index 
) [static]

void MapUnmarkUnitGuard ( CUnit unit  ) 

static bool MoveRandomly ( CUnit unit  )  [static]

Move in a random direction

Returns:
true if the unit moves, false otherwise

void UnHideUnit ( CUnit unit  ) 

static CUnit* UnitToRepairInRange ( CUnit unit,
int  range 
) [static]

Try to find a repairable unit around and return it.

Parameters:
unit unit which can repair.
range range to find a repairable unit.
Returns:
unit to repair if found, NoUnitP otherwise
Todo:
FIXME: find the best unit (most damaged, ...).

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