15 m_data_invalid =
false;
30 void pilotfile::startSection(
Section::id section_id)
42 m_size_offset =
cftell(cfp);
45 void pilotfile::endSection()
48 Assert( m_size_offset > 0 );
52 Assert( cur >= m_size_offset );
54 size_t section_size = cur - m_size_offset;
68 int idx,
i, j, list_size;
70 scoring_special_t *p_stats = NULL;
73 p_stats = &multi_stats;
75 p_stats = &all_time_stats;
80 list_size = (
int)p_stats->medals_earned.size();
84 for (idx = 0; idx < list_size; idx++) {
92 p_stats->medals_earned[j].val++;
98 p_stats->medals_earned.push_back(ilist);
111 p_stats->score += stats->
m_score;
127 p_stats->last_backup = p_stats->last_flown;
129 p_stats->missions_flown++;
133 list_size = (
int)p_stats->medals_earned.size();
134 for (
size_t medal = 0; medal < stats->
m_badge_earned.size(); medal++) {
137 for (idx = 0; idx < list_size; idx++) {
138 if ( p_stats->medals_earned[idx].name.compare(
Medals[stats->
m_badge_earned[medal]].name) == 0 ) {
145 p_stats->medals_earned[j].val = 1;
151 p_stats->medals_earned.push_back(ilist);
161 list_size = (
int)p_stats->ship_kills.size();
165 for (i = 0; i < list_size; i++) {
166 if ( p_stats->ship_kills[i].name.compare(it->name) == 0 ) {
175 ilist.name = it->name;
179 p_stats->ship_kills.push_back(ilist);
191 scoring_special_t *p_stats = NULL;
194 p_stats = &multi_stats;
196 p_stats = &all_time_stats;
201 list_size = p_stats->medals_earned.size();
205 for (idx = 0; idx < list_size; idx++) {
213 p_stats->medals_earned[j].val =
MAX(0,p_stats->medals_earned[j].val--);
224 p_stats->score -= stats->
m_score;
240 p_stats->last_flown = p_stats->last_backup;
241 p_stats->missions_flown--;
251 Assertion (p_stats->rank >= 0,
"Rank became negative.");
256 list_size = p_stats->medals_earned.size();
257 for (
size_t medal = 0; medal < stats->
m_badge_earned.size(); medal++) {
260 for (idx = 0; idx < list_size; idx++) {
261 if ( p_stats->medals_earned[idx].name.compare(
Medals[stats->
m_badge_earned[medal]].name) == 0 ) {
268 p_stats->medals_earned[j].val = 0;
279 list_size = p_stats->ship_kills.size();
283 for (idx = 0; idx < list_size; idx++) {
284 if ( p_stats->ship_kills[idx].name.compare(it->name) == 0 ) {
291 p_stats->ship_kills[j].val -= stats->
m_okKills[
i];
293 Assertion(
false,
"Ship kills of '%s' not found, should have been added by pilotfile::update_stats.",
Ship_info[i].
name);
304 scoring_special_t *ss_stats[] = {&all_time_stats, &multi_stats};
306 for (
int i = 0;
i < 2; ++
i) {
307 ss_stats[
i]->score = 0;
308 ss_stats[
i]->assists = 0;
309 ss_stats[
i]->score = 0;
310 ss_stats[
i]->rank = 0;
311 ss_stats[
i]->assists = 0;
312 ss_stats[
i]->kill_count = 0;
313 ss_stats[
i]->kill_count_ok = 0;
314 ss_stats[
i]->bonehead_kills = 0;
316 ss_stats[
i]->p_shots_fired = 0;
317 ss_stats[
i]->p_shots_hit = 0;
318 ss_stats[
i]->p_bonehead_hits = 0;
320 ss_stats[
i]->s_shots_fired = 0;
321 ss_stats[
i]->s_shots_hit = 0;
322 ss_stats[
i]->s_bonehead_hits = 0;
324 ss_stats[
i]->missions_flown = 0;
325 ss_stats[
i]->flight_time = 0;
326 ss_stats[
i]->last_flown = 0;
327 ss_stats[
i]->last_backup = 0;
329 ss_stats[
i]->ship_kills.clear();
330 ss_stats[
i]->medals_earned.clear();
int cfwrite_ushort(ushort s, CFILE *file)
SCP_vector< medal_stuff > Medals
unsigned int mp_shots_fired
unsigned int mp_bonehead_hits
#define Assertion(expr, msg,...)
unsigned int ms_bonehead_hits
unsigned int mp_shots_hit
SCP_vector< int > m_badge_earned
unsigned int ms_shots_fired
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
int m_okKills[MAX_SHIP_CLASSES]
int cfwrite_int(int i, CFILE *file)
GLuint const GLchar * name
void update_stats_backout(scoring_struct *stats, bool training=false)
void update_stats(scoring_struct *stats, bool training=false)
SCP_vector< ship_info > Ship_info
rank_stuff Ranks[NUM_RANKS]
int cfclose(CFILE *cfile)
#define MAX_FREESPACE2_RANK
unsigned int ms_shots_hit
int cfseek(CFILE *fp, int offset, int where)