… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /** |
25 | /** |
… | |
… | |
177 | * client/server bandwidth (client could keep track of various strings |
178 | * client/server bandwidth (client could keep track of various strings |
178 | */ |
179 | */ |
179 | void |
180 | void |
180 | new_draw_info_format (int flags, int pri, const object *pl, const char *format, ...) |
181 | new_draw_info_format (int flags, int pri, const object *pl, const char *format, ...) |
181 | { |
182 | { |
182 | char buf[HUGE_BUF]; |
|
|
183 | |
|
|
184 | va_list ap; |
183 | va_list ap; |
185 | va_start (ap, format); |
184 | va_start (ap, format); |
186 | vsnprintf (buf, HUGE_BUF, format, ap); |
185 | new_draw_info (flags, pri, pl, vformat (format, ap)); |
187 | va_end (ap); |
186 | va_end (ap); |
188 | |
|
|
189 | new_draw_info (flags, pri, pl, buf); |
|
|
190 | } |
187 | } |
191 | |
188 | |
192 | void |
189 | void |
193 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
190 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
194 | { |
191 | { |
… | |
… | |
215 | } |
212 | } |
216 | |
213 | |
217 | void |
214 | void |
218 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
215 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
219 | { |
216 | { |
220 | char buf[HUGE_BUF]; |
217 | va_list ap; |
|
|
218 | va_start (ap, new_format); |
221 | |
219 | |
222 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
220 | if (!pl || !pl->is_player ()) |
223 | return; |
221 | return; |
224 | |
222 | |
|
|
223 | // TODO: just assume, and rip out? |
225 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
224 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
226 | { |
225 | { |
227 | va_list ap; |
|
|
228 | |
|
|
229 | LOG (llevDebug, "Non supported extension text type for client.\n"); |
226 | LOG (llevDebug, "Non supported extension text type for client.\n"); |
230 | va_start (ap, new_format); |
|
|
231 | vsnprintf (buf, HUGE_BUF, old_format, ap); |
|
|
232 | va_end (ap); |
|
|
233 | new_draw_info (flags, pri, pl, buf); |
227 | new_draw_info (flags, pri, pl, vformat (old_format, ap)); |
234 | return; |
|
|
235 | } |
228 | } |
236 | else |
229 | else |
237 | { |
230 | { |
238 | va_list ap; |
231 | char *buf = vformat (new_format, ap); |
239 | |
|
|
240 | va_start (ap, new_format); |
|
|
241 | vsnprintf (buf, HUGE_BUF, new_format, ap); |
|
|
242 | va_end (ap); |
|
|
243 | strip_media_tag (buf); |
232 | strip_media_tag (buf); |
244 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf); |
233 | esrv_print_ext_msg (pl->contr->ns, flags & NDI_COLOR_MASK, type, subtype, buf); |
245 | } |
234 | } |
|
|
235 | |
|
|
236 | va_end (ap); |
246 | } |
237 | } |
247 | |
238 | |
248 | /** |
239 | /** |
249 | * Writes to everyone on the map *except* op. This is useful for emotions. |
240 | * Writes to everyone on the map *except* op. This is useful for emotions. |
250 | */ |
241 | */ |