1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 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 | /** |
… | |
… | |
139 | /** |
140 | /** |
140 | * Sends message to player(s). |
141 | * Sends message to player(s). |
141 | * |
142 | * |
142 | * flags is various flags - mostly color, plus a few specials. |
143 | * flags is various flags - mostly color, plus a few specials. |
143 | * |
144 | * |
144 | * pri is priority. It is a little odd - the lower the value, the more |
145 | * pri is unused. |
145 | * important it is. Thus, 0 gets sent no matter what. Otherwise, the |
|
|
146 | * value must be less than the listening level that the player has set. |
|
|
147 | * Unfortunately, there is no clear guideline on what each level does what. |
|
|
148 | * |
146 | * |
149 | * pl can be passed as NULL - in fact, this will be done if NDI_ALL is set |
147 | * pl can be passed as NULL - in fact, this will be done if NDI_ALL is set |
150 | * in the flags. |
148 | * in the flags. |
151 | * |
149 | * |
152 | * If message is black, and not NDI_UNIQUE, gets sent through output buffers. |
150 | * If message is black, and not NDI_UNIQUE, gets sent through output buffers. |
… | |
… | |
156 | new_draw_info (int flags, int pri, const object *op, const char *buf) |
154 | new_draw_info (int flags, int pri, const object *op, const char *buf) |
157 | { |
155 | { |
158 | if (flags & NDI_ALL) |
156 | if (flags & NDI_ALL) |
159 | { |
157 | { |
160 | for_all_players (pl) |
158 | for_all_players (pl) |
161 | new_draw_info (flags & ~NDI_ALL, pri, pl->ob, buf); |
159 | new_draw_info (flags & ~NDI_ALL, 0, pl->ob, buf); |
162 | } |
160 | } |
163 | else |
161 | else |
164 | { |
162 | { |
165 | if (!op || !op->contr || !op->contr->ns) |
163 | if (!op || !op->contr || !op->contr->ns) |
166 | return; |
|
|
167 | |
|
|
168 | if (pri >= op->contr->listening) |
|
|
169 | return; |
164 | return; |
170 | |
165 | |
171 | if ((flags & (NDI_COLOR_MASK | NDI_UNIQUE)) != NDI_BLACK |
166 | if ((flags & (NDI_COLOR_MASK | NDI_UNIQUE)) != NDI_BLACK |
172 | || !op->contr->ns->msg_suppressed (buf)) |
167 | || !op->contr->ns->msg_suppressed (buf)) |
173 | print_message (flags & NDI_COLOR_MASK, op, buf); |
168 | print_message (flags & NDI_COLOR_MASK, op, buf); |
… | |
… | |
198 | void |
193 | void |
199 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
194 | draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) |
200 | { |
195 | { |
201 | |
196 | |
202 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
197 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
203 | return; |
|
|
204 | |
|
|
205 | if (pri >= pl->contr->listening) |
|
|
206 | return; |
198 | return; |
207 | |
199 | |
208 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
200 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
209 | { |
201 | { |
210 | char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); |
202 | char *buf = (char *) malloc (strlen (oldmessage == NULL ? message : oldmessage) + 1); |
… | |
… | |
227 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
219 | draw_ext_info_format (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *old_format, char *new_format, ...) |
228 | { |
220 | { |
229 | char buf[HUGE_BUF]; |
221 | char buf[HUGE_BUF]; |
230 | |
222 | |
231 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
223 | if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) |
232 | return; |
|
|
233 | |
|
|
234 | if (pri >= pl->contr->listening) |
|
|
235 | return; |
224 | return; |
236 | |
225 | |
237 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
226 | if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) |
238 | { |
227 | { |
239 | va_list ap; |
228 | va_list ap; |