____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

action_move.cpp File Reference

The move action. More...

#include <stdio.h>
#include <stdlib.h>
#include "stratagus.h"
#include "video.h"
#include "unittype.h"
#include "animation.h"
#include "player.h"
#include "unit.h"
#include "map.h"
#include "actions.h"
#include "pathfinder.h"
#include "sound.h"
#include "interface.h"
#include "ai.h"

Go to the source code of this file.

Functions

bool CanMove (const CUnit *unit)
 Generate a unit reference, a printable unique string for unit.
int DoActionMove (CUnit *unit)
 Handle command move.
void HandleActionMove (CUnit *unit)
 Handle command repair.


Detailed Description

The move action.

Definition in file action_move.cpp.


Function Documentation

bool CanMove ( const CUnit unit  ) 

Generate a unit reference, a printable unique string for unit.

Test if unit can move. For the moment only check for move animation.

Parameters:
unit unit to test if it can move.
Returns:
0 if unit cannot move.

Definition at line 68 of file action_move.cpp.

References CUnitType::Animations, Assert, CAnimations::Move, and CUnit::Type.

Referenced by AiMoveUnitInTheWay(), AiSendExplorers(), AutoAttack(), CommandFollow(), CommandMove(), CommandPatrolUnit(), DoActionMove(), CButtonPanel::DoClicked(), DoRightButton(), HandleActionAttack(), HandleActionMove(), HandleActionUnload(), HitUnit(), IsButtonAllowed(), MoveToTarget(), SendAttack(), SendResource(), ShowOrder(), and SpellMoveToTarget().

int DoActionMove ( CUnit unit  ) 

void HandleActionMove ( CUnit unit  ) 

Handle command repair.

Unit move action:

Move to a place or to a unit (can move). Tries 10x to reach the target, note this are the complete tries. If the target entered another unit, move to it's position. If the target unit is destroyed, continue to move to it's last position.

Parameters:
unit Pointer to unit.

Definition at line 190 of file action_move.cpp.

References Assert, CanMove(), CUnit::ClearAction(), DebugPrint, CUnit::Destroyed, DoActionMove(), CMap::Info, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, NewResetPath, NoUnitP, CUnit::Orders, PF_REACHED, PF_UNREACHABLE, CUnit::RefsDecrease(), CUnit::State, CUnit::SubAction, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::Wait, CUnit::X, and CUnit::Y.


Generated on Sat Feb 21 00:28:15 2009 for Bos Wars by  doxygen 1.5.6