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

       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"

build.cpp File Reference

The units. More...

#include "stratagus.h"
#include "unit.h"
#include "unittype.h"
#include "unit_cache.h"
#include "map.h"
#include "player.h"

Go to the source code of this file.

Functions

CBuildRestrictionOnTopOnTopDetails (const CUnit *unit, const CUnitType *parent)
CUnitCanBuildHere (const CUnit *unit, const CUnitType *type, int x, int y)
bool CanBuildOn (int x, int y, int mask)
 FIXME: more docu.
CUnitCanBuildUnitType (const CUnit *unit, const CUnitType *type, int x, int y, int real)
 Holds resources.


Detailed Description

The units.

Definition in file build.cpp.


Function Documentation

CUnit* CanBuildHere ( const CUnit unit,
const CUnitType type,
int  x,
int  y 
)

Can build unit here.

Parameters:
unit Unit doing the building
type unit-type to be checked.
x Map X position.
y Map Y position.
Returns:
OnTop, parent unit, builder on true or 1 if unit==NULL, NULL false.

Definition at line 239 of file build.cpp.

References CUnitType::BuildingRules, CMap::Field(), CMapField::Flags, CMap::Info, Map, MapFieldCoastAllowed, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitType::ShoreBuilding, CUnitType::TileHeight, and CUnitType::TileWidth.

Referenced by CanBuildUnitType(), and DrawBuildingCursor().

bool CanBuildOn ( int  x,
int  y,
int  mask 
)

FIXME: more docu.

Can build on this point.

Parameters:
x X tile map position.
y Y tile map position.
mask terrain mask
Returns:
if we can build on this point.

Definition at line 301 of file build.cpp.

References CMap::Field(), CMapField::Flags, CMap::Info, Map, CMapInfo::MapHeight, and CMapInfo::MapWidth.

Referenced by CanBuildUnitType(), and DrawBuildingCursor().

CUnit* CanBuildUnitType ( const CUnit unit,
const CUnitType type,
int  x,
int  y,
int  real 
)

Holds resources.

Can build unit-type at this point.

Parameters:
unit Worker that want to build the building or NULL.
type Building unit-type.
x X tile map position.
y Y tile map position.
real Really build, or just placement
Returns:
OnTop, parent unit, builder on true, NULL false.

Definition at line 320 of file build.cpp.

References CanBuildHere(), CanBuildOn(), CMap::IsFieldExplored(), Map, MapFogFilterFlags(), MarkUnitFieldFlags(), CUnitType::MovementMask, CUnit::Player, PlayerPerson, CUnitType::TileHeight, CUnitType::TileWidth, CPlayer::Type, and UnmarkUnitFieldFlags().

Referenced by AiFindBuildingPlace2(), CclCreateUnit(), CheckCanBuild(), EditorCallbackButtonDown(), EditorCallbackMouse(), and UIHandleButtonDown().

CBuildRestrictionOnTop* OnTopDetails ( const CUnit unit,
const CUnitType parent 
)

Find the building restriction that gives me this unit built on top Allows you to define how the restriction is effecting the build

Parameters:
unit the unit that is "OnTop"
parent the parent unit if known. (guess otherwise)
Returns:
the BuildingRestrictionDetails

Definition at line 55 of file build.cpp.

References CBuildRestrictionAnd::_or_list, CUnitType::BuildingRules, CBuildRestrictionOnTop::Parent, and CUnit::Type.

Referenced by EditorActionPlaceUnit(), StartBuilding(), and UnitLost().


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