MCPcopy Create free account
hub / github.com/crawl/crawl / read_symbol

Function read_symbol

crawl-ref/source/initfile.cc:1746–1772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1744}
1745
1746static int read_symbol(string s)
1747{
1748 if (s.empty())
1749 return 0;
1750
1751 if (s.length() > 1 && s[0] == '\\')
1752 s = s.substr(1);
1753
1754 {
1755 char32_t c;
1756 const char *nc = s.c_str();
1757 nc += utf8towc(&c, nc);
1758 // no control, combining or CJK characters, please
1759 if (!*nc && wcwidth(c) == 1)
1760 return c;
1761 }
1762
1763 int base = 10;
1764 if (s.length() > 1 && s[0] == 'x')
1765 {
1766 s = s.substr(1);
1767 base = 16;
1768 }
1769
1770 char *tail;
1771 return strtoul(s.c_str(), &tail, base);
1772}
1773
1774void game_options::set_fire_order_ability(const string &s, bool append, bool remove)
1775{

Callers 2

parse_mon_glyphMethod · 0.85
initfile.ccFile · 0.85

Calls 4

utf8towcFunction · 0.85
wcwidthFunction · 0.85
substrMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected