25 #include "../../cl_shared.h"
79 cgi->Com_Error(
ERR_DROP,
"G_GetMaxExperiencePerMission: invalid skill type");
92 static_cast<int>(pow(static_cast<float>(chr->
score.
experience[
i]) / 10, 0.6f)));
95 static_cast<int>(pow(static_cast<float>(chr->
score.
experience[SKILL_NUM_TYPES]) / 10, 0.6f)));
108 cgi->Com_Printf(
"Warning: Could not get character with ucn: %i.\n", c->ucn);
113 const bool fullHP = c->
HP >= chr->
maxHP;
124 const int gainedXP = std::min(maxXP, c->chrscore.experience[
i] - chr->
score.
experience[
i]);
126 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_UpdateCharacterData: Soldier %s earned %d experience points in skill #%d (total experience: %d)\n",
133 chr->
HP = (fullHP ? chr->
maxHP : std::min(c->HP, chr->
maxHP));
149 const int num =
cgi->NET_ReadByte(msg);
152 cgi->Com_Error(
ERR_DROP,
"CP_ParseCharacterData: invalid character number found in stream (%i)\n", num);
154 for (
int i = 0;
i < num;
i++) {
157 c.
ucn =
cgi->NET_ReadShort(msg);
158 c.
HP =
cgi->NET_ReadShort(msg);
159 c.
STUN =
cgi->NET_ReadByte(msg);
215 if (!employee->isHiredInBase(aircraft->
homebase))
255 static void CHAR_DebugChangeStats_f (
void)
257 if (
cgi->Cmd_Argc() < 2) {
263 cgi->Com_Printf(
"Invalid base idx\n");
268 if (!employee->isHiredInBase(base))
288 cgi->Cmd_AddCommand(
"debug_statsupdate", CHAR_DebugChangeStats_f,
"Debug function to increase the kills and test the ranks");
298 cgi->Cmd_RemoveCommand(
"debug_statsupdate");
void CHAR_InitStartup(void)
Campaign initialization actions for the character module.
void CHAR_Shutdown(void)
Campaign closing actions for the character module.
int CHAR_GetMaxExperiencePerMission(const abilityskills_t skill)
Determines the maximum amount of XP per skill that can be gained from any one mission.
Header file for character (soldier, alien) related campaign functions.
Describes a rank that a recruit can gain.
#define E_Foreach(employeeType, var)
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
int experience[SKILL_NUM_TYPES+1]
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
void CHAR_UpdateData(linkedList_t *updateCharacters)
Transforms the battlescape values to the character.
int stuns[KILLED_NUM_TYPES]
rank_t * CL_GetRankByIdx(const int index)
Returns a rank at an index.
uiMessageListNodeMessage_t * MS_AddNewMessage(const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup, bool playSound)
Adds a new message to message stack.
A base with all it's data.
aircraft_t * aircraftCurrent
int treatmentLevel[BODYPART_MAXTYPE]
int kills[KILLED_NUM_TYPES]
void CHAR_UpdateSkills(character_t *chr)
Updates the character skills after a mission.
static bool CHAR_ShouldUpdateSoldierRank(const rank_t *rank, const character_t *chr)
Checks whether a soldier should be promoted.
const cgame_import_t * cgi
void CHAR_ParseData(dbuffer *msg, linkedList_t **updateCharacters)
Parses the character data which was send by G_MatchSendResults using G_SendCharacterData.
int initialSkills[SKILL_NUM_TYPES+1]
base_t * B_GetBaseByIDX(int baseIdx)
Array bound check for the base index. Will also return unfounded bases as long as the index is in the...
chrScoreGlobal_t chrscore
char cp_messageBuffer[MAX_MESSAGE_TEXT]
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
Structure of all stats collected for an actor over time.
Employee * E_GetEmployeeFromChrUCN(int uniqueCharacterNumber)
Searches all employee for the ucn (character id)
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
Header file for single player campaign control.
An aircraft with all it's data.
void CHAR_UpdateStats(const base_t *base, const aircraft_t *aircraft)
Update employees stats after mission.
int skills[SKILL_NUM_TYPES]
const char *IMPORT * Cmd_Argv(int n)
Describes a character with all its attributes.