1 /** 2 * @file 3 * @brief Nation code 4 * @note Nation functions with NAT_* 5 * @note City functions with CITY_* 6 */ 7 8 /* 9 Copyright (C) 2002-2013 UFO: Alien Invasion. 10 11 This program is free software; you can redistribute it and/or 12 modify it under the terms of the GNU General Public License 13 as published by the Free Software Foundation; either version 2 14 of the License, or (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 20 See the GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25 */ 26 27 #pragma once 28 29 /** 30 * @brief Detailed information about the nation relationship (currently per month, but could be used elsewhere). 31 * @todo Maybe we should also move the "funding" stuff (see nation_t) in here? It is static right now though so i see no reason to do that yet. 32 */ 33 typedef struct nationInfo_s { 34 bool inuse; /**< Is this entry used? */ 35 36 /* Relationship */ 37 float happiness; /**< percentage (0.00 - 1.00) of how the nation appreciates PHALANX. 1.00 is the maximum happiness */ 38 int xviInfection; /**< Increase by one each time a XVI spread is done in this nation. */ 39 } nationInfo_t; 40 41 /** 42 * @brief Nation definition 43 */ 44 typedef struct nation_s { 45 const char* id; /**< Unique ID of this nation. */ 46 const char* name; /**< Full name of the nation. */ 47 int idx; /**< position in the nations array */ 48 49 vec4_t color; /**< The color this nation uses in the color-coded earth-map */ 50 vec2_t pos; /**< Nation position on geoscape. */ 51 52 nationInfo_t stats[MONTHS_PER_YEAR]; /**< Detailed information about the history of this nations relationship toward PHALANX and the aliens. 53 * The first entry [0] is the current month - all following entries are stored older months. 54 * Combined with the funding info below we can generate an overview over time. 55 */ 56 57 /* Funding */ 58 int maxFunding; /**< How many (monthly) credits. */ 59 int maxSoldiers; /**< How many (monthly) soldiers. */ 60 int maxScientists; /**< How many (monthly) scientists. */ 61 int maxWorkers; /**< How many (monthly) workers. */ 62 int maxPilots; /**< How many (monthly) pilots. */ 63 } nation_t; 64 65 /** 66 * @brief City definition 67 */ 68 typedef struct city_s { 69 const char* id; /**< Unique ID of this city. */ 70 const char* name; /**< Full name of the city. */ 71 int idx; /**< position in the cities array */ 72 73 vec2_t pos; /**< City position on geoscape. */ 74 } city_t; 75 76 nation_t* NAT_GetNationByIDX(const int index); 77 nation_t* NAT_GetNationByID(const char* nationID); 78 void NAT_UpdateHappinessForAllNations(const float minhappiness); 79 void NAT_SetHappiness(const float minhappiness, nation_t* nation, const float happiness); 80 int NAT_GetFunding(const nation_t* const nation, int month); 81 const nationInfo_t* NAT_GetCurrentMonthInfo(const nation_t* const nation); 82 const char* NAT_GetHappinessString(const nation_t* nation); 83 84 void CL_ParseNations(const char* name, const char** text); 85 86 city_t* CITY_GetById(const char* cityId); 87 city_t* CITY_GetByPos(vec2_t pos); 88 void CITY_Parse(const char* name, const char** text); 89 90 bool NAT_ScriptSanityCheck(void); 91 92 void NAT_HandleBudget(const struct campaign_s* campaign); 93 void NAT_BackupMonthlyData(void); 94 95 void NAT_InitStartup(void); 96 void NAT_Shutdown(void); 97 98 #define MAX_NATIONS 8 99