… | |
… | |
184 | va_start (ap, format); |
184 | va_start (ap, format); |
185 | new_draw_info (flags, pri, pl, vformat (format, ap)); |
185 | new_draw_info (flags, pri, pl, vformat (format, ap)); |
186 | va_end (ap); |
186 | va_end (ap); |
187 | } |
187 | } |
188 | |
188 | |
189 | void |
|
|
190 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
|
|
191 | { |
|
|
192 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
|
|
193 | return; |
|
|
194 | |
|
|
195 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
|
|
196 | { |
|
|
197 | char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); |
|
|
198 | |
|
|
199 | if (buf == NULL) |
|
|
200 | LOG (llevError, "info::draw_ext_info -> Out of memory!"); |
|
|
201 | else |
|
|
202 | { |
|
|
203 | strcpy (buf, oldmessage == NULL ? message : oldmessage); |
|
|
204 | strip_media_tag (buf); |
|
|
205 | new_draw_info (flags, pri, pl, buf); |
|
|
206 | free (buf); |
|
|
207 | } |
|
|
208 | } |
|
|
209 | else |
|
|
210 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, message); |
|
|
211 | } |
|
|
212 | |
|
|
213 | void |
|
|
214 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
|
|
215 | { |
|
|
216 | va_list ap; |
|
|
217 | va_start (ap, new_format); |
|
|
218 | |
|
|
219 | if (!pl || !pl->is_player ()) |
|
|
220 | return; |
|
|
221 | |
|
|
222 | // TODO: just assume, and rip out? |
|
|
223 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
|
|
224 | { |
|
|
225 | LOG (llevDebug, "Non supported extension text type for client.\n"); |
|
|
226 | new_draw_info (flags, pri, pl, vformat (old_format, ap)); |
|
|
227 | } |
|
|
228 | else |
|
|
229 | { |
|
|
230 | char *buf = vformat (new_format, ap); |
|
|
231 | strip_media_tag (buf); |
|
|
232 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf); |
|
|
233 | } |
|
|
234 | |
|
|
235 | va_end (ap); |
|
|
236 | } |
|
|
237 | |
|
|
238 | /** |
189 | /** |
239 | * Writes to everyone on the map *except* op. This is useful for emotions. |
190 | * Writes to everyone on the map *except* op. This is useful for emotions. |
240 | */ |
191 | */ |
241 | void |
192 | void |
242 | new_info_map_except (int color, maptile * map, object *op, const char *str) |
193 | new_info_map_except (int color, maptile * map, object *op, const char *str) |