equal
deleted
inserted
replaced
1 /* $Id$ */ |
|
2 |
|
3 /** @file newgrf_string_type.h */ |
|
4 |
|
5 #ifndef NEWGRF_STRING_TYPE_H |
|
6 #define NEWGRF_STRING_TYPE_H |
|
7 |
|
8 #include "strings_type.h" |
|
9 |
|
10 /** |
|
11 * A string with the required information to perform a GRF string remapping. |
|
12 */ |
|
13 struct GRFMappedStringID |
|
14 { |
|
15 private: |
|
16 /** The GRF ID associated to the to-be-remapped string */ |
|
17 uint32 grfid; |
|
18 /** The string; when grfid != 0 it should be remapped */ |
|
19 StringID string; |
|
20 |
|
21 public: |
|
22 /** |
|
23 * Create the struct. |
|
24 * @param str the string to store (or remap) |
|
25 * @param grf_id the GRF to remap it with |
|
26 */ |
|
27 GRFMappedStringID(StringID str, uint32 grf_id) : grfid(grf_id), string(str) {} |
|
28 |
|
29 /** |
|
30 * An empty string. |
|
31 */ |
|
32 GRFMappedStringID() {} |
|
33 |
|
34 /** Cast operator, returns the string */ |
|
35 inline operator StringID() const |
|
36 { |
|
37 return string; |
|
38 } |
|
39 |
|
40 /** Assigns the string and resets the GRF ID. */ |
|
41 GRFMappedStringID& operator = (StringID str) |
|
42 { |
|
43 string = str; |
|
44 grfid = 0; |
|
45 return *this; |
|
46 } |
|
47 |
|
48 /** |
|
49 * Map the string. |
|
50 */ |
|
51 void MapString(); |
|
52 }; |
|
53 |
|
54 #endif /* NEWGRF_STRING_TYPE_H */ |
|