95 cgi->LIST_AddString(&productionList,
va(
"%s",
_(od->
name)));
97 cgi->LIST_AddString(&productionQueued,
va(
"%i", prod->
amount));
101 cgi->LIST_AddString(&productionList,
va(
"%s",
_(aircraftTemplate->
name)));
103 cgi->LIST_AddString(&productionQueued,
va(
"%i", prod->
amount));
109 cgi->LIST_AddString(&productionQueued,
"1");
115 cgi->LIST_AddString(&productionList,
"");
116 cgi->LIST_AddString(&productionAmount,
"");
117 cgi->LIST_AddString(&productionQueued,
"");
133 if (ufo->disassembly)
137 cgi->LIST_AddString(&productionList,
va(
"%s (%.0f%%)",
UFO_TypeToName(ufo->ufoTemplate->getUfoType()), ufo->condition * 100));
138 cgi->LIST_AddString(&productionAmount,
va(
"%i",
US_UFOsInStorage(ufo->ufoTemplate, ufo->installation)));
139 cgi->LIST_AddString(&productionQueued,
"");
142 for (
i = 0;
i <
ccs.numAircraftTemplates;
i++) {
147 if (!aircraftTemplate->
tech) {
148 cgi->Com_Printf(
"PR_UpdateProductionList: no technology for craft %s!\n", aircraftTemplate->
id);
152 cgi->Com_DPrintf(
DEBUG_CLIENT,
"air: %s ufotype: %i tech: %s time: %i\n", aircraftTemplate->
id,
153 aircraftTemplate->
getUfoType(), aircraftTemplate->
tech->id, aircraftTemplate->
tech->produceTime);
157 cgi->LIST_AddString(&productionList,
va(
"%s",
_(aircraftTemplate->
name)));
159 cgi->LIST_AddString(&productionQueued,
"");
174 cgi->LIST_AddString(&productionList,
va(
"%s",
_(od->
name)));
176 cgi->LIST_AddString(&productionQueued,
"");
241 uiNode_t* node =
cgi->UI_AddOption(&req_root,
"items",
"_Items",
"item");
256 static char productionInfo[512];
263 Com_sprintf(productionInfo,
sizeof(productionInfo),
_(
"No item selected"));
264 cgi->Cvar_Set(
"mn_item",
"");
270 Q_strcat(productionInfo,
sizeof(productionInfo),
_(
"Production time\t%ih\n"), remainingHours);
271 Q_strcat(productionInfo,
sizeof(productionInfo),
_(
"Item size\t%i\n"), od->
size);
272 cgi->Cvar_Set(
"mn_item",
"%s", od->
id);
288 static char productionInfo[512];
295 Q_strcat(productionInfo,
sizeof(productionInfo),
_(
"Disassembly time: %ih\n"), remainingHours);
296 Q_strcat(productionInfo,
sizeof(productionInfo),
_(
"Components:\n"));
298 for (
int i = 0;
i < ufo->
comp->numItemtypes;
i++) {
306 Q_strcat(productionInfo,
sizeof(productionInfo),
" %s (%i)\n",
_(compOd->
name), amount);
309 cgi->Cvar_Set(
"mn_item",
"%s", ufo->
id);
310 cgi->Cmd_ExecuteString(
"show_requirements 0");
322 static char productionInfo[512];
324 Com_sprintf(productionInfo,
sizeof(productionInfo),
"%s\n",
_(aircraftTemplate->
name));
326 Q_strcat(productionInfo,
sizeof(productionInfo),
_(
"Production time\t%ih\n"), remainingHours);
328 cgi->Cvar_Set(
"mn_item",
"%s", aircraftTemplate->
id);
330 cgi->Cmd_ExecuteString(
"show_requirements %i", aircraftTemplate->
tech->requireForProduction.numLinks);
345 cgi->UI_ExecuteConfunc(
"prod_taskselected");
349 cgi->UI_ExecuteConfunc(
"amountsetter enable");
352 cgi->UI_ExecuteConfunc(
"amountsetter enable");
355 cgi->UI_ExecuteConfunc(
"amountsetter disable");
357 cgi->Com_Error(
ERR_DROP,
"PR_ProductionInfo: Selected production is not item nor aircraft nor ufo.\n");
362 cgi->UI_ExecuteConfunc(
"prod_nothingselected");
367 cgi->Cvar_Set(
"mn_item",
"");
369 cgi->UI_ExecuteConfunc(
"prod_availableselected");
404 if (
cgi->Cmd_Argc() < 2) {
405 cgi->Com_Printf(
"Usage: %s <arg>\n",
cgi->Cmd_Argv(0));
410 num = atoi(
cgi->Cmd_Argv(1));
413 if (num < queue->numItems && num >= 0) {
427 if (aircraftTemplate && aircraftTemplate->
tech)
449 cgi->Com_DPrintf(
DEBUG_CLIENT,
"PR_ProductionListRightClick_f: Click on spacer %i\n", num);
471 if (
cgi->Cmd_Argc() < 2) {
472 cgi->Com_Printf(
"Usage: %s <arg>\n",
cgi->Cmd_Argv(0));
477 num = atoi(
cgi->Cmd_Argv(1));
480 if (num < queue->numItems && num >= 0) {
496 if (!aircraftTemplate) {
497 cgi->Com_DPrintf(
DEBUG_CLIENT,
"PR_ProductionListClick_f: No item found at the list-position %i!\n", idx);
503 if (aircraftTemplate->
tech && aircraftTemplate->
tech->produceTime >= 0
531 if (
cgi->Cmd_Argc() < 2) {
532 cgi->Com_Printf(
"Usage: %s <category>\n",
cgi->Cmd_Argv(0));
536 cat =
cgi->INV_GetFilterTypeID(
cgi->Cmd_Argv(1));
594 cgi->Cvar_Set(
"mn_production_workers",
"%i/%i",
597 cgi->Cvar_Set(
"mn_production_storage",
"%i/%i",
612 int producibleAmount;
620 if (
cgi->Cmd_Argc() == 2)
621 amount = atoi(
cgi->Cmd_Argv(1));
633 CP_Popup(
_(
"Hangars not ready"),
_(
"You cannot queue aircraft.\nNo free space in hangars.\n"));
634 cgi->Cvar_SetValue(
"mn_production_amount", prod->
amount);
644 cgi->Cvar_SetValue(
"mn_production_amount", prod->
amount);
652 if (producibleAmount == 0) {
653 CP_Popup(
_(
"Not enough materials"),
_(
"You don't have the materials needed for producing more of this item.\n"));
654 cgi->Cvar_SetValue(
"mn_production_amount", prod->
amount);
656 }
else if (amount != producibleAmount) {
657 CP_Popup(
_(
"Not enough material!"),
_(
"You don't have enough material to produce all (%i) additional items. Only %i could be added."), amount, producibleAmount);
661 cgi->Cvar_SetValue(
"mn_production_amount", prod->
amount);
663 const char*
name =
nullptr;
669 if (producibleAmount == 0) {
670 CP_Popup(
_(
"Not enough materials"),
_(
"You don't have the materials needed for producing this item.\n"));
672 }
else if (amount != producibleAmount) {
673 CP_Popup(
_(
"Not enough material!"),
_(
"You don't have enough material to produce all (%i) items. Production will continue with a reduced (%i) number."), amount, producibleAmount);
681 CP_Popup(
_(
"Hangars not ready"),
_(
"You cannot queue aircraft.\nNo free space in hangars.\n"));
724 cgi->UI_ExecuteConfunc(
"prod_selectline -1");
725 }
else if (prodIDX >= queue->
numItems) {
727 cgi->UI_ExecuteConfunc(
"prod_selectline %i", prodIDX);
743 if (
cgi->Cmd_Argc() == 2)
744 amount = atoi(
cgi->Cmd_Argv(1));
749 if (prod->
amount <= amount) {
776 if (
cgi->Cmd_Argc() != 2) {
777 cgi->Com_Printf(
"Usage: %s <diff> : change the production amount\n",
cgi->Cmd_Argv(0));
781 amount = atoi(
cgi->Cmd_Argv(1));
783 cgi->Cbuf_AddText(
"prod_inc %i\n", amount);
785 cgi->Cbuf_AddText(
"prod_dec %i\n", -amount);
840 if (
cgi->Cmd_Argc() < 2) {
841 cgi->Com_Printf(
"Usage: %s <base_idx>\n",
cgi->Cmd_Argv(0));
845 if (base ==
nullptr) {
846 cgi->Com_Printf(
"PR_ShowActiveProduction_f: Invalid base_idx!\n");
871 {
nullptr,
nullptr,
nullptr}
Header file for inventory handling and Equipment menu.
itemFilterTypes_t
A list of filter types in the market and production view.
Share stuff between the different cgame implementations.
int AIR_CountInBaseByTemplate(const base_t *base, const aircraft_t *aircraftTemplate)
Calculates the amount of aircraft (of the given type) in the selected base.
baseCapacities_t AIR_GetHangarCapacityType(const aircraft_t *aircraft)
Returns capacity type needed for an aircraft.
#define AIR_IsUFO(aircraft)
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
int B_AntimatterInBase(const base_t *base)
returns the amount of antimatter stored in a base
int B_ItemInBase(const objDef_t *item, const base_t *base)
Check if the item has been collected (i.e it is in the storage) in the given base.
Header for base management related stuff.
bool PR_ProductionAllowed(const base_t *base)
Returns true if the current base is able to produce items.
Header file for single player campaign control.
const cgame_import_t * cgi
int CAP_GetFreeCapacity(const base_t *base, baseCapacities_t capacityType)
Returns the free capacity of a type.
#define CAP_GetCurrent(base, capacity)
#define CAP_GetMax(base, capacity)
#define COMP_ITEMCOUNT_SCALED
int E_CountHired(const base_t *const base, employeeType_t type)
Counts hired employees of a given type in a given base.
static const vec4_t yellow
static const vec4_t green
Header for single player market stuff.
uiMessageListNodeMessage_t * MSO_CheckAddNewMessage(const notify_t messagecategory, const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup)
Adds a new message to message stack. It uses message settings to verify whether sound should be playe...
char cp_messageBuffer[MAX_MESSAGE_TEXT]
void PR_QueueDelete(base_t *base, production_queue_t *queue, int index)
Delete the selected entry from the queue.
const char * PR_GetName(const productionData_t *data)
int PR_GetPrice(const int productionCost)
Used in production costs (to allow reducing prices below 1x).
production_t * PR_QueueNew(base_t *base, const productionData_t *data, signed int amount)
Add a new item to the bottom of the production queue.
int PR_DecreaseProduction(production_t *prod, int amount)
decreases production amount
int PR_IncreaseProduction(production_t *prod, int amount)
increases production amount if possible
int PR_RequirementsMet(int amount, const requirements_t *reqs, base_t *base)
Checks if the production requirements are met for a defined amount.
int PR_GetRemainingHours(const production_t *prod)
Calculates the remaining hours for a technology.
void PR_UpdateProductionCap(base_t *base, int workerChange)
Update the current capacity of Workshop.
int PR_GetProductionHours(const base_t *base, const productionData_t *prodData)
Calculates the production time (in hours) for a technology.
void PR_QueueMove(production_queue_t *queue, int index, int offset)
Moves the given queue item in the given direction.
technology_t * PR_GetTech(const productionData_t *data)
bool PR_ItemIsProduceable(const objDef_t *item)
check if an item is producable.
Header for production related stuff.
#define PR_IsDataValid(dataPtr)
@ PRODUCTION_TYPE_DISASSEMBLY
@ PRODUCTION_TYPE_AIRCRAFT
#define PR_IsAircraft(prod)
#define MAX_PRODUCTION_AMOUNT
#define PR_IsDisassemblyData(data)
#define PR_SetData(dataPtr, typeVal, ptr)
#define PR_GetProgress(prod)
#define PR_GetProductionForBase(base)
#define PR_IsItemData(data)
#define PR_IsAircraftData(data)
#define PR_IsDisassembly(prod)
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 productionData_t selectedData
static void PR_ProductionListClick_f(void)
Click function for production list.
void PR_ShutdownCallbacks(void)
static void PR_ClearSelectedItems(void)
Resets the selected item data structure. Does not reset the selected production.
static void PR_ProductionDown_f(void)
shift the current production down the list
static void PR_RequirementsInfo(const base_t *base, const requirements_t *reqs)
static void PR_ProductionIncrease_f(void)
Increases the production amount by given parameter.
static const cmdList_t productionCallbacks[]
static void PR_ProductionUp_f(void)
shift the current production up the list
static void PR_ClearSelected(void)
Resets all "selected" pointers to nullptr.
static itemFilterTypes_t produceCategory
void PR_InitCallbacks(void)
static void PR_ProductionList_f(void)
Will fill the list of producible items.
static void PR_ProductionListRightClick_f(void)
Click function for production list.
static production_t * selectedProduction
static void PR_AircraftInfo(const base_t *base, const aircraft_t *aircraftTemplate, int remainingHours)
Prints information about the selected aircraft in production.
static void PR_ProductionChange_f(void)
Change the production amount by given diff.
static const int QUEUE_SPACERS
Number of blank lines between queued items and tech list.
static linkedList_t * productionItemList
static void PR_ProductionInfo(const base_t *base)
Prints information about the selected item in production.
static void PR_DisassemblyInfo(const storedUFO_t *ufo, int remainingHours)
Prints information about the selected disassembly task.
static void PR_ItemProductionInfo(const base_t *base, const objDef_t *od, int remainingHours)
Prints information about the selected item (no aircraft) in production.
static void PR_UpdateProductionList(const base_t *base)
update the list of queued and available items
static void PR_ProductionType_f(void)
Will select a new tab on the production list.
static void PR_ShowActiveProduction_f(void)
Show active production item in Base sections.
Header file for menu related console command callbacks for production menu.
technology_t * RS_GetTechForItem(const objDef_t *item)
Returns technology entry for an item.
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
#define ANTIMATTER_ITEM_ID
const char * UFO_TypeToName(const ufoType_t type)
Translate UFO type to name.
void UP_OpenWith(const char *techID)
Opens the UFOpaedia from everywhere with the entry given through name.
int US_UFOsInStorage(const aircraft_t *ufoTemplate, const installation_t *installation)
Returns the number of UFOs stored (on an installation or anywhere).
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
An aircraft with all it's data.
ufoType_t getUfoType() const
struct technology_s * tech
A base with all it's data.
Defines all attributes of objects used in the inventory.
A production queue. Lists all items to be produced.
struct production_s items[MAX_PRODUCTIONS]
Holds all information for the production of one item-type.
union productionData_t::productionItem_t data
union requirement_t::typelink_t link
requirement_t links[MAX_TECHLINKS]
Structure for stored UFOs.
struct components_s * comp
const aircraft_t * ufoTemplate
installation_t * installation
This is the technology parsed from research.ufo.
requirements_t requireForProduction
Atomic structure used to define most of the UI.
@ OPTION_PRODUCTION_REQUIREMENTS
const struct aircraft_s * aircraft
const struct objDef_s * od
#define Vector4Copy(src, dest)