____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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"
#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. | |
Definition in file action_move.cpp.
| 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.
| unit | unit to test if it can 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 | ) |
Handle command move.
Unit moves! Generic function called from other actions.
| unit | Pointer to unit. |
Definition at line 84 of file action_move.cpp.
References AiCanNotMove(), CPlayer::AiEnabled, CUnit::Anim, CUnitType::Animations, Assert, CancelBuildingMode(), CanMove(), CUnitType::CanTransport, CMap::CoastOnMap(), CMapField::Cost, CUnit::_unit_anim_::CurrAnim, CUnit::Data, CUnit::Direction, CMap::Field(), CUnit::Frame, Heading2X, Heading2Y, CMap::IsFieldVisible(), CUnit::IX, CUnit::IY, CUnit::_order_data_::_order_move_::Length, Map, MarkUnitFieldFlags(), CUnit::_order_data_::Move, CAnimations::Move, CUnit::MoveToXY(), CUnit::Moving, NextDirection, NextPathElement(), NumSelected, PF_REACHED, PF_UNREACHABLE, PF_WAIT, CUnit::Player, PlayUnitSound(), ReplayRevealMap, CUnit::Selected, SelectionChanged(), CUnitType::StillFrame, ThisPlayer, TileSizeX, TileSizeY, CUnit::Type, CUnit::_unit_anim_::Unbreakable, UnitHeadingFromDeltaXY(), UnitShowAnimationScaled(), UnitUpdateHeading(), UnmarkUnitFieldFlags(), UnSelectUnit(), VoiceDocking, CUnit::Wait, CUnit::_unit_anim_::Wait, CMap::WaterOnMap(), CUnit::X, CUnit::Y, and y.
Referenced by HandleActionFollow(), HandleActionMove(), HandleActionPatrol(), MoveToDropZone(), MoveToLocation(), MoveToResource(), MoveToTarget(), MoveToTransporter(), and SpellMoveToTarget().
| 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.
| 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.
1.5.6