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,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * 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 Affero GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
20 | * <http://www.gnu.org/licenses/>. |
21 | * |
21 | * |
22 | * 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> |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <living.h> |
26 | #include <living.h> |
… | |
… | |
476 | */ |
476 | */ |
477 | static const char * |
477 | static const char * |
478 | ring_desc (const object *op) |
478 | ring_desc (const object *op) |
479 | { |
479 | { |
480 | static dynbuf_text buf; buf.clear (); |
480 | static dynbuf_text buf; buf.clear (); |
481 | int attr, val, len; |
481 | int attr, val; |
482 | |
482 | |
483 | if (op->flag [FLAG_IDENTIFIED]) |
483 | if (op->flag [FLAG_IDENTIFIED]) |
484 | { |
484 | { |
485 | for (attr = 0; attr < NUM_STATS; attr++) |
485 | for (attr = 0; attr < NUM_STATS; attr++) |
486 | if ((val = op->stats.stat (attr))) |
486 | if ((val = op->stats.stat (attr))) |
… | |
… | |
620 | * It is also used by examine/ex and similar functions. |
620 | * It is also used by examine/ex and similar functions. |
621 | */ |
621 | */ |
622 | const char * |
622 | const char * |
623 | query_name (const object *op) |
623 | query_name (const object *op) |
624 | { |
624 | { |
625 | int len = 0; |
|
|
626 | static dynbuf_text bufs[5]; |
625 | static dynbuf_text bufs[5]; |
627 | static int use_buf = 0; |
626 | static int use_buf = 0; |
628 | |
627 | |
629 | use_buf++; |
628 | use_buf++; |
630 | use_buf %= 5; |
629 | use_buf %= 5; |
… | |
… | |
1353 | else if (inv |
1352 | else if (inv |
1354 | && inv->msg |
1353 | && inv->msg |
1355 | && inv->type == SPELL |
1354 | && inv->type == SPELL |
1356 | && flag [FLAG_IDENTIFIED] |
1355 | && flag [FLAG_IDENTIFIED] |
1357 | && (type == SPELLBOOK || type == ROD || type == WAND |
1356 | && (type == SPELLBOOK || type == ROD || type == WAND |
1358 | || type == ROD || type == POTION || type == SCROLL)) |
1357 | || type == POTION || type == SCROLL)) |
1359 | // for spellbooks and other stuff that contains spells, print the spell message, |
1358 | // for spellbooks and other stuff that contains spells, print the spell message, |
1360 | // unless the object has a custom message handled above. |
1359 | // unless the object has a custom message handled above. |
1361 | buf << '\r' << inv->msg << '\n'; |
1360 | buf << '\r' << inv->msg << '\n'; |
1362 | |
1361 | |
1363 | // try to display the duration for some potions and scrolls |
1362 | // try to display the duration for some potions and scrolls |