cp_research_callbacks.c File Reference

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

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

Detailed Description

Menu related functions for research.

Definition in file cp_research_callbacks.c.


Enumeration Type Documentation

Enumerator:
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.


Function Documentation

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.

Todo:
improve that, don't need to update everything

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.

Note:
if there is a base but no lab a popup appears
See also:
RS_UpdateData
UI_ResearchInit_f

Todo:
wrong computation: researchListLength doesn't say if there are research on this base

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.

See also:
RS_AssignScientist
RS_RemoveScientist_f

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.

See also:
RS_AssignScientist_f
RS_RemoveScientist_f
Todo:
use the diff as a value, not only as a +1 or -1

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   ) 
static void RS_InitGUI ( base_t base,
qboolean  update 
) [static]
static void RS_InitGUIData ( base_t base  )  [static]
static void RS_MaxOutResearch ( base_t base,
technology_t tech 
) [static]

Assign as many scientists to the research project as possible.

Parameters:
[in] base The base the tech is researched in.
[in] tech The technology you want to max out.
See also:
RS_AssignScientist

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.

See also:
RS_AssignScientist_f
RS_RemoveScientist

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

Removes all scientists from the selected research-list entry.

Todo:
remove? Popup info how much is already researched?

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]
static void RS_UpdateResearchStatus ( int  row  )  [static]
static void UI_ResearchInit_f ( void   )  [static]

Research menu init function binding.

Note:
Should be called whenever the research menu gets active
See also:
CL_ResearchType_f

Definition at line 826 of file cp_research_callbacks.c.

References B_GetCurrentSelectedBase(), CL_ResearchType_f(), qfalse, and RS_InitGUI().

Referenced by RS_InitCallbacks().


Variable Documentation

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


Generated by  doxygen 1.6.2