for status: set up iflags.terrain_typ, an index into terrain_descrp[]; some types need fixing up */
| 3087 | /* for status: set up iflags.terrain_typ, an index into terrain_descrp[]; |
| 3088 | some types need fixing up */ |
| 3089 | void |
| 3090 | classify_terrain(void) |
| 3091 | { |
| 3092 | struct rm *lev = &levl[u.ux][u.uy]; |
| 3093 | int typ = svl.lastseentyp[u.ux][u.uy]; /* lev->typ */ |
| 3094 | |
| 3095 | /* |
| 3096 | * If the terrain under the hero is different now from what it |
| 3097 | * was on the previous check, bring iflags.terrain_typ up to date |
| 3098 | * and request a status update. Unless hero is running--then the |
| 3099 | * update request will be suppressed. |
| 3100 | */ |
| 3101 | |
| 3102 | if (Underwater) { |
| 3103 | typ = xSUBMERGED; |
| 3104 | } else { |
| 3105 | switch (typ) { |
| 3106 | case STONE: |
| 3107 | if (svl.level.flags.arboreal) |
| 3108 | typ = TREE; |
| 3109 | break; |
| 3110 | case CORR: |
| 3111 | case ROOM: |
| 3112 | /* this matches surface() but 'floor' is odd in many places */ |
| 3113 | typ = !Is_earthlevel(&u.uz) ? xFLOOR : xGROUND; |
| 3114 | break; |
| 3115 | case DOOR: |
| 3116 | /* defaults to "doorway" (door-less or broken) */ |
| 3117 | if ((lev->doormask & D_ISOPEN) != 0) |
| 3118 | typ = xOPENDOOR; |
| 3119 | else if ((lev->doormask & (D_CLOSED | D_LOCKED | D_TRAPPED)) != 0) |
| 3120 | typ = xSHUTDOOR; |
| 3121 | break; |
| 3122 | case DRAWBRIDGE_UP: |
| 3123 | /* ICE, MOAT, LAVA, or 'STONE' (which ought to be 'room') */ |
| 3124 | typ = db_under_typ(lev->drawbridgemask); |
| 3125 | if (typ == STONE || typ == ROOM) |
| 3126 | typ = xGROUND; |
| 3127 | break; |
| 3128 | case MOAT: |
| 3129 | /* moat and swamp handling match waterbody_name()'s result */ |
| 3130 | if (Is_medusa_level(&u.uz)) |
| 3131 | typ = xSEA; |
| 3132 | else if (Is_juiblex_level(&u.uz)) |
| 3133 | typ = xSWAMP; |
| 3134 | break; |
| 3135 | case WATER: |
| 3136 | if (!Is_waterlevel(&u.uz)) |
| 3137 | typ = xWATERWALL; |
| 3138 | break; |
| 3139 | #if 0 /* don't bother -- Passes_walls for hero is rare, moving |
| 3140 | * from one type of wall to another even rarer, and the |
| 3141 | * cost of some extra once per move status updates is low */ |
| 3142 | case VWALL: |
| 3143 | case HWALL: |
| 3144 | case TLCORNER: |
| 3145 | case TRCORNER: |
| 3146 | case BLCORNER: |
no test coverage detected