MCPcopy Create free account
hub / github.com/ZDoom/Raze / ParseStatistics

Function ParseStatistics

source/core/statistics.cpp:114–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112//==========================================================================
113
114static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
115{
116 statlist.Clear();
117 try
118 {
119 FScanner sc;
120 if (!sc.OpenFile(fn)) return;
121
122 while (sc.GetString())
123 {
124 FStatistics &ep_entry = statlist[statlist.Reserve(1)];
125
126 ep_entry.epi_header = sc.String;
127 sc.MustGetString();
128 ep_entry.epi_name = sc.String;
129
130 sc.MustGetStringName("{");
131 while (!sc.CheckString("}"))
132 {
133 FSessionStatistics &session = ep_entry.stats[ep_entry.stats.Reserve(1)];
134
135 sc.MustGetString();
136 sc.MustGetString();
137 strncpy(session.name, sc.String, 23);
138 sc.MustGetString();
139 strncpy(session.info, sc.String, 59);
140
141 int h,m,s;
142 sc.MustGetString();
143 if (3 == sscanf(sc.String, "%d:%d:%d", &h, &m, &s))
144 {
145 session.timeneeded = ((((h * 60) + m) * 60) + s);
146 }
147 else session.timeneeded = 0;
148
149 sc.MustGetNumber();
150 session.skill=sc.Number;
151 if (sc.CheckString("{"))
152 {
153 while (!sc.CheckString("}"))
154 {
155 FLevelStatistics &lstats = session.levelstats[session.levelstats.Reserve(1)];
156
157 sc.MustGetString();
158 strncpy(lstats.name, sc.String, 23);
159 sc.MustGetString();
160 strncpy(lstats.info, sc.String, 59);
161
162 int hour,min,sec;
163 sc.MustGetString();
164 if (3 == sscanf(sc.String, "%d:%d:%d", &hour, &min, &sec))
165 {
166 lstats.timeneeded = ((((hour * 60) + min) * 60) + sec);
167 }
168 else lstats.timeneeded = 0;
169
170 lstats.skill = 0;
171 }

Callers 1

InitStatisticsFunction · 0.85

Calls 8

ReserveMethod · 0.80
MustGetStringMethod · 0.80
MustGetStringNameMethod · 0.80
MustGetNumberMethod · 0.80
ClearMethod · 0.45
OpenFileMethod · 0.45
GetStringMethod · 0.45
CheckStringMethod · 0.45

Tested by

no test coverage detected