Debian Codegraph @

types/legacy/legacy_describe.c

raw symbols SCIP
1 /*
2 CrossFire, A Multiplayer game for X-windows
3
4 Copyright (C) 2007 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 The authors can be reached via e-mail at [email protected]
22 */
23 #include <global.h>
24 #include <ob_methods.h>
25 #include <ob_types.h>
26 /** @file legacy_describe.c
27 * Legacy implementation of description-related methods.
28 */
29
30 /**
31 * Describes an object, seen by a given observer.
32 * @param context The method context
33 * @param op The object to describe
34 * @param observer The object to make the description to
35 * @param use_media_tags If non zero then use media tags in the description.
36 * @param buf Buffer that will contain the description
37 * @param size buf's size.
38 */
39 void legacy_ob_describe(const ob_methods *context, const object *op, const object *observer, int use_media_tags, char *buf, size_t size) {
40 buf[0] = '\0';
41 if (op == NULL)
42 return;
43
44 switch (op->type) {
45 case RING:
46 case SKILL:
47 case WEAPON:
48 case ARMOUR:
49 case BRACERS:
50 case HELMET:
51 case SHIELD:
52 case BOOTS:
53 case GLOVES:
54 case AMULET:
55 case GIRDLE:
56 case BOW:
57 case ARROW:
58 case CLOAK:
59 case FOOD:
60 case DRINK:
61 case FLESH:
62 case SKILL_TOOL:
63 case LAMP:
64 common_ob_describe(context, op, observer, use_media_tags, buf, size);
65 return;
66
67 default:
68 if (buf[0] == '\0') {
69 query_name(op, buf, size-1);
70 buf[size-1] = 0;
71 }
72 return;
73 }
74 }