#include <src/Ext/Building/Body.h>
List of all members.
Member Typedef Documentation
Member Function Documentation
void BuildingExt::buildLines |
( |
BuildingClass * |
theBuilding, |
|
|
CellStruct |
selectedCell, |
|
|
HouseClass * |
buildingOwner |
|
) |
| [static] |
- Parameters:
-
theBuilding | the building which we're trying to link to existing buildings. |
selectedCell | the cell at which we're trying to build. |
buildingOwner | the owner of the building we're trying to link. |
- See also:
- isLinkable()
-
canLinkTo()
- Author:
- DCoder, Renegade
- Date:
- 26.12.09+
{
BuildingExt::ExtData* buildingExtData = BuildingExt::ExtMap.Find(theBuilding);
if(!buildingExtData->isLinkable()) {
return;
}
short maxLinkDistance = theBuilding->Type->GuardRange / 256;
for(int direction = 0; direction <= 7; direction += 2) {
CellStruct directionOffset = CellSpread::GetNeighbourOffset(direction);
int linkLength = 0;
CellStruct cellToCheck = selectedCell;
for(short distanceFromCenter = 1; distanceFromCenter <= maxLinkDistance; ++distanceFromCenter) {
cellToCheck += directionOffset;
if(!MapClass::Instance->CellExists(&cellToCheck)) {
break;
}
CellClass *cell = MapClass::Instance->GetCellAt(&cellToCheck);
if(BuildingClass *OtherEnd = cell->GetBuilding()) {
if(buildingExtData->canLinkTo(OtherEnd)) {
linkLength = distanceFromCenter - 1;
break;
}
break;
}
if(!cell->CanThisExistHere(theBuilding->Type->SpeedType, theBuilding->Type, buildingOwner)) {
break;
}
}
CellStruct cellToBuildOn = selectedCell;
for(int distanceFromCenter = 1; distanceFromCenter <= linkLength; ++distanceFromCenter) {
cellToBuildOn += directionOffset;
if(CellClass *cell = MapClass::Instance->GetCellAt(&cellToBuildOn)) {
if(BuildingClass *tempBuilding = specific_cast<BuildingClass *>(theBuilding->Type->CreateObject(buildingOwner))) {
CoordStruct coordBuffer;
CellClass::Cell2Coord(&cellToBuildOn, &coordBuffer);
++Unsorted::IKnowWhatImDoing;
bool Put = tempBuilding->Put(&coordBuffer, 0);
--Unsorted::IKnowWhatImDoing;
if(Put) {
tempBuilding->QueueMission(mission_Construction, false);
tempBuilding->UpdateOwner(buildingOwner);
tempBuilding->unknown_bool_6DD = 1;
} else {
GAME_DEALLOC(tempBuilding);
}
}
}
}
}
}
void BuildingExt::Cleanup |
( |
| ) |
[static] |
DWORD BuildingExt::FoundationLength |
( |
CellStruct * |
StartCell | ) |
[static] |
{
DWORD Len = 0;
bool End = false;
do {
++Len;
End = StartCell->X == 32767 && StartCell->Y == 32767;
++StartCell;
} while(!End);
return Len;
}
DWORD BuildingExt::GetFirewallFlags |
( |
BuildingClass * |
pThis | ) |
[static] |
{
CellClass *MyCell = MapClass::Instance->GetCellAt(&pThis->Location);
DWORD flags = 0;
for(int direction = 0; direction < 8; direction += 2) {
CellClass *Neighbour = MyCell->GetNeighbourCell(direction);
if(BuildingClass *B = Neighbour->GetBuilding()) {
BuildingTypeExt::ExtData* pTypeData = BuildingTypeExt::ExtMap.Find(B->Type);
if(pTypeData->Firewall_Is && B->Owner == pThis->Owner && !B->InLimbo && B->IsAlive) {
flags |= 1 << (direction >> 1);
}
}
}
return flags;
}
signed int BuildingExt::GetImageFrameIndex |
( |
BuildingClass * |
pThis | ) |
[static] |
void BuildingExt::KickOutHospitalArmory |
( |
BuildingClass * |
pThis | ) |
[static] |
{
if(pThis->Type->Hospital || pThis->Type->Armory) {
if(FootClass * Passenger = pThis->Passengers.RemoveFirstPassenger()) {
pThis->KickOutUnit(Passenger, &BuildingClass::DefaultCellCoords);
}
}
}
void BuildingExt::UpdateDisplayTo |
( |
BuildingClass * |
pThis | ) |
[static] |
{
if(pThis->Type->Radar) {
HouseClass *H = pThis->Owner;
H->RadarVisibleTo.Clear();
for(int i = 0; i < H->Buildings.Count; ++i) {
BuildingClass *currentB = H->Buildings.GetItem(i);
if(!currentB->InLimbo) {
if(BuildingTypeExt::ExtMap.Find(currentB->Type)->RevealRadar) {
H->RadarVisibleTo.data |= currentB->DisplayProductionTo.data;
}
}
}
MapClass::Instance->RedrawSidebar(2);
}
}
Member Data Documentation
The documentation for this class was generated from the following files: