• R/O
  • SSH
  • HTTPS

junnethack: Commit


Commit MetaInfo

Revision338 (tree)
Time2010-10-06 22:56:00
Authorso-miya

Log Message

UnNetHack SVN版rev.680, 681を適用した。
r680
changing color of monster with config line: MONSTERCOLOR=acid blog:lightcyan
「MONSTERCOLOR=acid blob:lightcyan」のように設定することで怪物の色を変更可能とした

r681
typo: acid blog -> acid blob

Change Summary

Incremental Difference

--- junnethack/trunk/include/extern.h (revision 337)
+++ junnethack/trunk/include/extern.h (revision 338)
@@ -1506,6 +1506,7 @@
15061506 #ifdef MENU_COLOR
15071507 E boolean FDECL(add_menu_coloring, (char *));
15081508 #endif /* MENU_COLOR */
1509+E boolean FDECL(parse_monster_color, (char *));
15091510
15101511 /* ### pager.c ### */
15111512
--- junnethack/trunk/src/files.c (revision 337)
+++ junnethack/trunk/src/files.c (revision 338)
@@ -2020,6 +2020,8 @@
20202020 #ifdef MENU_COLOR
20212021 (void) add_menu_coloring(bufp);
20222022 #endif
2023+ } else if (match_varname(buf, "MONSTERCOLOR", 12)) {
2024+ return parse_monster_color(bufp);
20232025 } else if (match_varname(buf, "GRAPHICS", 4)) {
20242026 len = get_uchars(fp, buf, bufp, translate, FALSE,
20252027 MAXPCHARS, "GRAPHICS");
--- junnethack/trunk/src/options.c (revision 337)
+++ junnethack/trunk/src/options.c (revision 338)
@@ -1603,6 +1603,59 @@
16031603 }
16041604 #endif /* MENU_COLOR */
16051605
1606+/* parse '"monster name":color' and change monster info accordingly */
1607+boolean
1608+parse_monster_color(str)
1609+char *str;
1610+{
1611+ int i, c = NO_COLOR;
1612+ char *tmps, *cs = strchr(str, ':');
1613+ char buf[BUFSZ];
1614+ int monster;
1615+
1616+ if (!str) return FALSE;
1617+
1618+ strncpy(buf, str, BUFSZ);
1619+ cs = strchr(buf, ':');
1620+ if (!cs) return FALSE;
1621+
1622+ tmps = cs;
1623+ tmps++;
1624+ /* skip whitespace at start of string */
1625+ while (*tmps && isspace(*tmps)) tmps++;
1626+
1627+ /* determine color */
1628+ for (i = 0; i < SIZE(colornames); i++)
1629+ if (strstri(tmps, colornames[i].name) == tmps) {
1630+ c = colornames[i].color;
1631+ break;
1632+ }
1633+ if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9'))
1634+ c = atoi(tmps);
1635+
1636+ if (c > 15) return FALSE;
1637+
1638+ /* determine monster name */
1639+ *cs = '\0';
1640+ tmps = buf;
1641+ if ((*tmps == '"') || (*tmps == '\'')) {
1642+ cs--;
1643+ while (isspace(*cs)) cs--;
1644+ if (*cs == *tmps) {
1645+ *cs = '\0';
1646+ tmps++;
1647+ }
1648+ }
1649+
1650+ monster = name_to_mon(tmps);
1651+ if (monster > -1) {
1652+ mons[monster].mcolor = c;
1653+ return TRUE;
1654+ } else {
1655+ return FALSE;
1656+ }
1657+}
1658+
16061659 void
16071660 common_prefix_options_parser(fullname, opts, negated)
16081661 const char *fullname;
--- junnethack/trunk/ChangeLog (revision 337)
+++ junnethack/trunk/ChangeLog (revision 338)
@@ -1,4 +1,8 @@
1-2010-XX-XX UnNetHack 3.5.3
1+2011-XX-XX UnNetHack 3.5.4
2+ * changing color of monster with config line:
3+ MONSTERCOLOR=acid blob:lightcyan
4+
5+2010-09-04 UnNetHack 3.5.3
26 * Conflict makes blackmarket shopkeeper angry
37 * Fully eroded armor gets destroyed
48 * Lowered the needed experience level for the quest
Show on old repository browser