MCPcopy Create free account
hub / github.com/NetHack/NetHack / tilename

Function tilename

win/share/tilemap.c:193–535  ·  view source on GitHub ↗

* file_entry is the position of the tile within the monsters/objects/other set */

Source from the content-addressed store, hash-verified

191 * file_entry is the position of the tile within the monsters/objects/other set
192 */
193const char *
194tilename(int set, const int file_entry, int gend UNUSED)
195{
196 int i, k, cmap, condnum, tilenum;
197 static char buf[BUFSZ];
198#if 0
199 int offset, gendnum;
200#endif
201 (void) def_char_to_objclass(']');
202
203 tilenum = 0;
204
205 buf[0] = '\0';
206 if (set == MON_GLYPH) {
207 for (i = 0; i < NUMMONS; i++) {
208 if (tilenum == file_entry) {
209 if (mons[i].pmnames[MALE])
210 Snprintf(buf, sizeof buf, "%s {%s}",
211 mons[i].pmnames[NEUTRAL], mons[i].pmnames[MALE]);
212 else
213 Snprintf(buf, sizeof buf, "%s", mons[i].pmnames[NEUTRAL]);
214 return buf;
215 }
216 tilenum++;
217 if (tilenum == file_entry) {
218 if (mons[i].pmnames[FEMALE])
219 Snprintf(buf, sizeof buf, "%s {%s}",
220 mons[i].pmnames[NEUTRAL],
221 mons[i].pmnames[FEMALE]);
222 else
223 Snprintf(buf, sizeof buf, "%s", mons[i].pmnames[NEUTRAL]);
224 return buf;
225 }
226 for (condnum = 0; conditionals[condnum].sequence != -1;
227 ++condnum) {
228 if (conditionals[condnum].sequence == MON_GLYPH
229 && conditionals[condnum].predecessor == i) {
230 for (k = 0; k < 2; k++) { /* male and female */
231 tilenum++;
232 if (tilenum == file_entry)
233 return conditionals[condnum].name;
234 }
235 }
236 }
237 tilenum++;
238 }
239 if (tilenum == file_entry)
240 return "invisible monster";
241 } /* MON_GLYPH */
242
243 if (set == OBJ_GLYPH) {
244 tilenum = 0; /* set-relative number */
245 for (i = 0; i < NUM_OBJECTS; i++) {
246 /* prefer to give the description - that's all the tile's
247 * appearance should reveal */
248 if (tilenum == file_entry) {
249 if (!obj_descr[i].oc_descr)
250 return obj_descr[i].oc_name;

Callers 4

init_tilemapFunction · 0.85
read_txttileFunction · 0.85
write_txttileFunction · 0.85
mousePressEventMethod · 0.85

Calls 1

def_char_to_objclassFunction · 0.85

Tested by

no test coverage detected