Menu related functions for research. More...
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "cp_campaign.h"
#include "cp_research_callbacks.h"
Go to the source code of this file.
Data Structures | |
struct | guiResearchElement_t |
Enumerations | |
enum | guiResearchElementType_t { RSGUI_NOTHING, RSGUI_RESEARCH, RSGUI_BASETITLE, RSGUI_BASEINFO, RSGUI_RESEARCHOUT, RSGUI_MISSINGITEM, RSGUI_MISSINGITEMTITLE, RSGUI_UNRESEARCHABLEITEM, RSGUI_UNRESEARCHABLEITEMTITLE } |
Functions | |
static void | RS_UpdateInfo (const base_t *base) |
Displays the informations of the current selected technology in the description-area. | |
static void | RS_UpdateResearchStatus (int row) |
Update the research status of a row. | |
static void | RS_InitGUI (base_t *base, qboolean update) |
Initialize/Update all the GUI according to the current view. | |
static void | CL_ResearchSelect_f (void) |
Changes the active research-list entry to the currently selected. See menu_research.ufo for the layout/called functions. | |
static void | RS_ChangeScientist_f (void) |
Script function to add and remove a scientist to the technology entry in the research-list. | |
static void | RS_MaxOutResearch (base_t *base, technology_t *tech) |
Assign as many scientists to the research project as possible. | |
static void | RS_AssignScientist_f (void) |
Script function to add a scientist to the technology entry in the research-list. | |
static void | RS_RemoveScientist_f (void) |
Script function to remove a scientist from the technology entry in the research-list. | |
static void | RS_UpdateData_f (void) |
Script binding for RS_UpdateData. | |
static void | RS_ResearchStart_f (void) |
Starts the research of the selected research-list entry. | |
static void | RS_ResearchStop_f (void) |
Removes all scientists from the selected research-list entry. | |
static void | RS_ShowPedia_f (void) |
Switches to the UFOpaedia entry of the currently selected research entry. | |
static void | RS_InitGUIData (base_t *base) |
Create a GUI view of the current research in a base. | |
static void | CL_ResearchType_f (void) |
Checks whether there are items in the research list and there is a base otherwise leave the research menu again. | |
static void | UI_ResearchInit_f (void) |
Research menu init function binding. | |
void | RS_InitCallbacks (void) |
void | RS_ShutdownCallbacks (void) |
Variables | |
static guiResearchElement_t | researchList2 [MAX_RESEARCHLIST+MAX_BASES+MAX_BASES] |
A (local) list of displayed technology-entries (the research list in the base). | |
static int | researchListLength |
static int | researchListPos |
Menu related functions for research.
Definition in file cp_research_callbacks.c.
RSGUI_NOTHING | |
RSGUI_RESEARCH | |
RSGUI_BASETITLE | |
RSGUI_BASEINFO | |
RSGUI_RESEARCHOUT | |
RSGUI_MISSINGITEM | |
RSGUI_MISSINGITEMTITLE | |
RSGUI_UNRESEARCHABLEITEM | |
RSGUI_UNRESEARCHABLEITEMTITLE |
Definition at line 33 of file cp_research_callbacks.c.
static void CL_ResearchSelect_f | ( | void | ) | [static] |
Changes the active research-list entry to the currently selected. See menu_research.ufo for the layout/called functions.
Definition at line 340 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), guiResearchElement_t::base, Cmd_Argc(), Cmd_Argv(), Com_Printf(), base_s::idx, qtrue, researchListLength, researchListPos, RS_InitGUI(), RSGUI_BASETITLE, RSGUI_RESEARCH, RSGUI_RESEARCHOUT, RSGUI_UNRESEARCHABLEITEM, TEXT_STANDARD, guiResearchElement_t::type, type, UI_ExecuteConfunc(), and UI_ResetData().
Referenced by RS_InitCallbacks().
static void CL_ResearchType_f | ( | void | ) | [static] |
Checks whether there are items in the research list and there is a base otherwise leave the research menu again.
Definition at line 801 of file cp_research_callbacks.c.
References _, B_GetBuildingStatus(), B_GetCurrentSelectedBase(), B_LAB, qfalse, researchListLength, RS_InitGUIData(), UI_Popup(), and UI_PopWindow().
Referenced by RS_InitCallbacks(), and UI_ResearchInit_f().
static void RS_AssignScientist_f | ( | void | ) | [static] |
Script function to add a scientist to the technology entry in the research-list.
Definition at line 454 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, qtrue, researchListLength, RS_AssignScientist(), and RS_InitGUI().
Referenced by RS_InitCallbacks().
static void RS_ChangeScientist_f | ( | void | ) | [static] |
Script function to add and remove a scientist to the technology entry in the research-list.
Definition at line 389 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, qtrue, researchListLength, RS_AssignScientist(), RS_InitGUI(), and RS_RemoveScientist().
Referenced by RS_InitCallbacks().
void RS_InitCallbacks | ( | void | ) |
Definition at line 837 of file cp_research_callbacks.c.
References CL_ResearchSelect_f(), CL_ResearchType_f(), Cmd_AddCommand(), researchListLength, researchListPos, RS_AssignScientist_f(), RS_ChangeScientist_f(), RS_RemoveScientist_f(), RS_ResearchStart_f(), RS_ResearchStop_f(), RS_ShowPedia_f(), RS_UpdateData_f(), and UI_ResearchInit_f().
Referenced by CP_AddCampaignCallbackCommands().
Initialize/Update all the GUI according to the current view.
[in] | base | Pointer to the base where item list is updated |
[in] | update | If true, only update editable content |
Definition at line 194 of file cp_research_callbacks.c.
References _, B_GetFoundedBaseByIDX(), guiResearchElement_t::base, Com_DPrintf(), Com_Printf(), Cvar_Set(), Cvar_SetValue(), DEBUG_CLIENT, E_CountUnassigned(), EMPL_SCIENTIST, i, technology_s::id, base_s::idx, MAX_BASES, MAX_RESEARCHDISPLAY, base_s::name, technology_s::name, technology_s::overallTime, qfalse, researchListLength, researchListPos, RS_UpdateInfo(), RS_UpdateResearchStatus(), RSGUI_BASEINFO, RSGUI_BASETITLE, RSGUI_MISSINGITEM, RSGUI_MISSINGITEMTITLE, RSGUI_NOTHING, RSGUI_RESEARCH, RSGUI_RESEARCHOUT, RSGUI_UNRESEARCHABLEITEM, RSGUI_UNRESEARCHABLEITEMTITLE, technology_s::scientists, guiResearchElement_t::tech, technology_s::time, guiResearchElement_t::type, UI_ExecuteConfunc(), and va().
Referenced by CL_ResearchSelect_f(), RS_AssignScientist_f(), RS_ChangeScientist_f(), RS_RemoveScientist_f(), RS_ResearchStart_f(), RS_ResearchStop_f(), RS_UpdateData_f(), and UI_ResearchInit_f().
static void RS_InitGUIData | ( | base_t * | base | ) | [static] |
Create a GUI view of the current research in a base.
[in] | base | Pointer to the base where item list is updated |
Definition at line 665 of file cp_research_callbacks.c.
References B_GetBuildingInBaseByType(), B_GetFoundedBaseByIDX(), B_LAB, guiResearchElement_t::base, technology_s::base, ccs, i, MAX_BASES, ccs_s::numTechnologies, qfalse, qtrue, researchListLength, RS_FINISH, RS_GetTechByIDX(), RS_MarkResearchable(), RSGUI_BASEINFO, RSGUI_BASETITLE, RSGUI_NOTHING, RSGUI_RESEARCH, RSGUI_RESEARCHOUT, RSGUI_UNRESEARCHABLEITEM, RSGUI_UNRESEARCHABLEITEMTITLE, technology_s::statusCollected, technology_s::statusResearch, technology_s::statusResearchable, guiResearchElement_t::tech, technology_s::time, and guiResearchElement_t::type.
Referenced by CL_ResearchType_f().
static void RS_MaxOutResearch | ( | base_t * | base, | |
technology_t * | tech | |||
) | [static] |
Assign as many scientists to the research project as possible.
[in] | base | The base the tech is researched in. |
[in] | tech | The technology you want to max out. |
Definition at line 428 of file cp_research_callbacks.c.
References CAP_LABSPACE, base_s::capacities, cap_maxcur_s::cur, E_GetUnassignedEmployee(), EMPL_SCIENTIST, cap_maxcur_s::max, qtrue, RS_AssignScientist(), and technology_s::scientists.
Referenced by RS_ResearchStart_f().
static void RS_RemoveScientist_f | ( | void | ) | [static] |
Script function to remove a scientist from the technology entry in the research-list.
Definition at line 483 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_Printf(), qtrue, researchListLength, RS_InitGUI(), and RS_RemoveScientist().
Referenced by RS_InitCallbacks().
static void RS_ResearchStart_f | ( | void | ) | [static] |
Starts the research of the selected research-list entry.
Definition at line 522 of file cp_research_callbacks.c.
References _, B_GetBuildingStatus(), B_GetCurrentSelectedBase(), B_LAB, technology_s::base, Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, technology_s::id, qfalse, qtrue, technology_s::requireAND, technology_s::requireOR, researchListLength, researchListPos, RS_FINISH, RS_InitGUI(), RS_MarkOneResearchable(), RS_MarkResearchable(), RS_MaxOutResearch(), RS_NONE, RS_PAUSED, RS_RequirementsMet(), RS_RUNNING, technology_s::scientists, technology_s::statusResearch, technology_s::statusResearchable, guiResearchElement_t::tech, and UI_Popup().
Referenced by RS_InitCallbacks().
static void RS_ResearchStop_f | ( | void | ) | [static] |
Removes all scientists from the selected research-list entry.
Definition at line 595 of file cp_research_callbacks.c.
References _, B_GetBuildingStatus(), B_GetCurrentSelectedBase(), B_LAB, Com_Printf(), qtrue, researchListLength, researchListPos, RS_FINISH, RS_InitGUI(), RS_NONE, RS_PAUSED, RS_RUNNING, RS_StopResearch(), technology_s::statusResearch, guiResearchElement_t::tech, and UI_Popup().
Referenced by RS_InitCallbacks().
static void RS_ShowPedia_f | ( | void | ) | [static] |
Switches to the UFOpaedia entry of the currently selected research entry.
Definition at line 640 of file cp_research_callbacks.c.
References _, technology_s::id, descriptions_s::numDescriptions, technology_s::preDescription, researchListLength, researchListPos, guiResearchElement_t::tech, UI_Popup(), and UP_OpenCopyWith().
Referenced by RS_InitCallbacks().
void RS_ShutdownCallbacks | ( | void | ) |
Definition at line 857 of file cp_research_callbacks.c.
References Cmd_RemoveCommand().
Referenced by CP_RemoveCampaignCallbackCommands().
static void RS_UpdateData_f | ( | void | ) | [static] |
Script binding for RS_UpdateData.
Definition at line 509 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), qtrue, and RS_InitGUI().
Referenced by RS_InitCallbacks().
static void RS_UpdateInfo | ( | const base_t * | base | ) | [static] |
Displays the informations of the current selected technology in the description-area.
Definition at line 65 of file cp_research_callbacks.c.
References _, technology_s::base, CAP_LABSPACE, base_s::capacities, Com_Printf(), Com_sprintf(), cap_maxcur_s::cur, Cvar_Set(), Cvar_SetValue(), E_CountHired(), E_CountUnassigned(), EMPL_SCIENTIST, technology_s::id, technology_s::image, cap_maxcur_s::max, technology_s::name, base_s::name, technology_s::overallTime, researchListLength, researchListPos, RS_FINISH, RS_NONE, RS_PAUSED, RS_RUNNING, RSGUI_RESEARCH, RSGUI_RESEARCHOUT, RSGUI_UNRESEARCHABLEITEM, technology_s::scientists, technology_s::statusCollected, technology_s::statusResearch, technology_s::statusResearchable, guiResearchElement_t::tech, TEXT_STANDARD, technology_s::time, guiResearchElement_t::type, type, UI_ResetData(), and va().
Referenced by RS_InitGUI().
static void RS_UpdateResearchStatus | ( | int | row | ) | [static] |
Update the research status of a row.
Definition at line 163 of file cp_research_callbacks.c.
References RS_FINISH, RS_NONE, RS_PAUSED, RS_RUNNING, RSGUI_RESEARCH, RSGUI_RESEARCHOUT, technology_s::statusResearch, guiResearchElement_t::tech, guiResearchElement_t::type, and UI_ExecuteConfunc().
Referenced by RS_InitGUI().
static void UI_ResearchInit_f | ( | void | ) | [static] |
Research menu init function binding.
Definition at line 826 of file cp_research_callbacks.c.
References B_GetCurrentSelectedBase(), CL_ResearchType_f(), qfalse, and RS_InitGUI().
Referenced by RS_InitCallbacks().
guiResearchElement_t researchList2[MAX_RESEARCHLIST+MAX_BASES+MAX_BASES] [static] |
A (local) list of displayed technology-entries (the research list in the base).
Definition at line 54 of file cp_research_callbacks.c.
int researchListLength [static] |
The number of entries in the above list.
Definition at line 57 of file cp_research_callbacks.c.
Referenced by CL_ResearchSelect_f(), CL_ResearchType_f(), RS_AssignScientist_f(), RS_ChangeScientist_f(), RS_InitCallbacks(), RS_InitGUI(), RS_InitGUIData(), RS_RemoveScientist_f(), RS_ResearchStart_f(), RS_ResearchStop_f(), RS_ShowPedia_f(), and RS_UpdateInfo().
int researchListPos [static] |
The currently selected entry in the above list.
Definition at line 60 of file cp_research_callbacks.c.
Referenced by CL_ResearchSelect_f(), RS_InitCallbacks(), RS_InitGUI(), RS_ResearchStart_f(), RS_ResearchStop_f(), RS_ShowPedia_f(), and RS_UpdateInfo().