Changeset 1425

Show
Ignore:
Timestamp:
06/01/09 19:01:29 (10 months ago)
Author:
magnate
Message:

Some further refinements to the visible monster list, per discussion on Oook.

Location:
trunk/src/monster
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/monster/monster2.c

    r1418 r1425  
    627627                        list[m_ptr->r_idx].los++; 
    628628                         
    629                         /* Check if awake and increment accordingly */ 
    630                         if (!m_ptr->csleep) list[m_ptr->r_idx].los_awake++; 
    631                 } 
    632                 /* Not in LOS so increment if awake */ 
    633                 else if (!m_ptr->csleep) list[m_ptr->r_idx].awake++; 
     629                        /* Check if asleep and increment accordingly */ 
     630                        if (m_ptr->csleep) list[m_ptr->r_idx].los_asleep++; 
     631                } 
     632                /* Not in LOS so increment if asleep */ 
     633                else if (m_ptr->csleep) list[m_ptr->r_idx].asleep++; 
    634634 
    635635                /* Bump the count for this race, and the total count */ 
     
    699699        } 
    700700 
    701         /* Message for monsters in LOS */ 
    702         prt(format("You can see %d monster%s", los_count,  
    703                 (los_count > 0 ? (los_count == 1 ? ":" : "s:") : "s.")), 0, 0); 
     701        /* Message for monsters in LOS - even if there are none */ 
     702        if (!los_count) prt(format("You can see no monsters."), 0, 0); 
     703        else prt(format("You can see %d monster%s", los_count, (los_count == 1 
     704                ? ":" : "s:")), 0, 0); 
    704705 
    705706        /* Print out in-LOS monsters in descending order */ 
     
    729730                /* Build the monster name */ 
    730731                if (list[order[i]].los == 1) 
    731                         strnfmt(buf, sizeof(buf), (list[order[i]].los_awake == 
    732                         1 ? "%s (awake) " : "%s (asleep) "), m_name); 
    733                 else strnfmt(buf, sizeof(buf), "%s (x%d, %d awake) ", m_name,  
    734                         list[order[i]].los, list[order[i]].los_awake); 
     732                        strnfmt(buf, sizeof(buf), (list[order[i]].los_asleep == 
     733                        1 ? "%s (asleep) " : "%s "), m_name); 
     734                else strnfmt(buf, sizeof(buf), (list[order[i]].los_asleep > 0 ? 
     735                        "%s (x%d, %d asleep) " : "%s (x%d)"), m_name,  
     736                        list[order[i]].los, list[order[i]].los_asleep); 
    735737 
    736738                /* Display the pict */ 
     
    751753                        /* Clear the screen */ 
    752754                        for (line = 1; line <= max; line++) 
    753                                 prt("", line, x); 
     755                                prt("", line, 0); 
    754756 
    755757                        /* Reprint Message */ 
     
    763765        } 
    764766 
    765         /* Message for monsters outside LOS */ 
    766         prt(format("You are aware of %d %smonster%s",  
     767        /* Message for monsters outside LOS, if there are any */ 
     768        if (total_count > los_count) 
     769        { 
     770                /* Leave a blank line */ 
     771                line++; 
     772                 
     773                prt(format("You are aware of %d %smonster%s",  
    767774                (total_count - los_count), (los_count > 0 ? "other " : ""),  
    768                 ((total_count - los_count) > 0 ? ((total_count - los_count) == 
    769                 1 ? ":" : "s:") : "s.")), line++, 0); 
     775                ((total_count - los_count) == 1 ? ":" : "s:")), line++, 0); 
     776        } 
    770777 
    771778        /* Print out non-LOS monsters in descending order */ 
     
    795802                /* Build the monster name */ 
    796803                if ((list[order[i]].count - list[order[i]].los) == 1) 
    797                         strnfmt(buf, sizeof(buf), (list[order[i]].awake == 
    798                         1 ? "%s (awake) " : "%s (asleep) "), m_name); 
    799                 else strnfmt(buf, sizeof(buf), "%s (x%d, %d awake) ", m_name,  
     804                        strnfmt(buf, sizeof(buf), (list[order[i]].asleep == 
     805                        1 ? "%s (asleep) " : "%s "), m_name); 
     806                else strnfmt(buf, sizeof(buf), (list[order[i]].asleep > 0 ?  
     807                        "%s (x%d, %d asleep) " : "%s (x%d) "), m_name,  
    800808                        (list[order[i]].count - list[order[i]].los), 
    801                         list[order[i]].awake); 
     809                        list[order[i]].asleep); 
    802810 
    803811                /* Display the pict */ 
     
    818826                        /* Clear the screen */ 
    819827                        for (line = 1; line <= max; line++) 
    820                                 prt("", line, x); 
     828                                prt("", line, 0); 
    821829 
    822830                        /* Reprint Message */ 
    823                         prt(format("You can see %d %smonster%s", 
     831                        prt(format("You are aware of %d %smonster%s", 
    824832                                (total_count - los_count), (los_count > 0 ? 
    825833                                "other " : ""), ((total_count - los_count) > 0 
  • trunk/src/monster/types.h

    r1418 r1425  
    161161{ 
    162162        u16b count;             /* total number of this type visible */ 
    163         u16b awake;             /* number awake */ 
     163        u16b asleep;            /* number asleep (not in LOS) */ 
    164164        u16b los;               /* number in LOS */ 
    165         u16b los_awake;         /* number awake and in LOS */ 
     165        u16b los_asleep;        /* number asleep and in LOS */ 
    166166} monster_vis;  
    167167