| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <string> |
| 4 |
#include <memory> |
| 5 |
#include <wx/dataview.h> |
| 6 |
|
| 7 |
namespace difficulty |
| 8 |
{ |
| 9 |
|
| 10 |
/** |
| 11 |
* greebo: A Setting represents a spawnarg change. |
| 12 |
* This can be an assignment, addition, multiplication or NOP (ignore). |
| 13 |
*/ |
| 14 |
class Setting |
| 15 |
{ |
| 16 |
public: |
| 17 |
enum EApplicationType { |
| 18 |
EAssign, |
| 19 |
EAdd, |
| 20 |
EMultiply, |
| 21 |
EIgnore, |
| 22 |
ENumAppTypes, |
| 23 |
}; |
| 24 |
|
| 25 |
// ID of this setting (unique for each difficulty level) |
| 26 |
int id; |
| 27 |
|
| 28 |
// The classname this setting applies to |
| 29 |
std::string className; |
| 30 |
|
| 31 |
// The target spawnarg to be changed |
| 32 |
std::string spawnArg; |
| 33 |
|
| 34 |
// The parsed argument (the specifier (+/*) has already been removed) |
| 35 |
std::string argument; |
| 36 |
|
| 37 |
// How the argument should be applied |
| 38 |
EApplicationType appType; |
| 39 |
|
| 40 |
// Whether this setting is a default setting or map-specific |
| 41 |
bool isDefault; |
| 42 |
|
| 43 |
// The tree iter this setting is stored at |
| 44 |
wxDataViewItem iter; |
| 45 |
|
| 46 |
// Constructor (assigns a unique ID automatically) |
| 47 |
Setting(); |
| 48 |
|
| 49 |
// Comparison operators, return true if spawnarg/classname/argument/appType are the same |
| 50 |
bool operator==(const Setting& rhs) const; |
| 51 |
bool operator!=(const Setting& rhs) const; |
| 52 |
|
| 53 |
// Assignment operator (leaves the ID untouched) |
| 54 |
Setting& operator=(const Setting& rhs); |
| 55 |
|
| 56 |
// Interprets the argument string |
| 57 |
void parseAppType(); |
| 58 |
|
| 59 |
// Get the string suitable for saving to a spawnarg (e.g. "+50") |
| 60 |
std::string getArgumentKeyValue() const; |
| 61 |
|
| 62 |
// Assemble a description string for the contained spawnArg/argument combo. |
| 63 |
std::string getDescString() const; |
| 64 |
|
| 65 |
private: |
| 66 |
static int _highestId; |
| 67 |
}; |
| 68 |
typedef std::shared_ptr<Setting> SettingPtr; |
| 69 |
|
| 70 |
} // namespace difficulty |