the #up command - move up a staircase */
| 1295 | |
| 1296 | /* the #up command - move up a staircase */ |
| 1297 | int |
| 1298 | doup(void) |
| 1299 | { |
| 1300 | stairway *stway = stairway_at(u.ux,u.uy); |
| 1301 | |
| 1302 | set_move_cmd(DIR_UP, 0); |
| 1303 | |
| 1304 | if (u_rooted()) |
| 1305 | return ECMD_TIME; |
| 1306 | |
| 1307 | /* "up" to get out of a pit... */ |
| 1308 | if (u.utrap && u.utraptype == TT_PIT) { |
| 1309 | climb_pit(); |
| 1310 | return ECMD_TIME; |
| 1311 | } |
| 1312 | |
| 1313 | if (!stway || (stway && !stway->up)) { |
| 1314 | You_cant("go up here."); |
| 1315 | return ECMD_OK; |
| 1316 | } |
| 1317 | if (stucksteed(TRUE)) { |
| 1318 | return ECMD_OK; |
| 1319 | } |
| 1320 | |
| 1321 | if (u_stuck_cannot_go("up")) |
| 1322 | return ECMD_TIME; |
| 1323 | |
| 1324 | if (near_capacity() > SLT_ENCUMBER) { |
| 1325 | /* No levitation check; inv_weight() already allows for it */ |
| 1326 | Your("load is too heavy to climb the %s.", |
| 1327 | levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder"); |
| 1328 | return ECMD_TIME; |
| 1329 | } |
| 1330 | if (ledger_no(&u.uz) == 1) { |
| 1331 | if (iflags.debug_fuzzer) |
| 1332 | return ECMD_OK; |
| 1333 | if (y_n("Beware, there will be no return! Still climb?") != 'y') |
| 1334 | return ECMD_OK; |
| 1335 | } |
| 1336 | if (!next_to_u()) { |
| 1337 | You("are held back by your pet!"); |
| 1338 | return ECMD_OK; |
| 1339 | } |
| 1340 | ga.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER); |
| 1341 | prev_level(TRUE); |
| 1342 | ga.at_ladder = FALSE; |
| 1343 | return ECMD_TIME; |
| 1344 | } |
| 1345 | |
| 1346 | /* check that we can write out the current level */ |
| 1347 | staticfn NHFILE * |
no test coverage detected