____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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 "unittype.h"
#include "player.h"
#include "unit.h"
#include "actions.h"
#include "map.h"
#include "interface.h"
#include "pathfinder.h"
Go to the source code of this file.
Defines | |
| #define | LandUnitMask |
| #define | NavalUnitMask |
Functions | |
| static int | FindUnloadPosition (int x, int y, int *resx, int *resy, int mask) |
| int | UnloadUnit (CUnit *unit) |
| static int | ClosestFreeCoast (int x, int y, int *resx, int *resy) |
| static int | ClosestFreeDropZone (CUnit *transporter, int x, int y, int *resx, int *resy) |
| static int | MoveToDropZone (CUnit *unit) |
| static void | LeaveTransporter (CUnit *unit) |
| void | HandleActionUnload (CUnit *unit) |
| Handle command resource. | |
Definition in file action_unload.cpp.
| #define LandUnitMask |
Value:
( \
MapFieldLandUnit | \
MapFieldBuilding | \
MapFieldCoastAllowed | \
MapFieldWaterAllowed | \
MapFieldUnpassable)
Definition at line 53 of file action_unload.cpp.
Referenced by ClosestFreeCoast(), and ClosestFreeDropZone().
| #define NavalUnitMask |
Value:
( \
MapFieldLandUnit | \
MapFieldBuilding | \
MapFieldCoastAllowed | \
MapFieldLandAllowed | \
MapFieldUnpassable)
Definition at line 60 of file action_unload.cpp.
Referenced by ClosestFreeDropZone().
| static int ClosestFreeCoast | ( | int | x, | |
| int | y, | |||
| int * | resx, | |||
| int * | resy | |||
| ) | [static] |
Find the closest piece of coast you can unload units on
| x | start location for the search | |
| y | start location for the search | |
| resx | coast x position | |
| resy | coast y position |
Definition at line 164 of file action_unload.cpp.
References CMap::CoastOnMap(), DebugPrint, FindUnloadPosition(), CMap::Info, LandUnitMask, Map, CMapInfo::MapHeight, CMapInfo::MapWidth, and UnitOnMapTile().
Referenced by ClosestFreeDropZone().
| static int ClosestFreeDropZone | ( | CUnit * | transporter, | |
| int | x, | |||
| int | y, | |||
| int * | resx, | |||
| int * | resy | |||
| ) | [static] |
Find the closest available drop zone for a transporter. Fail if transporter don't transport any unit..
| transporter | the transporter | |
| x | start location for the search | |
| y | start location for the search | |
| resx | coast x position | |
| resy | coast y position |
Definition at line 242 of file action_unload.cpp.
References ClosestFreeCoast(), FindUnloadPosition(), LandUnitMask, NavalUnitMask, CUnit::Type, CUnit::UnitInside, CUnitType::UnitType, UnitTypeFly, UnitTypeLand, and UnitTypeNaval.
Referenced by HandleActionUnload().
| static int FindUnloadPosition | ( | int | x, | |
| int | y, | |||
| int * | resx, | |||
| int * | resy, | |||
| int | mask | |||
| ) | [static] |
Find a free position close to x, y
| x | Original x search position | |
| y | Original y search position | |
| resx | Unload x position. | |
| resy | Unload y position. | |
| mask | Movement mask for the unit to be droped. |
Definition at line 83 of file action_unload.cpp.
References CheckedCanMoveToMask().
Referenced by ClosestFreeCoast(), ClosestFreeDropZone(), and UnloadUnit().
| void HandleActionUnload | ( | CUnit * | unit | ) |
Handle command resource.
The transporter unloads a unit.
| unit | Pointer to unit. |
Definition at line 375 of file action_unload.cpp.
References CanMove(), CUnit::ClearAction(), ClosestFreeDropZone(), HandleActionUnload(), LeaveTransporter(), MoveToDropZone(), NewResetPath, CUnit::Orders, PF_REACHED, CUnit::SubAction, UnitActionStill, and y.
Referenced by HandleActionUnload().
| static void LeaveTransporter | ( | CUnit * | unit | ) | [static] |
Make one or more unit leave the transporter.
| unit | Pointer to unit. |
Definition at line 311 of file action_unload.cpp.
References CUnit::BoardCount, CUnit::Boarded, CUnit::ClearAction(), DebugPrint, CUnit::Destroyed, CUnit::InsideCount, IsOnlySelected, CUnit::NextContained, NoUnitP, CUnit::Orders, CUnit::RefsDecrease(), SelectedUnitChanged(), CUnit::SubAction, UnitActionUnload, CUnit::UnitInside, UnloadUnit(), CUnit::X, and CUnit::Y.
Referenced by HandleActionUnload().
| static int MoveToDropZone | ( | CUnit * | unit | ) | [static] |
Move to dropzone.
| unit | Pointer to unit. |
Definition at line 291 of file action_unload.cpp.
References Assert, DoActionMove(), CUnit::Orders, PF_REACHED, PF_UNREACHABLE, and UnitActionUnload.
Referenced by HandleActionUnload().
| int UnloadUnit | ( | CUnit * | unit | ) |
Reappear unit on map.
| unit | Unit to drop out. |
Definition at line 140 of file action_unload.cpp.
References Assert, CUnit::Boarded, FindUnloadPosition(), CUnitType::MovementMask, CUnit::Place(), CUnit::Removed, CUnit::Type, CUnit::X, CUnit::Y, and y.
Referenced by LeaveTransporter().
1.5.6