UFO: Alien Invasion
|
Base building related stuff. More...
#include "cp_building.h"
#include "../../cl_shared.h"
#include "../../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_time.h"
Go to the source code of this file.
Data Structures | |
struct | buildingTypeMapping_s |
Functions | |
bool | B_IsBuildingBuiltUp (const building_t *building) |
Returns if a building is fully buildt up. More... | |
float | B_GetConstructionTimeRemain (const building_t *building) |
Returns the time remaining time of a building construction. More... | |
buildingType_t | B_GetBuildingTypeByBuildingID (const char *buildingID) |
Returns the building type for a given building identified by its building id from the ufo script files. More... | |
void | B_ParseBuildings (const char *name, const char **text, bool link) |
Copies an entry from the building description file into the list of building types. More... | |
bool | B_BuildingScriptSanityCheck (void) |
Checks the parsed buildings for errors. More... | |
building_t * | B_GetBuildingTemplateSilent (const char *buildingName) |
Returns the building in the global building-types list that has the unique name buildingID. More... | |
building_t * | B_GetBuildingTemplate (const char *buildingName) |
Returns the building in the global building-types list that has the unique name buildingID. More... | |
const building_t * | B_GetBuildingTemplateByType (buildingType_t type) |
Returns the building template in the global building-types list for a buildingType. More... | |
bool | B_CheckBuildingDependencesStatus (const building_t *building) |
Check that the dependences of a building is operationnal. More... | |
bool | B_FireEvent (const building_t *buildingTemplate, const base_t *base, buildingEvent_t eventType) |
Run eventhandler script for a building. More... | |
Variables | |
static const struct buildingTypeMapping_s | buildingTypeMapping [] |
static const value_t | valid_building_vars [] |
Holds the names of valid entries in the basemanagement.ufo file. More... | |
Base building related stuff.
Definition in file cp_building.cpp.
bool B_BuildingScriptSanityCheck | ( | void | ) |
Checks the parsed buildings for errors.
Definition at line 244 of file cp_building.cpp.
References ccs_s::buildingTemplates, ccs, cgi, i, building_s::id, building_s::image, building_s::name, ccs_s::numBuildingTemplates, building_s::pedia, and RS_GetTechByID().
bool B_CheckBuildingDependencesStatus | ( | const building_t * | building | ) |
Check that the dependences of a building is operationnal.
[in] | building | Pointer to the building to check |
Definition at line 326 of file cp_building.cpp.
References B_GetBuildingStatus(), building_s::base, building_s::buildingType, building_s::dependsBuilding, and building_s::tpl.
Referenced by B_CheckUpdateBuilding().
bool B_FireEvent | ( | const building_t * | buildingTemplate, |
const base_t * | base, | ||
buildingEvent_t | eventType | ||
) |
Run eventhandler script for a building.
[in] | buildingTemplate | Building type (template) to run event for |
[in] | base | The base to run it at |
[in] | eventType | Type of the event to run |
true
if an event was fired false
otherwise (the building may not have one) Definition at line 346 of file cp_building.cpp.
References B_ONCONSTRUCT, B_ONDESTROY, B_ONDISABLE, B_ONENABLE, building_s::buildingType, cgi, ERR_DROP, base_s::idx, building_s::onConstruct, building_s::onDestroy, building_s::onDisable, building_s::onEnable, and Q_strvalid.
Referenced by B_AddBuildingToBasePos(), B_BuildBuilding(), B_BuildingDestroy(), B_CheckBuildingConstruction(), B_ResetAllStatusAndCapacities(), B_UpdateAllBaseBuildingStatus(), and B_UpdateStatusBuilding().
building_t* B_GetBuildingTemplate | ( | const char * | buildingName | ) |
Returns the building in the global building-types list that has the unique name buildingID.
[in] | buildingName | The unique id of the building (building_t->id). |
Definition at line 294 of file cp_building.cpp.
References B_GetBuildingTemplateSilent(), and cgi.
Referenced by B_LoadXML(), B_ParseBuildings(), TEST_F(), and UP_BuildingDescription().
const building_t* B_GetBuildingTemplateByType | ( | buildingType_t | type | ) |
Returns the building template in the global building-types list for a buildingType.
[in] | type | Building type. |
Definition at line 311 of file cp_building.cpp.
References ccs_s::buildingTemplates, building_s::buildingType, ccs, i, and ccs_s::numBuildingTemplates.
Referenced by CAP_CheckOverflow(), and UP_AircraftDescription().
building_t* B_GetBuildingTemplateSilent | ( | const char * | buildingName | ) |
Returns the building in the global building-types list that has the unique name buildingID.
[in] | buildingName | The unique id of the building (building_t->id). |
Definition at line 276 of file cp_building.cpp.
References ccs_s::buildingTemplates, ccs, i, building_s::id, ccs_s::numBuildingTemplates, and Q_streq.
Referenced by AIR_CanIntercept(), AIR_GetHangarCapacityType(), B_BuildBuilding_f(), B_FillBuildingInfo_f(), and B_GetBuildingTemplate().
buildingType_t B_GetBuildingTypeByBuildingID | ( | const char * | buildingID | ) |
Returns the building type for a given building identified by its building id from the ufo script files.
[in] | buildingID | The script building id that should get converted into the enum value |
Definition at line 86 of file cp_building.cpp.
References buildingTypeMapping, MAX_BUILDING_TYPE, Q_streq, and v.
Referenced by B_ParseBuildings().
float B_GetConstructionTimeRemain | ( | const building_t * | building | ) |
Returns the time remaining time of a building construction.
[in] | building | Pointer to the building to check |
Definition at line 51 of file cp_building.cpp.
References building_s::buildTime, ccs, ccs_s::date, Date_Substract(), date_s::day, date_s::sec, SECONDS_PER_DAY, and building_s::timeStart.
Referenced by B_FillMap_f().
bool B_IsBuildingBuiltUp | ( | const building_t * | building | ) |
Returns if a building is fully buildt up.
[in] | building | Pointer to the building to check |
true
for buildings with {0, 0} timeStart Definition at line 36 of file cp_building.cpp.
References building_s::buildTime, Date_IsDue(), date_s::day, date_s::sec, and building_s::timeStart.
Referenced by B_AssembleMap(), B_BuildBuilding(), B_CheckBuildingConstruction(), B_FillMap_f(), and B_GetNeighbours().
void B_ParseBuildings | ( | const char * | name, |
const char ** | text, | ||
bool | link | ||
) |
Copies an entry from the building description file into the list of building types.
[in] | name | Unique script id of a building. This is parsed from "building xxx" -> id=xxx. |
[in] | text | the whole following text that is part of the "building" item definition in .ufo. |
[in] | link | Bool value that decides whether to link the tech pointer in or not |
Definition at line 135 of file cp_building.cpp.
References B_GetBuildingTemplate(), B_GetBuildingTypeByBuildingID(), building_s::base, BASE_SIZE, ccs_s::buildingTemplates, building_s::buildingType, ccs, cgi, cgame_import_s::Com_EParse(), Com_Parse(), cp_campaignPool, DEBUG_CLIENT, building_s::dependsBuilding, ERR_DROP, i, building_s::id, building_s::idx, MAX_BUILDING_TYPE, MAX_BUILDINGS, building_s::maxCount, ccs_s::numBuildingTemplates, OBJZERO, cgame_import_s::PoolStrDup(), Q_streq, RS_GetTechByProvided(), building_s::size, building_s::tech, and building_s::tpl.
Referenced by CP_ParseScriptFirst(), and CP_ParseScriptSecond().
|
static |
Referenced by B_GetBuildingTypeByBuildingID().
|
static |
Holds the names of valid entries in the basemanagement.ufo file.
The valid definition names for BUILDINGS (building_t) in the basemanagement.ufo file. to the appropriate values in the corresponding struct
Definition at line 100 of file cp_building.cpp.