UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_event_callbacks.cpp File Reference
#include "../../cl_shared.h"
#include "../../ui/ui_dataids.h"
#include "cp_campaign.h"
#include "cp_geoscape.h"
#include "cp_event_callbacks.h"
#include "cp_missions.h"

Go to the source code of this file.

Functions

static void CP_AddTechAsResearchable_f (void)
 
static void CP_AddItemAsCollected_f (void)
 For things like craft_ufo_scout that are no real items this function will increase the collected counter by one. More...
 
static void CP_ChangeNationHappiness_f (void)
 Changes nation happiness by given value. More...
 
static void CP_EndGame_f (void)
 
void CP_CampaignTriggerFunctions (bool add)
 Add/Remove temporary mission trigger functions. More...
 

Variables

static const cmdList_t cp_commands []
 mission trigger functions More...
 

Function Documentation

static void CP_AddItemAsCollected_f ( void  )
static

For things like craft_ufo_scout that are no real items this function will increase the collected counter by one.

Note
Mission trigger function
See also
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 56 of file cp_event_callbacks.cpp.

References B_GetBaseByIDX(), cgi, cgame_import_s::Cmd_Argv(), DEBUG_CLIENT, objDef_s::id, objDef_s::idx, INVSH_GetItemByIDSilent(), RS_GetTechForItem(), and RS_MarkCollected().

static void CP_AddTechAsResearchable_f ( void  )
static
Note
Mission trigger function
See also
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 37 of file cp_event_callbacks.cpp.

References cgi, cgame_import_s::Cmd_Argv(), RS_GetTechByID(), and RS_MarkOneResearchable().

void CP_CampaignTriggerFunctions ( bool  add)

Add/Remove temporary mission trigger functions.

Note
These function can be defined via onwin/onlose parameters in missions.ufo
Parameters
[in]addIf true, add the trigger functions, otherwise delete them

Definition at line 147 of file cp_event_callbacks.cpp.

References cgi, cmdList_s::description, cmdList_s::function, and cmdList_s::name.

Referenced by CP_ExecuteMissionTrigger(), and CP_TriggerEvent().

static void CP_ChangeNationHappiness_f ( void  )
static

Changes nation happiness by given value.

Note
There must be argument passed to this function being converted to float.

Definition at line 88 of file cp_event_callbacks.cpp.

References ccs, cgi, cgame_import_s::Cmd_Argv(), ccs_s::curCampaign, GEO_GetNation(), GEO_GetSelectedMission, nationInfo_s::happiness, campaign_s::minhappiness, NAT_GetCurrentMonthInfo(), NAT_SetHappiness(), and mission_s::pos.

static void CP_EndGame_f ( void  )
static
Note
Mission trigger function
See also
CP_MissionTriggerFunctions
CP_ExecuteMissionTrigger

Definition at line 118 of file cp_event_callbacks.cpp.

References _, cgi, CP_EndCampaign(), and TEXT_STANDARD.

Variable Documentation

const cmdList_t cp_commands[]
static
Initial value:
= {
{"cp_add_researchable", CP_AddTechAsResearchable_f, "Add a tech as researchable"},
{"cp_add_item", CP_AddItemAsCollected_f, "Add an item as collected"},
{"cp_changehappiness", CP_ChangeNationHappiness_f, "Function to raise or lower nation happiness."},
{"cp_endgame", CP_EndGame_f, "This command will end the current campaign"},
{nullptr, nullptr, nullptr}
}
static void CP_AddItemAsCollected_f(void)
For things like craft_ufo_scout that are no real items this function will increase the collected coun...
static void CP_AddTechAsResearchable_f(void)
static void CP_EndGame_f(void)
static void CP_ChangeNationHappiness_f(void)
Changes nation happiness by given value.

mission trigger functions

Definition at line 133 of file cp_event_callbacks.cpp.