UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_nation.h
Go to the documentation of this file.
1
7
8/*
9Copyright (C) 2002-2025 UFO: Alien Invasion.
10
11This program is free software; you can redistribute it and/or
12modify it under the terms of the GNU General Public License
13as published by the Free Software Foundation; either version 2
14of the License, or (at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
20See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25*/
26
27#pragma once
28
29 #include "../../DateTime.h"
30
35typedef struct nationInfo_s {
36 bool inuse;
37
38 /* Relationship */
39 float happiness;
42
46typedef struct nation_s {
47 const char* id;
48 const char* name;
49 int idx;
50
53
58
59 /* Funding */
65} nation_t;
66
70typedef struct city_s {
71 const char* id;
72 const char* name;
74} city_t;
75
80#define NAT_Foreach(var) LIST_Foreach(ccs.nations, nation_t, var)
81
82nation_t* NAT_GetNationByID(const char* nationID);
84
85void NAT_UpdateHappinessForAllNations(const float minhappiness);
86void NAT_SetHappiness(const float minhappiness, nation_t* nation, const float happiness);
87int NAT_GetFunding(const nation_t* const nation, int month);
88const nationInfo_t* NAT_GetCurrentMonthInfo(const nation_t* const nation);
89const char* NAT_GetHappinessString(const float happiness);
90const char* NAT_GetCurrentHappinessString(const nation_t* nation);
91void CP_HandleNationData(float minHappiness, struct mission_s* mis, const nation_t* nation, const struct missionResults_s* results, bool won);
92
93void CL_ParseNations(const char* name, const char** text);
94
95city_t* CITY_GetById(const char* cityId);
97void CITY_Parse(const char* name, const char** text);
98
99bool NAT_ScriptSanityCheck(void);
100
101void NAT_HandleBudget(const struct campaign_s* campaign);
102void NAT_BackupMonthlyData(void);
103
104void NAT_InitStartup(void);
105void NAT_Shutdown(void);
DateTime class definition.
static const short MONTHS_PER_YEAR
Definition DateTime.h:39
int NAT_GetFunding(const nation_t *const nation, int month)
Get the funding of a nation at a certain month.
void NAT_HandleBudget(const struct campaign_s *campaign)
void NAT_SetHappiness(const float minhappiness, nation_t *nation, const float happiness)
Updates the nation happiness.
nation_t * NAT_GetNationByID(const char *nationID)
Return a nation-pointer by the nations id.
Definition cp_nation.cpp:64
void CP_HandleNationData(float minHappiness, struct mission_s *mis, const nation_t *nation, const struct missionResults_s *results, bool won)
void NAT_BackupMonthlyData(void)
Backs up each nation's relationship values.
nation_t * NAT_GetRandom(void)
Return a pointer to a random nation.
Definition cp_nation.cpp:46
city_t * CITY_GetByPos(vec2_t pos)
Finds a city by it's geoscape coordinates.
void NAT_UpdateHappinessForAllNations(const float minhappiness)
Lower happiness of nations depending on alien activity.
Definition cp_nation.cpp:84
const nationInfo_t * NAT_GetCurrentMonthInfo(const nation_t *const nation)
Get the current month nation stats.
void CITY_Parse(const char *name, const char **text)
Parse the city data from script file.
void CL_ParseNations(const char *name, const char **text)
Parse the nation data from script file.
void NAT_InitStartup(void)
Init actions for nation-subsystem.
void NAT_Shutdown(void)
Closing actions for nation-subsystem.
bool NAT_ScriptSanityCheck(void)
Checks the parsed nations and cities for errors.
const char * NAT_GetCurrentHappinessString(const nation_t *nation)
Translates the current nation happiness float value to a string.
const char * NAT_GetHappinessString(const float happiness)
Translates the nation happiness float value to a string.
city_t * CITY_GetById(const char *cityId)
Finds a city by it's scripted identifier.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
City definition.
Definition cp_nation.h:70
const char * name
Definition cp_nation.h:72
vec2_t pos
Definition cp_nation.h:73
const char * id
Definition cp_nation.h:71
Nation definition.
Definition cp_nation.h:46
int maxScientists
Definition cp_nation.h:62
vec4_t color
Definition cp_nation.h:51
int idx
Definition cp_nation.h:49
int maxPilots
Definition cp_nation.h:64
int maxWorkers
Definition cp_nation.h:63
vec2_t pos
Definition cp_nation.h:52
nationInfo_t stats[DateTime::MONTHS_PER_YEAR]
Definition cp_nation.h:54
int maxSoldiers
Definition cp_nation.h:61
const char * name
Definition cp_nation.h:48
const char * id
Definition cp_nation.h:47
int maxFunding
Definition cp_nation.h:60
Detailed information about the nation relationship (currently per month, but could be used elsewhere)...
Definition cp_nation.h:35
float happiness
Definition cp_nation.h:39
int xviInfection
Definition cp_nation.h:40
vec_t vec4_t[4]
Definition ufotypes.h:40
vec_t vec2_t[2]
Definition ufotypes.h:38