Menu related console command callbacks. More...
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "cp_campaign.h"
#include "cp_base_callbacks.h"
#include "cp_base.h"
#include "cp_map.h"
#include "cp_popup.h"
#include "cp_ufo.h"
Go to the source code of this file.
Defines | |
#define | CREATE_NEW_BASE_ID -1 |
Used from menu scripts as parameter for mn_base_select. | |
Functions | |
static void | B_Destroy_AntimaterStorage_f (void) |
onDestroy Callback for Antimatter Storage | |
static void | B_BuildingAddToList (linkedList_t **buildingList, building_t *building) |
Handles the list of constructable buildings. | |
static void | B_SelectBase_f (void) |
Called when a base is opened or a new base is created on geoscape. For a new base the baseID is -1. | |
static void | B_NextBase_f (void) |
Cycles to the next base. | |
static void | B_PrevBase_f (void) |
Cycles to the previous base. | |
static void | B_SetBaseTitle_f (void) |
Sets the title of the base to a cvar to prepare the rename menu. | |
static void | B_BuildBase_f (void) |
Constructs a new base. | |
static void | B_ChangeBaseName_f (void) |
Creates console command to change the name of a base. Copies the value of the cvar mn_base_title over as the name of the current selected base. | |
static void | B_ResetBuildingCurrent_f (void) |
Resets the currently selected building. | |
static void | B_BaseInit_f (void) |
Initialises base. | |
static void | B_BuildingOnDestroy_f (void) |
On destroy function for several building type. | |
static void | B_BuildingInit (base_t *base) |
Update the building-list. | |
static void | B_BuildingInit_f (void) |
Script command binding for B_BuildingInit. | |
static void | B_BuildingInfoClick_f (void) |
Opens the UFOpedia for the current selected building. | |
static void | B_BuildingClick_f (void) |
Script function for clicking the building list text field. | |
static void | B_BuildingDestroy_f (void) |
We are doing the real destroy of a building here. | |
static void | B_BuildingStatus_f (void) |
Console callback for B_BuildingStatus. | |
static void | B_AssembleMap_f (void) |
Builds a base map for tactical combat. | |
static void | B_CheckBuildingStatusForMenu_f (void) |
Checks why a button in base menu is disabled, and create a popup to inform player. | |
static void | BaseSummary_Init (const base_t *base) |
Base Summary menu init function. | |
static void | BaseSummary_SelectBase_f (void) |
Open menu for basesummary. | |
static void | B_MakeBaseMapShot_f (void) |
Makes a mapshot - called by basemapshot script command. | |
void | B_InitCallbacks (void) |
void | B_ShutdownCallbacks (void) |
Variables | |
static cvar_t * | mn_base_title |
static cvar_t * | cl_start_buildings |
static building_t * | buildingConstructionList [MAX_BUILDINGS] |
static int | buildingNumber = 0 |
Menu related console command callbacks.
Definition in file cp_base_callbacks.c.
#define CREATE_NEW_BASE_ID -1 |
Used from menu scripts as parameter for mn_base_select.
Definition at line 37 of file cp_base_callbacks.c.
Referenced by B_SelectBase_f().
static void B_AssembleMap_f | ( | void | ) | [static] |
Builds a base map for tactical combat.
Definition at line 531 of file cp_base_callbacks.c.
References B_AssembleMap(), B_GetBaseByIDX(), B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), and DEBUG_CLIENT.
Referenced by B_InitCallbacks().
static void B_BaseInit_f | ( | void | ) | [static] |
Initialises base.
Definition at line 273 of file cp_base_callbacks.c.
References _, AC_ContainmentAllowed(), AIR_AircraftAllowed(), AIR_BaseHasAircraft(), base_s::aircraft, B_GetCurrentSelectedBase(), BS_BuySellAllowed(), ccs, CL_UpdateCredits(), ccs_s::credits, Cvar_SetValue(), E_HireAllowed(), HOS_HospitalAllowed(), LIST_Count(), ccs_s::numBases, PR_ProductionAllowed(), RS_ResearchAllowed(), UI_ExecuteConfunc(), and va().
Referenced by B_InitCallbacks().
static void B_BuildBase_f | ( | void | ) | [static] |
Constructs a new base.
Definition at line 195 of file cp_base_callbacks.c.
References _, AL_FillInContainment(), B_GetFirstUnfoundedBase(), B_ResetAllStatusAndCapacities(), B_SelectBase(), B_SetUpBase(), B_UpdateBaseCount(), campaign_s::basecost, stats_s::basesBuilt, ccs_s::campaignStats, ccs, CL_UpdateCredits(), Com_sprintf(), cp_messageBuffer, CP_PopupList(), ccs_s::credits, ccs_s::curCampaign, base_s::founded, MA_NEWBASE, MA_NONE, MAP_GetNation(), MAP_IsRadarOverlayActivated(), MAP_SetOverlay(), ccs_s::mapAction, MS_AddNewMessage(), MSG_CONSTRUCTION, nation_s::name, base_s::name, newBasePos, ccs_s::numBases, base_s::pos, PR_UpdateProductionCap(), Q_strncpyz(), qfalse, qtrue, and cvar_s::string.
Referenced by B_InitCallbacks().
static void B_BuildingAddToList | ( | linkedList_t ** | buildingList, | |
building_t * | building | |||
) | [static] |
Handles the list of constructable buildings.
[in] | buildingList | list of buildings to upate |
[in] | building | Add this building to the construction list |
Definition at line 83 of file cp_base_callbacks.c.
References _, count, LIST_AddPointer(), LIST_Count(), building_s::name, and building_s::tpl.
Referenced by B_BuildingInit().
static void B_BuildingClick_f | ( | void | ) | [static] |
Script function for clicking the building list text field.
Definition at line 463 of file cp_base_callbacks.c.
References B_DrawBuilding(), B_GetCurrentSelectedBase(), BA_NEWBUILDING, ccs_s::baseAction, base_s::buildingCurrent, buildingNumber, ccs, Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), and DEBUG_CLIENT.
Referenced by B_InitCallbacks().
static void B_BuildingDestroy_f | ( | void | ) | [static] |
We are doing the real destroy of a building here.
Definition at line 498 of file cp_base_callbacks.c.
References B_BuildingDestroy(), B_BuildingInit(), B_GetCurrentSelectedBase(), B_ResetBuildingCurrent(), and base_s::buildingCurrent.
Referenced by B_InitCallbacks().
static void B_BuildingInfoClick_f | ( | void | ) | [static] |
Opens the UFOpedia for the current selected building.
Definition at line 449 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), base_s::buildingCurrent, building_s::pedia, and UP_OpenWith().
Referenced by B_InitCallbacks().
static void B_BuildingInit | ( | base_t * | base | ) | [static] |
Update the building-list.
Definition at line 397 of file cp_base_callbacks.c.
References B_BuildingAddToList(), B_DrawBuilding(), B_GetNumberOfBuildingsInBaseByTemplate(), BASE_SIZE, base_s::buildingCurrent, buildingNumber, ccs_s::buildingTemplates, ccs, i, LIST_Count(), building_s::maxCount, ccs_s::numBuildingTemplates, RS_IsResearched_ptr(), building_s::tech, TEXT_BUILDINGS, UI_ExecuteConfunc(), UI_RegisterLinkedListText(), and building_s::visible.
Referenced by B_BuildingDestroy_f(), and B_BuildingInit_f().
static void B_BuildingInit_f | ( | void | ) | [static] |
Script command binding for B_BuildingInit.
Definition at line 436 of file cp_base_callbacks.c.
References B_BuildingInit(), and B_GetCurrentSelectedBase().
Referenced by B_InitCallbacks().
static void B_BuildingOnDestroy_f | ( | void | ) | [static] |
On destroy function for several building type.
Definition at line 338 of file cp_base_callbacks.c.
References AL_RemoveAliens(), AL_RESEARCH, B_ALIEN_CONTAINMENT, B_GetFoundedBaseByIDX(), B_HANGAR, B_LAB, B_QUARTERS, B_RemoveAircraftExceedingCapacity(), B_RemoveItemsExceedingCapacity(), B_SMALL_HANGAR, B_STORAGE, B_WORKSHOP, CAP_ALIENS, base_s::capacities, Cmd_Argc(), Cmd_Argv(), Com_Printf(), cap_maxcur_s::cur, E_DeleteEmployeesExceedingCapacity(), cap_maxcur_s::max, MAX_BASES, MAX_BUILDING_TYPE, PR_UpdateProductionCap(), and RS_RemoveScientistsExceedingCapacity().
Referenced by B_InitCallbacks().
static void B_BuildingStatus_f | ( | void | ) | [static] |
Console callback for B_BuildingStatus.
Definition at line 515 of file cp_base_callbacks.c.
References B_BuildingStatus(), B_GetCurrentSelectedBase(), and base_s::buildingCurrent.
Referenced by B_InitCallbacks().
static void B_ChangeBaseName_f | ( | void | ) | [static] |
Creates console command to change the name of a base. Copies the value of the cvar mn_base_title over as the name of the current selected base.
Definition at line 244 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), Cvar_GetString(), base_s::name, and Q_strncpyz().
Referenced by B_InitCallbacks().
static void B_CheckBuildingStatusForMenu_f | ( | void | ) | [static] |
Checks why a button in base menu is disabled, and create a popup to inform player.
Definition at line 549 of file cp_base_callbacks.c.
References _, B_CheckBuildingDependencesStatus(), B_CheckBuildingTypeStatus(), B_GetBuildingTemplate(), B_GetCurrentSelectedBase(), B_GetNextBuildingByType(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_HANGAR, B_LAB, B_STATUS_UNDER_CONSTRUCTION, B_WORKSHOP, BASE_UNDER_ATTACK, base_s::baseStatus, building_s::buildingStatus, building_s::buildingType, building_s::buildTime, ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Com_sprintf(), ccs_s::date, date_s::day, building_s::dependsBuilding, E_CountHired(), E_GetEmployeeString(), EMPL_SCIENTIST, EMPL_WORKER, building_s::name, ngettext, popupText, building_s::timeStart, and UI_Popup().
Referenced by B_InitCallbacks().
static void B_Destroy_AntimaterStorage_f | ( | void | ) | [static] |
onDestroy Callback for Antimatter Storage
note: third parameter not used but we must be sure we have probability parameter
Definition at line 47 of file cp_base_callbacks.c.
References _, B_Destroy(), B_GetFoundedBaseByIDX(), B_RemoveAntimatterExceedingCapacity(), BASE_WORKING, base_s::baseStatus, CAP_ANTIMATTER, base_s::capacities, Cmd_Argc(), Cmd_Argv(), Com_Printf(), cap_maxcur_s::cur, frand(), MS_AddNewMessage(), MSG_STANDARD, base_s::name, qfalse, UI_PopWindow(), and va().
Referenced by B_InitCallbacks().
void B_InitCallbacks | ( | void | ) |
Init/Shutdown functions
Definition at line 826 of file cp_base_callbacks.c.
References _, B_AssembleMap_f(), B_BaseInit_f(), B_BuildBase_f(), B_BuildingClick_f(), B_BuildingDestroy_f(), B_BuildingInfoClick_f(), B_BuildingInit_f(), B_BuildingOnDestroy_f(), B_BuildingStatus_f(), B_ChangeBaseName_f(), B_CheckBuildingStatusForMenu_f(), B_Destroy_AntimaterStorage_f(), B_MakeBaseMapShot_f(), B_NextBase_f(), B_PrevBase_f(), B_ResetBuildingCurrent_f(), B_SelectBase_f(), B_SetBaseTitle_f(), campaign_s::basecost, BaseSummary_SelectBase_f(), ccs, Cmd_AddCommand(), ccs_s::curCampaign, CVAR_ARCHIVE, Cvar_Get(), Cvar_Set(), Cvar_SetValue(), MAX_BASES, ccs_s::numBases, and va().
Referenced by CP_AddCampaignCallbackCommands().
static void B_MakeBaseMapShot_f | ( | void | ) | [static] |
Makes a mapshot - called by basemapshot script command.
Definition at line 806 of file cp_base_callbacks.c.
References Cmd_ExecuteString(), Com_Printf(), Com_ServerState(), Cvar_SetValue(), UI_PushWindow(), and va().
Referenced by B_InitCallbacks().
static void B_NextBase_f | ( | void | ) | [static] |
Cycles to the next base.
Definition at line 126 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), B_GetFoundedBaseByIDX(), B_SelectBase(), ccs, base_s::idx, and ccs_s::numBases.
Referenced by B_InitCallbacks().
static void B_PrevBase_f | ( | void | ) | [static] |
Cycles to the previous base.
Definition at line 145 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), B_GetFoundedBaseByIDX(), B_SelectBase(), ccs, base_s::idx, and ccs_s::numBases.
Referenced by B_InitCallbacks().
static void B_ResetBuildingCurrent_f | ( | void | ) | [static] |
Resets the currently selected building.
Is called e.g. when leaving the build-menu
Definition at line 260 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), and B_ResetBuildingCurrent().
Referenced by B_InitCallbacks().
static void B_SelectBase_f | ( | void | ) | [static] |
Called when a base is opened or a new base is created on geoscape. For a new base the baseID is -1.
Definition at line 98 of file cp_base_callbacks.c.
References B_GetFoundedBaseByIDX(), B_SelectBase(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), CREATE_NEW_BASE_ID, and MAX_BASES.
Referenced by B_InitCallbacks().
static void B_SetBaseTitle_f | ( | void | ) | [static] |
Sets the title of the base to a cvar to prepare the rename menu.
Definition at line 167 of file cp_base_callbacks.c.
References _, ccs_s::bases, ccs, Com_sprintf(), Cvar_Set(), i, lengthof, MAX_BASES, MAX_VAR, MS_AddNewMessage(), MSG_STANDARD, base_s::name, ccs_s::numBases, Q_strncpyz(), qfalse, and UI_PopWindow().
Referenced by B_InitCallbacks().
void B_ShutdownCallbacks | ( | void | ) |
Definition at line 856 of file cp_base_callbacks.c.
References Cmd_RemoveCommand(), and Cvar_Delete().
Referenced by CP_RemoveCampaignCallbackCommands().
static void BaseSummary_Init | ( | const base_t * | base | ) | [static] |
Base Summary menu init function.
BaseSummary Callbacks:
Definition at line 655 of file cp_base_callbacks.c.
References _, AIR_CountTypeInBase(), AIR_GetAircraftString(), production_s::aircraft, base_s::alienscont, production_s::amount, aliensCont_s::amountAlive, aliensCont_s::amountDead, B_GetBuildingStatus(), B_GetCapacityFromBuildingType(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_STATUS_UNDER_CONSTRUCTION, technology_s::base, building_s::buildingStatus, ccs_s::buildingTemplates, building_s::buildingType, building_s::buildTime, base_s::capacities, ccs, Com_Error(), cap_maxcur_s::cur, ccs_s::date, date_s::day, E_CountHired(), E_GetEmployeeString(), ERR_DROP, i, base_s::idx, production_s::item, production_queue_s::items, cap_maxcur_s::max, MAX_CAP, MAX_EMPL, MAX_HUMAN_AIRCRAFT_TYPE, technology_s::name, aircraft_s::name, objDef_s::name, name, building_s::name, ngettext, ccs_s::numAliensTD, ccs_s::numBuildingTemplates, production_queue_s::numItems, ccs_s::numTechnologies, technology_s::overallTime, production_s::percentDone, ccs_s::productions, Q_strcat(), RS_GetTechByIDX(), RS_IsResearched_ptr(), RS_PAUSED, RS_RUNNING, technology_s::scientists, technology_s::statusResearch, building_s::tech, TEXT_STANDARD, TEXT_STATS_BASESUMMARY, technology_s::time, building_s::timeStart, aircraft_s::tpl, production_s::ufo, UFO_TypeToName(), storedUFO_s::ufoTemplate, aircraft_s::ufotype, UI_RegisterText(), and va().
Referenced by BaseSummary_SelectBase_f().
static void BaseSummary_SelectBase_f | ( | void | ) | [static] |
Open menu for basesummary.
Definition at line 780 of file cp_base_callbacks.c.
References B_GetCurrentSelectedBase(), B_GetFoundedBaseByIDX(), BaseSummary_Init(), ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), i, base_s::idx, ccs_s::numBases, and UI_ExecuteConfunc().
Referenced by B_InitCallbacks().
building_t* buildingConstructionList[MAX_BUILDINGS] [static] |
Definition at line 41 of file cp_base_callbacks.c.
int buildingNumber = 0 [static] |
Definition at line 42 of file cp_base_callbacks.c.
Referenced by B_BuildingClick_f(), and B_BuildingInit().
cvar_t* cl_start_buildings [static] |
Definition at line 40 of file cp_base_callbacks.c.
cvar_t* mn_base_title [static] |
Definition at line 39 of file cp_base_callbacks.c.