1 #pragma once
2 #include <string>
3 #include <vector>
4 #include <map>
5 #include <OgreStringVector.h>
6 
7 
8 //  single Track in challenge
9 class ChallTrack
10 {
11 public:
12 	std::string name;  bool reversed;  // track
13 	int laps;  // number of laps
14 
15 	//  pass  -1 means not needed, you can use one or more conditions
16 	float passPoints, timeNeeded;  int passPos;
17 
18 	//todo: bronze, silver, gold ?percent or val
19 	ChallTrack();
20 };
21 
22 ///  one Challenge setup
23 class Chall
24 {
25 public:
26 	std::string name, descr;  // description text
27 	int diff;  // difficulty
28 	int ver;  // version, if changed resets progress
29 
30 	float length;  // stats for display
31 	int type;  // easy, normal etc, for gui tab
32 	float time;  // total computed (sum all tracks)
33 	int prizes;  // 0 only gold  1 gold,silver  2 gold,silver,bronze
34 	float factor;  // multiplier for silver,bronze points/pos prizes
35 
36 	//  allowed types or cars 1 or more
37 	Ogre::StringVector carTypes, cars;
38 
39 	std::vector<ChallTrack> trks;
40 
41 	//  game setup
42 	//  if empty or -1 then allows any
43 	std::string sim_mode;
44 	int damage_type, boost_type, flip_type, rewind_type;
45 	int dmg_lap;  // dmg repair on lap
46 
47 	//  hud
48 	bool minimap, chk_arr, chk_beam,
49 		trk_ghost, pacenotes;  // deny using it if false
50 	bool abs,tcs;  // deny if false
51 
52 	//  pass  -1 means not needed, you can use one or more conditions
53 	float totalTime, avgPoints, avgPos;
54 	bool carChng;  // allow car change
55 
56 	// autoshift, autorear
57 	// max dmg%, off road time-
58 	//..int retries;  // max track restart/reset
59 
60 	Chall();
61 };
62 
63 
64 ///-----  all challenges
65 //
66 class ChallXml
67 {
68 public:
69 	std::vector<Chall> all;
70 
71 	bool LoadXml(std::string file, class TracksXml* times, bool check);
72 	ChallXml();
73 };
74 
75 
76 //  progress on single track
77 class ProgressTrackL
78 {
79 public:
80 	float points, time;  int pos;  // got after stage
81 	ProgressTrackL();
82 };
83 
84 //  progress on championship
85 class ProgressChall
86 {
87 public:
88 	std::string car;  // picked car at start
89 	int curTrack;  // index to trks
90 	float avgPoints, totalTime, avgPos;  // computed from all stages
91 	int fin;  // final prize -1 none, 0 bronze, 1 silver, 2 gold
92 
93 	std::string name;
94 	int ver;
95 
96 	std::vector<ProgressTrackL> trks;
97 	ProgressChall();
98 };
99 
100 
101 ///-----  progress L=challenges
102 //
103 class ProgressLXml
104 {
105 public:
106 	std::vector<ProgressChall> chs;
107 	bool LoadXml(std::string file), SaveXml(std::string file);
108 };
109