Menu related callback functions used for production. More...
#include "../cl_shared.h"
#include "../cl_inventory.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "cp_campaign.h"
#include "cp_market.h"
#include "cp_ufo.h"
#include "cp_produce.h"
#include "cp_produce_callbacks.h"
Go to the source code of this file.
Functions | |
static void | PR_ClearSelected (void) |
Resets all "selected" pointers to NULL. | |
static void | PR_UpdateProductionList (const base_t *base) |
update the list of queued and available items | |
static void | PR_ItemProductionInfo (const base_t *base, const objDef_t *od, const float percentDone) |
Prints information about the selected item (no aircraft) in production. | |
static void | PR_DisassemblyInfo (const base_t *base, const storedUFO_t *ufo, float percentDone) |
Prints information about the selected disassembly task. | |
static void | PR_AircraftInfo (const base_t *base, const aircraft_t *aircraftTemplate, float percentDone) |
Prints information about the selected aircraft in production. | |
static void | PR_ProductionInfo (const base_t *base) |
Prints information about the selected item in production. | |
static void | PR_ProductionListRightClick_f (void) |
Click function for production list. | |
static void | PR_ProductionListClick_f (void) |
Click function for production list. | |
static void | PR_ProductionType_f (void) |
Will select a new tab on the production list. | |
static void | PR_ProductionList_f (void) |
Will fill the list of producible items. | |
static void | PR_ProductionIncrease_f (void) |
Increases the production amount by given parameter. | |
static void | PR_ProductionStop_f (void) |
Stops the current running production. | |
static void | PR_ProductionDecrease_f (void) |
Decrease the production amount by given parameter. | |
static void | PR_ProductionChange_f (void) |
Change the production amount by given diff. | |
static void | PR_ProductionUp_f (void) |
shift the current production up the list | |
static void | PR_ProductionDown_f (void) |
shift the current production down the list | |
void | PR_InitCallbacks (void) |
void | PR_ShutdownCallbacks (void) |
Variables | |
static int | produceCategory = FILTER_S_PRIMARY |
static production_t * | selectedProduction = NULL |
static linkedList_t * | productionItemList |
static objDef_t * | selectedItem = NULL |
static storedUFO_t * | selectedDisassembly = NULL |
static aircraft_t * | selectedAircraft = NULL |
static const int | QUEUE_SPACERS = 2 |
Number of blank lines between queued items and tech list. |
Menu related callback functions used for production.
Definition in file cp_produce_callbacks.c.
static void PR_AircraftInfo | ( | const base_t * | base, | |
const aircraft_t * | aircraftTemplate, | |||
float | percentDone | |||
) | [static] |
Prints information about the selected aircraft in production.
[in] | aircraftTemplate | The aircraft to print the information for |
Definition at line 276 of file cp_produce_callbacks.c.
References _, Com_sprintf(), Cvar_Set(), f, aircraft_s::id, aircraft_s::name, PR_CalculateProductionPercentDone(), aircraft_s::price, PRODUCE_DIVISOR, PRODUCE_FACTOR, Q_strcat(), aircraft_s::tech, TEXT_PRODUCTION_INFO, UI_RegisterText(), and va().
Referenced by PR_ProductionInfo().
static void PR_ClearSelected | ( | void | ) | [static] |
Resets all "selected" pointers to NULL.
Definition at line 59 of file cp_produce_callbacks.c.
Referenced by PR_ProductionIncrease_f(), PR_ProductionList_f(), PR_ProductionListClick_f(), and PR_ProductionListRightClick_f().
static void PR_DisassemblyInfo | ( | const base_t * | base, | |
const storedUFO_t * | ufo, | |||
float | percentDone | |||
) | [static] |
Prints information about the selected disassembly task.
[in] | base | Pointer to the base where informations should be printed. |
[in] | ufo | The UFO being disassembled. |
[in] | percentDone | How far this process has gotten yet. |
Definition at line 236 of file cp_produce_callbacks.c.
References _, Com_sprintf(), storedUFO_s::comp, COMP_ITEMCOUNT_SCALED, storedUFO_s::condition, Cvar_Set(), f, i, storedUFO_s::id, storedUFO_s::installation, components_s::itemAmount, components_s::itemAmount2, components_s::items, objDef_s::name, installation_s::name, components_s::numItemtypes, PR_CalculateProductionPercentDone(), Q_strcat(), aircraft_s::tech, TEXT_PRODUCTION_INFO, UFO_TypeToName(), storedUFO_s::ufoTemplate, aircraft_s::ufotype, UI_RegisterText(), and va().
Referenced by PR_ProductionInfo().
void PR_InitCallbacks | ( | void | ) |
Definition at line 832 of file cp_produce_callbacks.c.
References Cmd_AddCommand(), PR_ProductionChange_f(), PR_ProductionDecrease_f(), PR_ProductionDown_f(), PR_ProductionIncrease_f(), PR_ProductionList_f(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionStop_f(), PR_ProductionType_f(), and PR_ProductionUp_f().
Referenced by CP_AddCampaignCallbackCommands().
static void PR_ItemProductionInfo | ( | const base_t * | base, | |
const objDef_t * | od, | |||
const float | percentDone | |||
) | [static] |
Prints information about the selected item (no aircraft) in production.
[in] | base | Pointer to the base where informations should be printed. |
[in] | od | The attributes of the item being produced. |
[in] | percentDone | How far this process has gotten yet. |
Definition at line 202 of file cp_produce_callbacks.c.
References _, Com_sprintf(), Cvar_Set(), f, objDef_s::id, objDef_s::name, PR_CalculateProductionPercentDone(), PR_ItemIsProduceable(), objDef_s::price, PRODUCE_DIVISOR, PRODUCE_FACTOR, Q_strcat(), RS_GetTechForItem(), objDef_s::size, TEXT_PRODUCTION_INFO, UI_RegisterText(), and va().
Referenced by PR_ProductionInfo().
static void PR_ProductionChange_f | ( | void | ) | [static] |
Change the production amount by given diff.
Definition at line 766 of file cp_produce_callbacks.c.
References Cbuf_AddText(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), and va().
Referenced by PR_InitCallbacks().
static void PR_ProductionDecrease_f | ( | void | ) | [static] |
Decrease the production amount by given parameter.
Definition at line 737 of file cp_produce_callbacks.c.
References production_s::amount, B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), PR_DecreaseProduction(), PR_ProductionInfo(), PR_ProductionStop_f(), and PR_UpdateProductionList().
Referenced by PR_InitCallbacks().
static void PR_ProductionDown_f | ( | void | ) | [static] |
shift the current production down the list
Definition at line 812 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), ccs, production_s::idx, base_s::idx, production_queue_s::items, production_queue_s::numItems, PR_QueueMove(), PR_UpdateProductionList(), ccs_s::productions, and UI_ExecuteConfunc().
Referenced by PR_InitCallbacks().
static void PR_ProductionIncrease_f | ( | void | ) | [static] |
Increases the production amount by given parameter.
Definition at line 577 of file cp_produce_callbacks.c.
References _, AIR_CalculateHangarStorage(), production_s::aircraft, production_s::amount, B_GetCurrentSelectedBase(), ccs, Cmd_Argc(), Cmd_Argv(), Com_sprintf(), cp_messageBuffer, Cvar_SetValue(), production_s::idx, base_s::idx, production_s::item, production_queue_s::items, lengthof, MAX_PRODUCTION_AMOUNT, MSG_PRODUCTION, MSO_CheckAddNewMessage(), aircraft_s::name, objDef_s::name, name, NT_PRODUCTION_STARTED, production_queue_s::numItems, PR_ClearSelected(), PR_IncreaseProduction(), PR_ProductionInfo(), PR_QueueFreeSpace(), PR_QueueNew(), PR_RequirementsMet(), PR_UpdateProductionList(), ccs_s::productions, qfalse, technology_s::requireForProduction, RS_GetTechForItem(), aircraft_s::tech, production_s::ufo, storedUFO_s::ufoTemplate, UI_ExecuteConfunc(), UI_MAX_SMALLTEXTLEN, and UI_Popup().
Referenced by PR_InitCallbacks().
static void PR_ProductionInfo | ( | const base_t * | base | ) | [static] |
Prints information about the selected item in production.
[in] | base | Pointer to the base where informations should be printed. |
Definition at line 304 of file cp_produce_callbacks.c.
References _, production_s::aircraft, production_s::amount, Com_Error(), Cvar_Set(), Cvar_SetValue(), ERR_DROP, FILTER_AIRCRAFT, production_s::item, production_s::percentDone, PR_AircraftInfo(), PR_DisassemblyInfo(), PR_ItemProductionInfo(), produceCategory, TEXT_PRODUCTION_INFO, production_s::ufo, UI_ExecuteConfunc(), and UI_RegisterText().
Referenced by PR_ProductionDecrease_f(), PR_ProductionIncrease_f(), PR_ProductionListClick_f(), PR_ProductionStop_f(), and PR_ProductionType_f().
static void PR_ProductionList_f | ( | void | ) | [static] |
Will fill the list of producible items.
Definition at line 543 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), B_GetNumberOfBuildingsInBaseByBuildingType(), B_WORKSHOP, CAP_ITEMS, CAP_WORKSPACE, base_s::capacities, Com_sprintf(), cap_maxcur_s::cur, Cvar_Set(), Cvar_SetValue(), E_CountHired(), EMPL_WORKER, cap_maxcur_s::max, MAX_PRODUCTIONS_PER_WORKSHOP, MAX_VAR, PR_ClearSelected(), and PR_UpdateProductionCap().
Referenced by PR_InitCallbacks().
static void PR_ProductionListClick_f | ( | void | ) | [static] |
Click function for production list.
Definition at line 423 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), ccs, Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, FILTER_AIRCRAFT, FILTER_DISASSEMBLY, base_s::idx, INV_ItemMatchesFilter(), production_queue_s::items, LIST_GetByIdx(), production_queue_s::numItems, PR_ClearSelected(), PR_ItemIsProduceable(), PR_ProductionInfo(), produceCategory, technology_s::produceTime, ccs_s::productions, QUEUE_SPACERS, RS_GetTechForItem(), RS_IsResearched_ptr(), and aircraft_s::tech.
Referenced by PR_InitCallbacks().
static void PR_ProductionListRightClick_f | ( | void | ) | [static] |
Click function for production list.
Definition at line 347 of file cp_produce_callbacks.c.
References production_s::aircraft, B_GetCurrentSelectedBase(), ccs, Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, FILTER_AIRCRAFT, FILTER_DISASSEMBLY, technology_s::id, base_s::idx, INV_ItemMatchesFilter(), production_s::item, production_queue_s::items, LIST_GetByIdx(), production_queue_s::numItems, PR_ClearSelected(), produceCategory, ccs_s::productions, QUEUE_SPACERS, RS_GetTechForItem(), RS_IsResearched_ptr(), aircraft_s::tech, production_s::ufo, storedUFO_s::ufoTemplate, and UP_OpenWith().
Referenced by PR_InitCallbacks().
static void PR_ProductionStop_f | ( | void | ) | [static] |
Stops the current running production.
Definition at line 708 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), ccs, base_s::idx, production_s::idx, production_queue_s::items, production_queue_s::numItems, PR_ProductionInfo(), PR_QueueDelete(), PR_UpdateProductionList(), ccs_s::productions, and UI_ExecuteConfunc().
Referenced by PR_InitCallbacks(), and PR_ProductionDecrease_f().
static void PR_ProductionType_f | ( | void | ) | [static] |
Will select a new tab on the production list.
Definition at line 491 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_Set(), FILTER_AIRCRAFT, FILTER_DISASSEMBLY, FILTER_S_PRIMARY, base_s::idx, INV_GetFilterType(), INV_GetFilterTypeID(), LIST_Count(), LIST_GetByIdx(), MAX_FILTERTYPES, production_queue_s::numItems, PR_ProductionInfo(), PR_UpdateProductionList(), produceCategory, ccs_s::productions, QUEUE_SPACERS, and UI_ExecuteConfunc().
Referenced by PR_InitCallbacks().
static void PR_ProductionUp_f | ( | void | ) | [static] |
shift the current production up the list
Definition at line 789 of file cp_produce_callbacks.c.
References B_GetCurrentSelectedBase(), ccs, base_s::idx, production_s::idx, production_queue_s::items, PR_QueueMove(), PR_UpdateProductionList(), ccs_s::productions, and UI_ExecuteConfunc().
Referenced by PR_InitCallbacks().
void PR_ShutdownCallbacks | ( | void | ) |
Definition at line 846 of file cp_produce_callbacks.c.
References Cmd_RemoveCommand().
Referenced by CP_RemoveCampaignCallbackCommands().
static void PR_UpdateProductionList | ( | const base_t * | base | ) | [static] |
update the list of queued and available items
[in] | base | Pointer to the base. |
UFOs at UFO stores
Definition at line 71 of file cp_produce_callbacks.c.
References _, AIR_AircraftGetFromIDX(), AIR_IsUFO, production_s::aircraft, ccs_s::aircraftTemplates, production_s::amount, ccs, Com_DPrintf(), Com_Printf(), storedUFO_s::condition, csi, DEBUG_CLIENT, storedUFO_s::disassembly, FILTER_AIRCRAFT, FILTER_DISASSEMBLY, aircraft_s::homebase, i, technology_s::id, aircraft_s::id, objDef_s::idx, base_s::idx, storedUFO_s::installation, INV_ItemMatchesFilter(), objDef_s::isVirtual, production_s::item, production_queue_s::items, LIST_AddPointer(), LIST_AddString(), LIST_Delete(), aircraft_s::name, objDef_s::name, ccs_s::numAircraft, ccs_s::numAircraftTemplates, equipDef_s::numItems, production_queue_s::numItems, csi_s::numODs, csi_s::ods, PR_ItemIsProduceable(), produceCategory, technology_s::produceTime, ccs_s::productions, QUEUE_SPACERS, RS_GetTechForItem(), RS_IsResearched_ptr(), storedUFO_s::status, base_s::storage, SUFO_STORED, aircraft_s::tech, TEXT_PRODUCTION_AMOUNT, TEXT_PRODUCTION_LIST, TEXT_PRODUCTION_QUEUED, aircraft_s::tpl, production_s::ufo, UFO_TypeToName(), storedUFO_s::ufoTemplate, aircraft_s::ufotype, UI_RegisterLinkedListText(), US_GetNext(), US_UFOsInStorage(), and va().
Referenced by PR_ProductionDecrease_f(), PR_ProductionDown_f(), PR_ProductionIncrease_f(), PR_ProductionStop_f(), PR_ProductionType_f(), and PR_ProductionUp_f().
int produceCategory = FILTER_S_PRIMARY [static] |
Holds the current active production category/filter type.
Definition at line 40 of file cp_produce_callbacks.c.
Referenced by PR_ProductionInfo(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionType_f(), and PR_UpdateProductionList().
linkedList_t* productionItemList [static] |
A list if all producable items.
Definition at line 46 of file cp_produce_callbacks.c.
const int QUEUE_SPACERS = 2 [static] |
Number of blank lines between queued items and tech list.
Definition at line 54 of file cp_produce_callbacks.c.
Referenced by PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionType_f(), and PR_UpdateProductionList().
aircraft_t* selectedAircraft = NULL [static] |
Definition at line 51 of file cp_produce_callbacks.c.
storedUFO_t* selectedDisassembly = NULL [static] |
Definition at line 50 of file cp_produce_callbacks.c.
objDef_t* selectedItem = NULL [static] |
Currently selected entry in the productionItemList (depends on content)
Definition at line 49 of file cp_produce_callbacks.c.
production_t* selectedProduction = NULL [static] |
Holds the current active selected queue entry.
Definition at line 43 of file cp_produce_callbacks.c.