25 #include "../../cl_shared.h" 29 typedef struct updateCharacter_s {
83 cgi->Com_Error(
ERR_DROP,
"G_GetMaxExperiencePerMission: invalid skill type");
96 static_cast<int>(pow(static_cast<float>(chr->
score.
experience[
i]) / 10, 0.6f)));
112 cgi->Com_Printf(
"Warning: Could not get character with ucn: %i.\n", c->ucn);
117 const bool fullHP = c->
HP >= chr->
maxHP;
128 const int gainedXP = std::min(maxXP, c->chrscore.experience[
i] - chr->
score.
experience[
i]);
130 cgi->Com_DPrintf(
DEBUG_CLIENT,
"CP_UpdateCharacterData: Soldier %s earned %d experience points in skill #%d (total experience: %d)\n",
137 chr->
HP = (fullHP ? chr->
maxHP : std::min(c->HP, chr->
maxHP));
153 const int num =
cgi->NET_ReadByte(msg);
156 cgi->Com_Error(
ERR_DROP,
"CP_ParseCharacterData: invalid character number found in stream (%i)\n", num);
158 for (
int i = 0;
i < num;
i++) {
160 c.
ucn =
cgi->NET_ReadShort(msg);
161 c.
HP =
cgi->NET_ReadShort(msg);
162 c.
STUN =
cgi->NET_ReadByte(msg);
218 if (!employee->isHiredInBase(aircraft->
homebase))
258 static void CHAR_DebugChangeStats_f (
void)
260 if (
cgi->Cmd_Argc() < 2) {
266 cgi->Com_Printf(
"Invalid base idx\n");
271 if (!employee->isHiredInBase(base))
291 cgi->Cmd_AddCommand(
"debug_statsupdate", CHAR_DebugChangeStats_f,
"Debug function to increase the kills and test the ranks");
301 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.
chrScoreGlobal_t chrscore
Header file for character (soldier, alien) related campaign functions.
A base with all it's data.
#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 treatmentLevel[BODYPART_MAXTYPE]
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Describes a character with all its attributes.
Structure of all stats collected for an actor over time.
void CHAR_UpdateData(linkedList_t *updateCharacters)
Transforms the battlescape values to the character.
const char *IMPORT * Cmd_Argv(int n)
rank_t * CL_GetRankByIdx(const int index)
Returns a rank at an index.
int stuns[KILLED_NUM_TYPES]
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.
int experience[SKILL_NUM_TYPES+1]
aircraft_t * aircraftCurrent
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.
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...
char cp_messageBuffer[MAX_MESSAGE_TEXT]
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
An aircraft with all it's data.
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.
int initialSkills[SKILL_NUM_TYPES+1]
int skills[SKILL_NUM_TYPES]
int kills[KILLED_NUM_TYPES]
void CHAR_UpdateStats(const base_t *base, const aircraft_t *aircraft)
Update employees stats after mission.
Describes a rank that a recruit can gain.