~ubuntu-branches/ubuntu/vivid/nethack/vivid

« back to all changes in this revision

Viewing changes to src/cmd.c

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng, Bernhard R. Link, Vincent Cheng
  • Date: 2012-06-11 00:47:38 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120611004738-3fy8b3wi0j45y2oq
Tags: 3.4.3-14
* Team upload.

[ Bernhard R. Link ]
* switch to "3.0 (quilt)"
* bump Standards-Version
* modernize debian/rules:
- use dpkg-buildflags
- support build-arch/-indep
- make parallel safe
- don't avoid make errors
* add patch so it can compile with -Werror=format-security
* drop no longer needed patches (-qt and -gnome are gone)
* don't use /dev/null as install template (Closes: 644647)
* drop nethack-common menu (both -console and -x11 have one)

[ Vincent Cheng ]
* Adopt package. (Closes: #673584)
  - Change Maintainer to Debian Games Team.
  - Add myself to Uploaders.
* Modify 0006-Common-config.h-for-all-binary-packages.patch to enable
  AUTOPICKUP_EXCEPTIONS. (Closes: #329318)
* Modify 0011-Pasi-Kallinen-s-patch-to-add-colors-to-inventory-ite.patch
  and 0017-Debian-and-Linux-specifics-defined-in-unixconf.h.patch; add
  0021-fix-kfreebsd-ftbfs.patch to fix FTBFS on kfreebsd.
* Convert debian/copyright to DEP-5 machine-readable format.
* Use dh_lintian to install overrides instead of manually installing them
  in debian/rules.
* Add watch file.
* Add Homepage field in debian/control.
* Add Vcs-* fields in debian/control.

Show diffs side-by-side

added added

removed removed

Lines of Context:
602
602
    else ret = sscanf(buf, "%d", &newlevel);
603
603
 
604
604
    if (ret != 1) {
605
 
        pline(Never_mind);
 
605
        plines(Never_mind);
606
606
        return 0;
607
607
    }
608
608
    if (newlevel == u.ulevel) {
1126
1126
        return;
1127
1127
}
1128
1128
 
 
1129
#ifdef DUMP_LOG
 
1130
void
 
1131
dump_enlightenment(final)
 
1132
int final;
 
1133
{
 
1134
        int ltmp;
 
1135
        char buf[BUFSZ];
 
1136
        char buf2[BUFSZ];
 
1137
        char *youwere = "  You were ";
 
1138
        char *youhave = "  You have ";
 
1139
        char *youhad  = "  You had ";
 
1140
        char *youcould = "  You could ";
 
1141
 
 
1142
        dump("", "Final attributes");
 
1143
 
 
1144
#ifdef ELBERETH
 
1145
        if (u.uevent.uhand_of_elbereth) {
 
1146
            static const char * const hofe_titles[3] = {
 
1147
                                "the Hand of Elbereth",
 
1148
                                "the Envoy of Balance",
 
1149
                                "the Glory of Arioch"
 
1150
            };
 
1151
            dump(youwere,
 
1152
                (char *)hofe_titles[u.uevent.uhand_of_elbereth - 1]);
 
1153
        }
 
1154
#endif
 
1155
 
 
1156
        if (u.ualign.record >= 20)
 
1157
                dump(youwere, "piously aligned");
 
1158
        else if (u.ualign.record > 13)
 
1159
            dump(youwere, "devoutly aligned");
 
1160
        else if (u.ualign.record > 8)
 
1161
            dump(youwere, "fervently aligned");
 
1162
        else if (u.ualign.record > 3)
 
1163
            dump(youwere, "stridently aligned");
 
1164
        else if (u.ualign.record == 3)
 
1165
            dump(youwere, "aligned");
 
1166
        else if (u.ualign.record > 0)
 
1167
            dump(youwere, "haltingly aligned");
 
1168
        else if (u.ualign.record == 0)
 
1169
            dump(youwere, "nominally aligned");
 
1170
        else if (u.ualign.record >= -3) dump(youhave, "strayed");
 
1171
        else if (u.ualign.record >= -8) dump(youhave, "sinned");
 
1172
        else dump("  You have ", "transgressed");
 
1173
#ifdef WIZARD
 
1174
        if (wizard) {
 
1175
                Sprintf(buf, " %d", u.ualign.record);
 
1176
                dump("  Your alignment was ", buf);
 
1177
        }
 
1178
#endif
 
1179
 
 
1180
        /*** Resistances to troubles ***/
 
1181
        if (Fire_resistance) dump(youwere, "fire resistant");
 
1182
        if (Cold_resistance) dump(youwere, "cold resistant");
 
1183
        if (Sleep_resistance) dump(youwere, "sleep resistant");
 
1184
        if (Disint_resistance) dump(youwere, "disintegration-resistant");
 
1185
        if (Shock_resistance) dump(youwere, "shock resistant");
 
1186
        if (Poison_resistance) dump(youwere, "poison resistant");
 
1187
        if (Drain_resistance) dump(youwere, "level-drain resistant");
 
1188
        if (Sick_resistance) dump(youwere, "immune to sickness");
 
1189
        if (Antimagic) dump(youwere, "magic-protected");
 
1190
        if (Acid_resistance) dump(youwere, "acid resistant");
 
1191
        if (Stone_resistance) dump(youwere, "petrification resistant");
 
1192
        if (Invulnerable) dump(youwere, "invulnerable");
 
1193
        if (u.uedibility) dump(youcould, "recognize detrimental food");
 
1194
 
 
1195
        /*** Troubles ***/
 
1196
        if (Halluc_resistance)  dump("  ", "You resisted hallucinations");
 
1197
        if (Hallucination) dump(youwere, "hallucinating");
 
1198
        if (Stunned) dump(youwere, "stunned");
 
1199
        if (Confusion) dump(youwere, "confused");
 
1200
        if (Blinded) dump(youwere, "blinded");
 
1201
        if (Sick) {
 
1202
                if (u.usick_type & SICK_VOMITABLE)
 
1203
                        dump(youwere, "sick from food poisoning");
 
1204
                if (u.usick_type & SICK_NONVOMITABLE)
 
1205
                        dump(youwere, "sick from illness");
 
1206
        }
 
1207
        if (Stoned) dump(youwere, "turning to stone");
 
1208
        if (Slimed) dump(youwere, "turning into slime");
 
1209
        if (Strangled)
 
1210
                dump(youwere, (u.uburied) ? "buried" : "being strangled");
 
1211
        if (Glib) {
 
1212
                Sprintf(buf, "slippery %s", makeplural(body_part(FINGER)));
 
1213
                dump(youhad, buf);
 
1214
        }
 
1215
        if (Fumbling) dump("  ", "You fumbled");
 
1216
        if (Wounded_legs
 
1217
#ifdef STEED
 
1218
            && !u.usteed
 
1219
#endif
 
1220
                          ) {
 
1221
                Sprintf(buf, "wounded %s", makeplural(body_part(LEG)));
 
1222
                dump(youhad, buf);
 
1223
        }
 
1224
#ifdef STEED
 
1225
        if (Wounded_legs && u.usteed) {
 
1226
            Strcpy(buf, x_monnam(u.usteed, ARTICLE_YOUR, (char *)0, 
 
1227
                    SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION, FALSE));
 
1228
            *buf = highc(*buf);
 
1229
            Strcat(buf, " had wounded legs");
 
1230
            dump("  ", buf);
 
1231
        }
 
1232
#endif
 
1233
        if (Sleeping) dump("  ", "You fell asleep");
 
1234
        if (Hunger) dump("  ", "You hungered rapidly");
 
1235
 
 
1236
        /*** Vision and senses ***/
 
1237
        if (See_invisible) dump("  ", "You saw invisible");
 
1238
        if (Blind_telepat) dump(youwere, "telepathic");
 
1239
        if (Warning) dump(youwere, "warned");
 
1240
        if (Warn_of_mon && flags.warntype) {
 
1241
                Sprintf(buf, "aware of the presence of %s",
 
1242
                        (flags.warntype & M2_ORC) ? "orcs" :
 
1243
                        (flags.warntype & M2_DEMON) ? "demons" :
 
1244
                        something); 
 
1245
                dump(youwere, buf);
 
1246
        }
 
1247
        if (Undead_warning) dump(youwere, "warned of undead");
 
1248
        if (Searching) dump(youhad, "automatic searching");
 
1249
        if (Clairvoyant) dump(youwere, "clairvoyant");
 
1250
        if (Infravision) dump(youhad, "infravision");
 
1251
        if (Detect_monsters)
 
1252
          dump(youwere, "sensing the presence of monsters");
 
1253
        if (u.umconf) dump(youwere, "going to confuse monsters");
 
1254
 
 
1255
        /*** Appearance and behavior ***/
 
1256
        if (Adornment) {
 
1257
            int adorn = 0;
 
1258
            if(uleft && uleft->otyp == RIN_ADORNMENT) adorn += uleft->spe;
 
1259
            if(uright && uright->otyp == RIN_ADORNMENT) adorn += uright->spe;
 
1260
            if (adorn < 0)
 
1261
                dump(youwere, "poorly adorned");
 
1262
            else
 
1263
                dump(youwere, "adorned");
 
1264
        }
 
1265
        if (Invisible) dump(youwere, "invisible");
 
1266
        else if (Invis) dump(youwere, "invisible to others");
 
1267
        /* ordinarily "visible" is redundant; this is a special case for
 
1268
           the situation when invisibility would be an expected attribute */
 
1269
        else if ((HInvis || EInvis || pm_invisible(youmonst.data)) && BInvis)
 
1270
            dump(youwere, "visible");
 
1271
        if (Displaced) dump(youwere, "displaced");
 
1272
        if (Stealth) dump(youwere, "stealthy");
 
1273
        if (Aggravate_monster) dump("  ", "You aggravated monsters");
 
1274
        if (Conflict) dump("  ", "You caused conflict");
 
1275
 
 
1276
        /*** Transportation ***/
 
1277
        if (Jumping) dump(youcould, "jump");
 
1278
        if (Teleportation) dump(youcould, "teleport");
 
1279
        if (Teleport_control) dump(youhad, "teleport control");
 
1280
        if (Lev_at_will) dump(youwere, "levitating, at will");
 
1281
        else if (Levitation)
 
1282
          dump(youwere, "levitating");  /* without control */
 
1283
        else if (Flying) dump(youcould, "fly");
 
1284
        if (Wwalking) dump(youcould, "walk on water");
 
1285
        if (Swimming) dump(youcould, "swim");
 
1286
        if (Breathless) dump(youcould, "survive without air");
 
1287
        else if (Amphibious) dump(youcould, "breathe water");
 
1288
        if (Passes_walls) dump(youcould, "walk through walls");
 
1289
#ifdef STEED
 
1290
        if (u.usteed && (final < 2 || strcmp(killer, "riding accident"))) {
 
1291
            Sprintf(buf, "riding %s", y_monnam(u.usteed));
 
1292
            dump(youwere, buf);
 
1293
        }
 
1294
#endif
 
1295
        if (u.uswallow) {
 
1296
            Sprintf(buf, "swallowed by %s", a_monnam(u.ustuck));
 
1297
#ifdef WIZARD
 
1298
            if (wizard) Sprintf(eos(buf), " (%u)", u.uswldtim);
 
1299
#endif
 
1300
            dump(youwere, buf);
 
1301
        } else if (u.ustuck) {
 
1302
            Sprintf(buf, "%s %s",
 
1303
                    (Upolyd && sticks(youmonst.data)) ? "holding" : "held by",
 
1304
                    a_monnam(u.ustuck));
 
1305
            dump(youwere, buf);
 
1306
        }
 
1307
 
 
1308
        /*** Physical attributes ***/
 
1309
        if (u.uhitinc)
 
1310
            dump(youhad,
 
1311
                enlght_combatinc("to hit", u.uhitinc, final, buf));
 
1312
        if (u.udaminc)
 
1313
            dump(youhad,
 
1314
                enlght_combatinc("damage", u.udaminc, final, buf));
 
1315
        if (Slow_digestion) dump(youhad, "slower digestion");
 
1316
        if (Regeneration) dump("  ", "You regenerated");
 
1317
        if (u.uspellprot || Protection) {
 
1318
            int prot = 0;
 
1319
 
 
1320
            if(uleft && uleft->otyp == RIN_PROTECTION) prot += uleft->spe;
 
1321
            if(uright && uright->otyp == RIN_PROTECTION) prot += uright->spe;
 
1322
            if (HProtection & INTRINSIC) prot += u.ublessed;
 
1323
            prot += u.uspellprot;
 
1324
            
 
1325
            if (prot < 0)
 
1326
                dump(youwere, "ineffectively protected");
 
1327
            else
 
1328
                dump(youwere, "protected");
 
1329
        }
 
1330
        if (Protection_from_shape_changers)
 
1331
                dump(youwere, "protected from shape changers");
 
1332
        if (Polymorph) dump(youwere, "polymorphing");
 
1333
        if (Polymorph_control) dump(youhad, "polymorph control");
 
1334
        if (u.ulycn >= LOW_PM) {
 
1335
                Strcpy(buf, an(mons[u.ulycn].mname));
 
1336
                dump(youwere, buf);
 
1337
        }
 
1338
        if (Upolyd) {
 
1339
            if (u.umonnum == u.ulycn) Strcpy(buf, "in beast form");
 
1340
            else Sprintf(buf, "polymorphed into %s",
 
1341
                         an(youmonst.data->mname));
 
1342
#ifdef WIZARD
 
1343
            if (wizard) Sprintf(eos(buf), " (%d)", u.mtimedone);
 
1344
#endif
 
1345
            dump(youwere, buf);
 
1346
        }
 
1347
        if (Unchanging)
 
1348
          dump(youcould, "not change from your current form");
 
1349
        if (Fast) dump(youwere, Very_fast ? "very fast" : "fast");
 
1350
        if (Reflecting) dump(youhad, "reflection");
 
1351
        if (Free_action) dump(youhad, "free action");
 
1352
        if (Fixed_abil) dump(youhad, "fixed abilities");
 
1353
        if (Lifesaved)
 
1354
                dump("  ", "Your life would have been saved");
 
1355
        if (u.twoweap) dump(youwere, "wielding two weapons at once");
 
1356
 
 
1357
        /*** Miscellany ***/
 
1358
        if (Luck) {
 
1359
            ltmp = abs((int)Luck);
 
1360
            Sprintf(buf, "%s%slucky (%d)",
 
1361
                    ltmp >= 10 ? "extremely " : ltmp >= 5 ? "very " : "",
 
1362
                    Luck < 0 ? "un" : "", Luck);
 
1363
            dump(youwere, buf);
 
1364
        }
 
1365
#ifdef WIZARD
 
1366
         else if (wizard) dump("  ", "Your luck was zero");
 
1367
#endif
 
1368
        if (u.moreluck > 0) dump(youhad, "extra luck");
 
1369
        else if (u.moreluck < 0) dump(youhad, "reduced luck");
 
1370
        if (carrying(LUCKSTONE) || stone_luck(TRUE)) {
 
1371
            ltmp = stone_luck(FALSE);
 
1372
            if (ltmp <= 0)
 
1373
                dump("  ", "Bad luck did not time out for you");
 
1374
            if (ltmp >= 0)
 
1375
                dump("  ", "Good luck did not time out for you");
 
1376
        }
 
1377
 
 
1378
        if (u.ugangr) {
 
1379
            Sprintf(buf, " %sangry with you",
 
1380
                u.ugangr > 6 ? "extremely " : u.ugangr > 3 ? "very " : "");
 
1381
#ifdef WIZARD
 
1382
            if (wizard) Sprintf(eos(buf), " (%d)", u.ugangr);
 
1383
#endif
 
1384
            Sprintf(buf2, "%s was %s", u_gname(), buf);
 
1385
            dump("  ", buf2);
 
1386
        }
 
1387
 
 
1388
    {
 
1389
        const char *p;
 
1390
 
 
1391
        buf[0] = '\0';
 
1392
        if (final < 2) {    /* quit/escaped/ascended */
 
1393
            p = "survived after being killed ";
 
1394
            switch (u.umortality) {
 
1395
            case 0:  p = "survived";  break;
 
1396
            case 1:  Strcpy(buf, "once");  break;
 
1397
            case 2:  Strcpy(buf, "twice");  break;
 
1398
            case 3:  Strcpy(buf, "thrice");  break;
 
1399
            default: Sprintf(buf, "%d times", u.umortality);
 
1400
                     break;
 
1401
            }
 
1402
        } else {                /* game ended in character's death */
 
1403
            p = "are dead";
 
1404
            switch (u.umortality) {
 
1405
            case 0:  impossible("dead without dying?");
 
1406
            case 1:  break;                     /* just "are dead" */
 
1407
            default: Sprintf(buf, " (%d%s time!)", u.umortality,
 
1408
                             ordin(u.umortality));
 
1409
                     break;
 
1410
            }
 
1411
        }
 
1412
        if (p) {
 
1413
          Sprintf(buf2, "You %s %s", p, buf);
 
1414
          dump("  ", buf2);
 
1415
        }
 
1416
    }
 
1417
        dump("", "");
 
1418
        return;
 
1419
 
 
1420
} /* dump_enlightenment */
 
1421
#endif
 
1422
 
1129
1423
/*
1130
1424
 * Courtesy function for non-debug, non-explorer mode players
1131
1425
 * to help refresh them about who/what they are.
1341
1635
        destroy_nhwindow(en_win);
1342
1636
}
1343
1637
 
 
1638
#ifdef DUMP_LOG
 
1639
void
 
1640
dump_conduct(final)
 
1641
int final;
 
1642
{
 
1643
        char buf[BUFSZ];
 
1644
        int ngenocided;
 
1645
 
 
1646
        dump("", "Voluntary challenges");
 
1647
 
 
1648
        if (!u.uconduct.food)
 
1649
            dump("", "  You went without food");
 
1650
            /* But beverages are okay */
 
1651
        else if (!u.uconduct.unvegan)
 
1652
            dump("", "  You followed a strict vegan diet");
 
1653
        else if (!u.uconduct.unvegetarian)
 
1654
            dump("", "  You were a vegetarian");
 
1655
        else if (Role_if(PM_MONK) && u.uconduct.unvegetarian < 10) {
 
1656
            sprintf(buf, "  You ate non-vegetarian food %ld time%s.", 
 
1657
                u.uconduct.unvegetarian, plur(u.uconduct.unvegetarian));
 
1658
            dump("", buf);
 
1659
        }
 
1660
 
 
1661
        if (!u.uconduct.gnostic)
 
1662
            dump("", "  You were an atheist");
 
1663
 
 
1664
        if (!u.uconduct.weaphit)
 
1665
            dump("", "  You never hit with a wielded weapon");
 
1666
        else if (Role_if(PM_MONK) && u.uconduct.weaphit < 10) {
 
1667
            Sprintf(buf, "  You hit with a wielded weapon %ld time%s",
 
1668
                    u.uconduct.weaphit, plur(u.uconduct.weaphit));
 
1669
            dump("", buf);
 
1670
        }
 
1671
#ifdef WIZARD
 
1672
        else if (wizard) {
 
1673
            Sprintf(buf, "hit with a wielded weapon %ld time%s",
 
1674
                    u.uconduct.weaphit, plur(u.uconduct.weaphit));
 
1675
            dump("  You ", buf);
 
1676
        }
 
1677
#endif
 
1678
        if (!u.uconduct.killer)
 
1679
            dump("", "  You were a pacifist");
 
1680
 
 
1681
        if (!u.uconduct.literate)
 
1682
            dump("", "  You were illiterate");
 
1683
#ifdef WIZARD
 
1684
        else if (wizard) {
 
1685
            Sprintf(buf, "read items or engraved %ld time%s",
 
1686
                    u.uconduct.literate, plur(u.uconduct.literate));
 
1687
            dump("  You ", buf);
 
1688
        }
 
1689
#endif
 
1690
 
 
1691
        ngenocided = num_genocides();
 
1692
        if (ngenocided == 0) {
 
1693
            dump("", "  You never genocided any monsters");
 
1694
        } else {
 
1695
            Sprintf(buf, "genocided %d type%s of monster%s",
 
1696
                    ngenocided, plur(ngenocided), plur(ngenocided));
 
1697
            dump("  You ", buf);
 
1698
        }
 
1699
 
 
1700
        if (!u.uconduct.polypiles)
 
1701
            dump("", "  You never polymorphed an object");
 
1702
        else {
 
1703
            Sprintf(buf, "polymorphed %ld item%s",
 
1704
                    u.uconduct.polypiles, plur(u.uconduct.polypiles));
 
1705
            dump("  You ", buf);
 
1706
        }
 
1707
 
 
1708
        if (!u.uconduct.polyselfs)
 
1709
            dump("", "  You never changed form");
 
1710
        else {
 
1711
            Sprintf(buf, "changed form %ld time%s",
 
1712
                    u.uconduct.polyselfs, plur(u.uconduct.polyselfs));
 
1713
            dump("  You ", buf);
 
1714
        }
 
1715
 
 
1716
        if (!u.uconduct.wishes)
 
1717
            dump("", "  You used no wishes");
 
1718
        else {
 
1719
            Sprintf(buf, "used %ld wish%s",
 
1720
                    u.uconduct.wishes, (u.uconduct.wishes > 1L) ? "es" : "");
 
1721
            dump("  You ", buf);
 
1722
 
 
1723
            if (!u.uconduct.wisharti)
 
1724
                dump("", "  You did not wish for any artifacts");
 
1725
        }
 
1726
 
 
1727
        dump("", "");
 
1728
}
 
1729
#endif /* DUMP_LOG */
 
1730
 
1344
1731
#endif /* OVLB */
1345
1732
#ifdef OVL1
1346
1733
 
2060
2447
{
2061
2448
        xchar new_x, new_y;
2062
2449
        if (!getdir(prompt)) {
2063
 
                pline(Never_mind);
 
2450
                plines(Never_mind);
2064
2451
                return 0;
2065
2452
        }
2066
2453
        new_x = x + u.dx;
2069
2456
                cc->x = new_x;
2070
2457
                cc->y = new_y;
2071
2458
        } else {
2072
 
                if (emsg) pline(emsg);
 
2459
                if (emsg) plines(emsg);
2073
2460
                return 0;
2074
2461
        }
2075
2462
        return 1;
2340
2727
                    if (multi > 9) {
2341
2728
                        clear_nhwindow(WIN_MESSAGE);
2342
2729
                        Sprintf(in_line, "Count: %d", multi);
2343
 
                        pline(in_line);
 
2730
                        plines(in_line);
2344
2731
                        mark_synch();
2345
2732
                    }
2346
2733
                    last_multi = multi;