UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_rank.cpp File Reference
#include "../../cl_shared.h"
#include "../../../shared/parse.h"
#include "cp_rank.h"
#include "cp_campaign.h"

Go to the source code of this file.

Functions

int CL_GetRankIdx (const char *rankID)
 Get the index of the given rankID in ccs.ranks array. More...
 
rank_tCL_GetRankByIdx (const int index)
 Returns a rank at an index. More...
 
void CL_ParseRanks (const char *name, const char **text)
 Parse medals and ranks defined in the medals.ufo file. More...
 

Variables

static const value_t rankValues []
 

Function Documentation

rank_t* CL_GetRankByIdx ( const int  index)

Returns a rank at an index.

Parameters
[in]indexIndex of rank in ccs.ranks
Returns
nullptr on invalid index
pointer to the rank definition otherwise

Definition at line 50 of file cp_rank.cpp.

References ccs, index, ccs_s::numRanks, and ccs_s::ranks.

Referenced by CHAR_UpdateStats(), CP_TEAM_FillBDEFEmployeeList_f(), GAME_CP_CharacterCvars(), HOS_GetRank(), Employee::salary(), TR_CargoList(), and TR_FillEmployees().

int CL_GetRankIdx ( const char *  rankID)

Get the index of the given rankID in ccs.ranks array.

Parameters
[in]rankIDScript id of the rank
Returns
-1 if no rank with rankID found

Definition at line 34 of file cp_rank.cpp.

References ccs, i, rank_s::id, ccs_s::numRanks, Q_streq, and ccs_s::ranks.

Referenced by E_CreateEmployee().

void CL_ParseRanks ( const char *  name,
const char **  text 
)

Parse medals and ranks defined in the medals.ufo file.

See also
CL_ParseScriptFirst

Definition at line 74 of file cp_rank.cpp.

References ccs, cgi, cgame_import_s::Com_EParse(), Com_Parse(), cp_campaignPool, E_GetEmployeeType(), ERR_DROP, i, rank_s::id, rank_s::image, rank_s::level, MAX_RANKS, rank_s::name, ccs_s::numRanks, OBJZERO, cgame_import_s::PoolStrDup(), Q_streq, ccs_s::ranks, rank_s::shortname, and rank_s::type.

Referenced by CP_ParseScriptFirst().

Variable Documentation

const value_t rankValues[]
static
Initial value:
= {
{"name", V_TRANSLATION_STRING, offsetof(rank_t, name), 0},
{"shortname", V_TRANSLATION_STRING, offsetof(rank_t, shortname), 0},
{"image", V_HUNK_STRING, offsetof(rank_t, image), 0},
{"mind", V_INT, offsetof(rank_t, mind), MEMBER_SIZEOF(rank_t, mind)},
{"killed_enemies", V_INT, offsetof(rank_t, killedEnemies), MEMBER_SIZEOF(rank_t, killedEnemies)},
{"killed_others", V_INT, offsetof(rank_t, killedOthers), MEMBER_SIZEOF(rank_t, killedOthers)},
{"factor", V_FLOAT, offsetof(rank_t, factor), MEMBER_SIZEOF(rank_t, factor)},
{"level", V_INT, offsetof(rank_t, level), MEMBER_SIZEOF(rank_t, level)},
{nullptr, V_NULL, 0, 0}
}
Describes a rank that a recruit can gain.
Definition: cp_rank.h:29
Definition: scripts.h:49
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52
level_locals_t level
Definition: g_main.cpp:38

Definition at line 58 of file cp_rank.cpp.