Changeset 812

Show
Ignore:
Timestamp:
03/21/08 12:54:00 (7 months ago)
Author:
GabeCunningham
Message:

Fix #544: dtrap borders should work correctly now at the edge of the map. Also, the DTrap indicator now turns yellow when you are standing on the border.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cave.c

    r808 r812  
    581581 * Checks if a square is at the (inner) edge of a trap detect area  
    582582 */  
    583 static bool dtrap_edge(int y, int x)  
     583bool dtrap_edge(int y, int x)  
    584584{  
    585585        /* Check if the square is a dtrap in the first place */  
     
    587587 
    588588        /* Check for non-dtrap adjacent grids */  
    589         if (in_bounds(y + 1, x    ) && (!cave_info2[y + 1][x    ] & CAVE2_DTRAP)) return TRUE;  
    590         if (in_bounds(y    , x + 1) && (!cave_info2[y    ][x + 1] & CAVE2_DTRAP)) return TRUE;  
    591         if (in_bounds(y - 1, x    ) && (!cave_info2[y - 1][x    ] & CAVE2_DTRAP)) return TRUE;  
    592         if (in_bounds(y    , x - 1) && (!cave_info2[y    ][x - 1] & CAVE2_DTRAP)) return TRUE;  
     589        if (in_bounds_fully(y + 1, x    ) && (!cave_info2[y + 1][x    ] & CAVE2_DTRAP)) return TRUE;  
     590        if (in_bounds_fully(y    , x + 1) && (!cave_info2[y    ][x + 1] & CAVE2_DTRAP)) return TRUE;  
     591        if (in_bounds_fully(y - 1, x    ) && (!cave_info2[y - 1][x    ] & CAVE2_DTRAP)) return TRUE;  
     592        if (in_bounds_fully(y    , x - 1) && (!cave_info2[y    ][x - 1] & CAVE2_DTRAP)) return TRUE;  
    593593 
    594594        return FALSE;  
  • trunk/src/externs.h

    r810 r812  
    310310extern void disturb(int stop_search, int unused_flag); 
    311311extern bool is_quest(int level); 
     312extern bool dtrap_edge(int y, int x); 
    312313 
    313314/* cmd1.c */ 
  • trunk/src/xtra3.c

    r698 r812  
    832832        if (info & (CAVE2_DTRAP)) 
    833833        { 
    834                 c_put_str(TERM_GREEN, "DTrap", row, col); 
     834                /* The player is on the border */ 
     835                if (dtrap_edge(p_ptr->py, p_ptr->px)) 
     836                        c_put_str(TERM_YELLOW, "DTrap", row, col); 
     837                else 
     838                        c_put_str(TERM_GREEN, "DTrap", row, col); 
     839 
    835840                return 5; 
    836841        }