• R/O
  • SSH
  • HTTPS

junnethack: Commit


Commit MetaInfo

Revisión404 (tree)
Tiempo2011-03-14 16:06:38
Autorso-miya

Log Message

UnNetHack SVN版rev.766を適用した。
Autoexplore: Heuristically determine if player is done exploring or not
自動探索:探索が完了しているかどうかは発見的に決定する

Cambiar Resumen

Diferencia

--- junnethack/trunk/src/hack.c (revision 403)
+++ junnethack/trunk/src/hack.c (revision 404)
@@ -1520,6 +1520,31 @@
15201520 return couldsee(x, y);
15211521 }
15221522
1523+/** Returns if (x,y) could be explored.
1524+ * Differs from unexplore() in that it is uses information not
1525+ * available to the player.
1526+ * It should only leak information about "obvious" coordinates, e.g.
1527+ * unexplored rooms or big areas not reachable by the player. */
1528+static boolean
1529+interesting_to_explore(x,y) {
1530+ if (!goodpos(x, y, &youmonst, 0)) return FALSE;
1531+
1532+ if (!unexplored(x, y)) return FALSE;
1533+
1534+ /* don't leak information about secret locations */
1535+ if (levl[x][y].typ == SCORR ||
1536+ levl[y][y].typ == SDOOR) {
1537+ return FALSE;
1538+ }
1539+ /* don't leak information about gold vaults */
1540+ if (*in_rooms(x,y,VAULT)) return FALSE;
1541+
1542+ /* corridor are uninteresting */
1543+ if (levl[y][y].typ == CORR) return FALSE;
1544+
1545+ return TRUE;
1546+}
1547+
15231548 void
15241549 domove()
15251550 {
@@ -1580,14 +1605,39 @@
15801605 u.tx = u.ux;
15811606 u.ty = u.uy;
15821607 if (!findtravelpath(unexplored)) {
1608+ char msg[BUFSZ];
1609+ int unexplored_cnt=0, i, j;
1610+ /* check if this level has been thoroughly explored */
1611+ for (i=1; i < COLNO; i++) {
1612+ for (j=0; j < ROWNO; j++) {
1613+ if (interesting_to_explore(i,j)) {
1614+ unexplored_cnt++;
1615+ }
1616+ }
1617+ }
15831618 iflags.autoexplore = FALSE;
15841619 /* TODO: Check if really done (known closed doors,
15851620 * boulders blocking your way) and offer doing
15861621 * travel when done */
1622+ if (unexplored_cnt > 0) {
1623+ if (wizard) {
15871624 /*JP
1588- pline("Done exploring.");
1625+ Sprintf(msg, "Partly explored, can't reach %d places.", unexplored_cnt);
15891626 */
1590- pline("探索し終わった。");
1627+ Sprintf(msg, "ある程度探索したが、%d箇所行けない場所がある。", unexplored_cnt);
1628+ } else {
1629+/*JP
1630+ Strcpy(msg, "Partly explored, can't reach some places.");
1631+*/
1632+ Strcpy(msg, "ある程度探索したが、何箇所か行けない場所がある。");
1633+ }
1634+ } else {
1635+/*JP
1636+ Strcpy(msg, "Done exploring.");
1637+*/
1638+ Strcpy(msg, "探索し終わった。");
1639+ }
1640+ pline("%s", msg);
15911641 }
15921642 } else if (!findtravelpath(NULL)) {
15931643 (void) findtravelpath(couldsee_func);
Show on old repository browser