NS/releases/3.2.0/source/mod/AvHBuildable.cpp
puzl 1511d73d5f Mantis: 0001129
o If an advanced armory is lost and no other armories exist, the observatory and armslab are nolonger available until a new armory is built.

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@490 67975925-1194-0748-b3d5-c16f83f1a3a1
2006-05-18 18:32:05 +00:00

89 lines
1.7 KiB
C++

#include "mod/AvHBuildable.h"
#include "util/nowarnings.h"
#include "dlls/extdll.h"
#include "dlls/util.h"
#include "dlls/cbase.h"
#include "mod/AvHGamerules.h"
#include "mod/AvHTeam.h"
AvHBuildable::AvHBuildable(AvHTechID inTechID)
{
this->mTechID = inTechID;
this->mHasBeenBuilt = false;
this->mBuilder = -1;
}
int AvHBuildable::GetBuilder() const
{
return this->mBuilder;
}
bool AvHBuildable::GetHasBeenBuilt() const
{
return this->mHasBeenBuilt;
}
bool AvHBuildable::GetSupportsTechID(AvHTechID inTechID) const
{
return (inTechID == this->mTechID);
}
AvHTechID AvHBuildable::GetTechID() const
{
return this->mTechID;
}
void AvHBuildable::SetTechID(AvHTechID inTechID)
{
this->mTechID = inTechID;
}
void AvHBuildable::SetHasBeenKilled()
{
GetGameRules()->BuildableKilled(this);
}
void AvHBuildable::SetBuilder(int inEntIndex)
{
this->mBuilder = inEntIndex;
}
void AvHBuildable::SetConstructionComplete(bool inForce)
{
}
void AvHBuildable::SetHasBeenBuilt()
{
this->mHasBeenBuilt = true;
GetGameRules()->BuildableBuilt(this);
}
void AvHBuildable::SetResearching(bool inState)
{
}
void AvHBuildable::TriggerAddTech() const
{
AvHTeamNumber theTeamNumber = this->GetTeamNumber();
AvHTeam* theTeam = GetGameRules()->GetTeam(theTeamNumber);
if(theTeam)
{
theTeam->TriggerAddTech(this->mTechID);
}
}
void AvHBuildable::TriggerRemoveTech() const
{
AvHTeamNumber theTeamNumber = this->GetTeamNumber();
AvHTeam* theTeam = GetGameRules()->GetTeam(theTeamNumber);
if(theTeam)
{
theTeam->TriggerRemoveTech(this->mTechID);
if ( this->mTechID == TECH_ADVANCED_ARMORY )
theTeam->TriggerRemoveTech(TECH_ARMORY);
}
}