cp_produce_callbacks.c File Reference

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"
Include dependency graph for cp_produce_callbacks.c:

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_tselectedProduction = NULL
static linkedList_tproductionItemList
static objDef_tselectedItem = NULL
static storedUFO_tselectedDisassembly = NULL
static aircraft_tselectedAircraft = NULL
static const int QUEUE_SPACERS = 2
 Number of blank lines between queued items and tech list.

Detailed Description

Menu related callback functions used for production.

Definition in file cp_produce_callbacks.c.


Function Documentation

static void PR_AircraftInfo ( const base_t base,
const aircraft_t aircraftTemplate,
float  percentDone 
) [static]

Prints information about the selected aircraft in production.

Parameters:
[in] aircraftTemplate The aircraft to print the information for
See also:
PR_ProductionInfo

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.

Parameters:
[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.
See also:
PR_ProductionInfo

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   ) 
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.

Parameters:
[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.
See also:
PR_ProductionInfo

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.

Todo:
add (confirmaton) popup in case storage cannot take all the items we add back to it

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]
static void PR_ProductionIncrease_f ( void   )  [static]

Increases the production amount by given parameter.

Todo:
-) need to popup something like: "You need the following items in order to produce more of ITEM: x of ITEM, x of ITEM, etc..." This info should also be displayed in the item-info. -) can can (if possible) change the 'amount' to a vlalue that _can_ be produced (i.e. the maximum amount possible).
Todo:
this popup hides any previous popup, like popup created in PR_QueueNew

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]
static void PR_ProductionList_f ( void   )  [static]
static void PR_ProductionListClick_f ( void   )  [static]

Click function for production list.

Note:
"num" is the entry in the visible production list (includes queued entries and spaces).
Todo:
left click on spacer should either delete current selection or do nothing, not update visible selection but show old info

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]
static void PR_ProductionStop_f ( void   )  [static]
static void PR_ProductionType_f ( void   )  [static]
static void PR_ProductionUp_f ( void   )  [static]
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]

Variable Documentation

int produceCategory = FILTER_S_PRIMARY [static]

Holds the current active production category/filter type.

See also:
itemFilterTypes_t

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().

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.


Generated by  doxygen 1.6.2