equal
deleted
inserted
replaced
11 #include "player.h" |
11 #include "player.h" |
12 #include "signs.h" |
12 #include "signs.h" |
13 #include "saveload.h" |
13 #include "saveload.h" |
14 #include "command.h" |
14 #include "command.h" |
15 #include "variables.h" |
15 #include "variables.h" |
|
16 #include "string.h" |
16 #include "misc/autoptr.hpp" |
17 #include "misc/autoptr.hpp" |
17 |
18 |
18 SignID _new_sign_id; |
19 SignID _new_sign_id; |
19 uint _total_signs; |
20 uint _total_signs; |
20 |
21 |
26 this->str = string; |
27 this->str = string; |
27 } |
28 } |
28 |
29 |
29 Sign::~Sign() |
30 Sign::~Sign() |
30 { |
31 { |
31 this->QuickFree(); |
32 DeleteName(this->str); |
32 this->str = STR_NULL; |
33 this->str = STR_NULL; |
33 } |
|
34 |
|
35 void Sign::QuickFree() |
|
36 { |
|
37 DeleteName(this->str); |
|
38 } |
34 } |
39 |
35 |
40 /** |
36 /** |
41 * |
37 * |
42 * Update the coordinate of one sign |
38 * Update the coordinate of one sign |
131 { |
127 { |
132 if (!IsValidSignID(p1)) return CMD_ERROR; |
128 if (!IsValidSignID(p1)) return CMD_ERROR; |
133 |
129 |
134 /* If _cmd_text 0 means the new text for the sign is non-empty. |
130 /* If _cmd_text 0 means the new text for the sign is non-empty. |
135 * So rename the sign. If it is empty, it has no name, so delete it */ |
131 * So rename the sign. If it is empty, it has no name, so delete it */ |
136 if (_cmd_text[0] != '\0') { |
132 if (!StrEmpty(_cmd_text)) { |
137 /* Create the name */ |
133 /* Create the name */ |
138 StringID str = AllocateName(_cmd_text, 0); |
134 StringID str = AllocateName(_cmd_text, 0); |
139 if (str == 0) return CMD_ERROR; |
135 if (str == 0) return CMD_ERROR; |
140 |
136 |
141 if (flags & DC_EXEC) { |
137 if (flags & DC_EXEC) { |