1 #pragma once 2 #include <vector> 3 #include <map> 4 #include <string> 5 6 namespace tinyxml2 { class XMLElement; } 7 8 9 struct Date 10 { 11 int day,month,year; 12 bool operator < (const Date& d) const 13 { 14 return year < d.year && month < d.month && day < d.day; 15 } DateDate16 Date() : day(1),month(1),year(10) { } 17 }; 18 19 20 // Track's additional info 21 // shown on gui [Track] tab, in detailed view 22 // for sorting by date, difficulty, etc. 23 //-------------------------------------------------------------------- 24 class TrackInfo 25 { 26 public: 27 int n; // unique id for track, from ini 28 float crtver; // created in ver 29 int ver; // x10 30 std::string name, nshrt, scenery, author; 31 Date created, modified; 32 33 // track characteristics (char) 34 int fluids,bumps, jumps,loops,pipes; 35 int banked,frenzy,longn, objects,obstacles; 36 int diff, rating, sum; 37 38 int nn; // number got from name eg. for D15-.. it is 15 39 bool test,testC; // starts with Test.. or TestC.. 40 bool vdrift; // from author name 41 42 TrackInfo(); 43 }; 44 45 46 // all tracks infos 47 //................................. 48 class TracksXml 49 { 50 public: 51 std::vector<TrackInfo> trks; 52 std::map<std::string, int> trkmap; // 0 if not found 53 std::map<std::string, float> times; // track times 54 55 int cntAll; 56 bool LoadIni(std::string file, bool check); TracksXml()57 TracksXml() 58 :cntAll(0) 59 { } 60 }; 61 62 63 // user Track's info 64 // rating, stats ... not yet used 65 //------------------------------------- 66 class UserTrkInfo 67 { 68 public: 69 std::string name; 70 int rating; 71 Date last; // driven 72 int laps; float time; 73 74 UserTrkInfo(); 75 }; 76 77 78 // user xml (tracks) 79 class UserXml 80 { 81 public: 82 std::vector<UserTrkInfo> trks; 83 std::map<std::string, int> trkmap; // 0 if not found 84 85 // methods 86 bool LoadXml(std::string file), SaveXml(std::string file); UserXml()87 UserXml() { } 88 }; 89 90 91 // Car's additional info 92 // shown on gui [Car] tab, in detailed view 93 // for sorting by speed, type, etc. 94 //-------------------------------------------------------------------- 95 class CarInfo 96 { 97 public: 98 std::string id, type, author; 99 bool car; 100 101 float speed; 102 int n, year, rating; 103 104 // time mul factors, for race postion, in sim modes 105 float easy, norm; 106 107 CarInfo(); 108 }; 109 110 111 // all cars infos 112 //................................. 113 class CarsXml 114 { 115 public: 116 std::vector<CarInfo> cars; 117 std::map<std::string, int> carmap; // 0 if not found 118 std::map<std::string, std::string> colormap; // car type to list color 119 float magic; 120 121 // methods 122 bool LoadXml(std::string file); CarsXml()123 CarsXml() 124 :magic(0.010f) 125 { } 126 }; 127 128 129 // car colors.ini for Gui 130 //-------------------------------------------------------------------- 131 class CarColor 132 { 133 public: 134 float hue, sat, val, refl, gloss; 135 }; 136 137 138 // all colors 139 class ColorsXml 140 { 141 public: 142 std::vector<CarColor> v; 143 int perRow, imgSize; // gui params 144 145 // methods 146 bool LoadIni(std::string file); ColorsXml()147 ColorsXml() 148 :perRow(12), imgSize(18) 149 { } 150 }; 151 152 153 // Reverb presets on sceneries ed combo 154 //-------------------------------------------------------------------- 155 struct ReverbSet 156 { 157 std::string name, descr, // info 158 normal, cave, cavebig, pipe, pipebig, influid; // reverb preset names 159 }; 160 161 class ReverbsXml 162 { 163 public: 164 ReverbSet base; // inherited defaults if not set 165 std::vector<ReverbSet> revs; 166 std::map<std::string, int> revmap; // 0 if not found 167 168 // methods 169 bool LoadXml(std::string file); 170 void GetParams(tinyxml2::XMLElement* e, ReverbSet& r); ReverbsXml()171 ReverbsXml() 172 { } 173 }; 174