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

Function pi_article_skip

win/curses/cursinvt.c:263–287  ·  view source on GitHub ↗

check 'str' for an article prefix and return length of that */

Source from the content-addressed store, hash-verified

261
262/* check 'str' for an article prefix and return length of that */
263static unsigned
264pi_article_skip(const char *str)
265{
266 unsigned skip = 0; /* number of chars to skip when displaying str */
267
268 /*
269 * if (!strncmp(str, "a ", 2))
270 * skip = 2;
271 * else if (!strncmp(str, "an ", 3))
272 * skip = 3;
273 * else if (!strncmp(str, "the ", 4))
274 * skip = 4;
275 */
276 if (str[0] == 'a') {
277 if (str[1] == ' ')
278 skip = 2;
279 else if (str[1] == 'n' && str[2] == ' ')
280 skip = 3;
281 } else if (str[0] == 't') {
282 if (str[1] == 'h' && str[2] == 'e' && str[3] == ' ')
283 skip = 4;
284 }
285
286 return skip;
287}
288
289/* store an inventory item or class header but don't display anything yet */
290void

Callers 2

curs_add_invtFunction · 0.85
curs_show_invtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected