cp_time.c File Reference

Campaign geoscape time code. More...

#include "../cl_shared.h"
#include "cp_campaign.h"
#include "cp_time.h"
Include dependency graph for cp_time.c:

Go to the source code of this file.

Data Structures

struct  gameLapse_s

Defines

#define NUM_TIMELAPSE   8

Typedefs

typedef struct gameLapse_s gameLapse_t

Functions

 CASSERT (lengthof(lapse)==NUM_TIMELAPSE)
void CL_UpdateTime (void)
 Updates date/time and timescale (=timelapse) on the geoscape menu.
void CL_GameTimeStop (void)
 Stop game time speed.
qboolean CL_IsTimeStopped (void)
 Check if time is stopped.
static qboolean CL_AllowTimeScale (void)
void CL_GameTimeSlow (void)
 Decrease game time speed.
void CL_GameTimeFast (void)
 Increase game time speed.
static void CL_SetGameTime (int gameLapseValue)
 Set game time speed.
void CL_SetGameTime_f (void)
 Set a new time game from id.
qboolean Date_LaterThan (date_t now, date_t compare)
 Check wheter given date and time is later than current date.
date_t Date_Add (date_t a, date_t b)
 Add two dates and return the result.
date_t Date_Random (date_t minFrame, date_t maxFrame)
 Return a random relative date which lies between a lower and upper limit.
const char * Date_GetMonthName (int month)
 Returns the monatname to the given month index.

Variables

static const gameLapse_t lapse [NUM_TIMELAPSE]
 The possible geoscape time intervalls.

Detailed Description

Campaign geoscape time code.

Definition in file cp_time.c.


Define Documentation

#define NUM_TIMELAPSE   8

Definition at line 36 of file cp_time.c.

Referenced by CL_GameTimeFast(), CL_SetGameTime(), and CL_UpdateTime().


Typedef Documentation

typedef struct gameLapse_s gameLapse_t

Function Documentation

CASSERT ( lengthof(lapse = =NUM_TIMELAPSE  ) 
static qboolean CL_AllowTimeScale ( void   )  [static]

Time scaling is only allowed when you are on the geoscape and when you had at least one base built.

Definition at line 101 of file cp_time.c.

References stats_s::basesBuilt, ccs_s::campaignStats, ccs, CP_OnGeoscape(), and qfalse.

Referenced by CL_GameTimeFast(), and CL_GameTimeSlow().

void CL_GameTimeFast ( void   ) 

Increase game time speed.

Definition at line 128 of file cp_time.c.

References ccs, CL_AllowTimeScale(), CL_UpdateTime(), ccs_s::gameLapse, and NUM_TIMELAPSE.

void CL_GameTimeSlow ( void   ) 

Decrease game time speed.

Definition at line 114 of file cp_time.c.

References ccs, CL_AllowTimeScale(), CL_UpdateTime(), and ccs_s::gameLapse.

void CL_GameTimeStop ( void   ) 
qboolean CL_IsTimeStopped ( void   ) 

Check if time is stopped.

Definition at line 93 of file cp_time.c.

References ccs, and ccs_s::gameLapse.

Referenced by CL_CampaignRun().

static void CL_SetGameTime ( int  gameLapseValue  )  [static]

Set game time speed.

Parameters:
[in] gameLapseValue The value to set the game time to.

Definition at line 143 of file cp_time.c.

References stats_s::basesBuilt, ccs_s::campaignStats, ccs, CL_UpdateTime(), ccs_s::gameLapse, and NUM_TIMELAPSE.

Referenced by CL_SetGameTime_f().

void CL_SetGameTime_f ( void   ) 

Set a new time game from id.

See also:
CL_SetGameTime
lapse

Definition at line 168 of file cp_time.c.

References CL_SetGameTime(), Cmd_Argc(), Cmd_Argv(), and Com_Printf().

void CL_UpdateTime ( void   ) 
date_t Date_Add ( date_t  a,
date_t  b 
)
const char* Date_GetMonthName ( int  month  ) 

Returns the monatname to the given month index.

Parameters:
[in] month The month index - [0-11]
Returns:
month name as char*

Definition at line 229 of file cp_time.c.

References _.

Referenced by CL_EventAddMail_f(), CL_UpdateTime(), MS_TimestampedText(), SAV_GameSave(), UP_OpenMail_f(), and UP_SetMailHeader().

qboolean Date_LaterThan ( date_t  now,
date_t  compare 
)

Check wheter given date and time is later than current date.

Parameters:
[in] now Current date.
[in] compare Date to compare.
Returns:
True if current date is later than given one.

Definition at line 183 of file cp_time.c.

References date_s::day, qfalse, qtrue, and date_s::sec.

Referenced by CP_CheckMissionEnd().

date_t Date_Random ( date_t  minFrame,
date_t  maxFrame 
)

Return a random relative date which lies between a lower and upper limit.

Parameters:
[in] minFrame Minimal date.
[in] maxFrame Maximal date.
Returns:
A date value between minFrame and maxFrame.

Definition at line 214 of file cp_time.c.

References date_s::day, frand(), date_s::sec, and SECONDS_PER_DAY.

Referenced by CP_BuildBaseSetUpBase(), CP_BuildBaseSubvertGovernment(), CP_CreateNewMission(), CP_HarvestMissionStart(), CP_InterceptAircraftMissionSet(), CP_InterceptAttackInstallation(), CP_ReconMissionAerial(), CP_ReconMissionGround(), CP_SpawnCrashSiteMission(), CP_SpawnRescueMission(), CP_SupplySetStayAtBase(), CP_TerrorMissionStart(), and CP_XVIMissionStart().


Variable Documentation

const gameLapse_t lapse[NUM_TIMELAPSE] [static]
Initial value:
 {
    {N_("stopped"), 0},
    {N_("5 sec"), 5},
    {N_("5 mins"), 5 * 60},
    {N_("20 mins"), SECONDS_PER_HOUR / 3},
    {N_("1 hour"), SECONDS_PER_HOUR},
    {N_("12 hours"), 12 * SECONDS_PER_HOUR},
    {N_("1 day"), 24 * SECONDS_PER_HOUR},
    {N_("5 days"), 5 * SECONDS_PER_DAY}
}

The possible geoscape time intervalls.

Definition at line 39 of file cp_time.c.


Generated by  doxygen 1.6.2