UFO: Alien Invasion
Loading...
Searching...
No Matches
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"
Include dependency graph for cp_event_callbacks.cpp:

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.
static void CP_ChangeNationHappiness_f (void)
 Changes nation happiness by given value.
static void CP_EndGame_f (void)
void CP_CampaignTriggerFunctions (bool add)
 Add/Remove temporary mission trigger functions.

Variables

static const cmdList_t cp_commands []
 mission trigger functions

Function Documentation

◆ CP_AddItemAsCollected_f()

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, DEBUG_CLIENT, id, objDef_t::id, objDef_t::idx, INVSH_GetItemByIDSilent(), equipDef_t::numItems, RS_GetTechForItem(), RS_MarkCollected(), and base_t::storage.

◆ CP_AddTechAsResearchable_f()

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, RS_GetTechByID(), and RS_MarkOneResearchable().

◆ CP_CampaignTriggerFunctions()

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, cp_commands, cmdList_t::description, cmdList_t::function, and cmdList_t::name.

Referenced by CP_ExecuteMissionTrigger(), and CP_TriggerEvent().

◆ CP_ChangeNationHappiness_f()

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, GEO_GetNation(), GEO_GetSelectedMission, nationInfo_t::happiness, NAT_GetCurrentMonthInfo(), NAT_SetHappiness(), and mission_t::pos.

◆ CP_EndGame_f()

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

◆ cp_commands

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_ChangeNationHappiness_f(void)
Changes nation happiness by given value.
static void CP_EndGame_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 coun...
static void CP_AddTechAsResearchable_f(void)

mission trigger functions

Definition at line 133 of file cp_event_callbacks.cpp.

Referenced by CP_CampaignTriggerFunctions().