1 | #pragma once |
---|
2 | |
---|
3 | struct ConfigParms { |
---|
4 | unsigned int stopCost; // amount to charge per train stop |
---|
5 | unsigned int numStudents; // number of students to create |
---|
6 | unsigned int numStops; // number of train stops; minimum of 2 |
---|
7 | unsigned int maxNumStudents; // maximum students each train can carry |
---|
8 | unsigned int timerDelay; // length of time between each tick of the timer |
---|
9 | unsigned int maxStudentDelay; // maximum random student delay between trips |
---|
10 | unsigned int maxStudentTrips; // maximum number of train trips each student takes |
---|
11 | unsigned int groupoffDelay; // length of time between initializing gift cards |
---|
12 | unsigned int conductorDelay; // length of time between checking on passenger POPs |
---|
13 | unsigned int parentalDelay; // length of time between cash deposits |
---|
14 | unsigned int numCouriers; // number of WATCard office couriers in the pool |
---|
15 | }; // ConfigParms |
---|
16 | |
---|
17 | struct config_entry { |
---|
18 | const char * key; |
---|
19 | void * variable; |
---|
20 | bool (*parse)(const char *, void *); |
---|
21 | }; |
---|
22 | |
---|
23 | static inline void ?{}( config_entry & this ) {} |
---|
24 | |
---|
25 | forall(T & | { bool parse(const char *, T & ); }) |
---|
26 | static inline void ?{}( config_entry & this, const char * key, T & variable ) { |
---|
27 | this.key = key; |
---|
28 | this.variable = (void *)&variable; |
---|
29 | this.parse = (bool (*)(const char *, void *))parse; |
---|
30 | } |
---|
31 | |
---|
32 | forall(T &) |
---|
33 | static inline void ?{}( config_entry & this, const char * key, T & variable, bool (*parse)(const char *, T &) ) { |
---|
34 | this.key = key; |
---|
35 | this.variable = (void *)&variable; |
---|
36 | this.parse = (bool (*)(const char *, void *))parse; |
---|
37 | } |
---|
38 | |
---|
39 | void parse_config( const char * config_file, config_entry entries[], size_t num_entries ); |
---|
40 | |
---|
41 | // Local Variables: // |
---|
42 | // mode: c // |
---|
43 | // tab-width: 4 // |
---|
44 | // End: // |
---|