comparison xrogue/potions.c @ 239:837044d2c362

Merge the GCC5 and build fix branches. This fixes all warnings produced by GCC 5, except the ones related to system functions. Those could be fixed by including the proper headers, but it would be better to replace the system-dependent code with functions from mdport.c.
author John "Elwin" Edwards
date Fri, 11 Mar 2016 19:47:52 -0500
parents 7c1cb43f346e
children 0250220d8cdd
comparison
equal deleted inserted replaced
232:bac2c81fec78 239:837044d2c362
25 int add_dexterity(int change); 25 int add_dexterity(int change);
26 int add_intelligence(int change); 26 int add_intelligence(int change);
27 int add_strength(int change); 27 int add_strength(int change);
28 int add_wisdom(int change); 28 int add_wisdom(int change);
29 29
30 int res_charisma(int howmuch); 30 void res_charisma(int howmuch);
31 int res_constitution(int howmuch); 31 void res_constitution(int howmuch);
32 int res_dexterity(int howmuch); 32 void res_dexterity(int howmuch);
33 int res_intelligence(int howmuch); 33 void res_intelligence(int howmuch);
34 int res_wisdom(int howmuch); 34 void res_wisdom(int howmuch);
35 35
36 /* 36 /*
37 * add_abil is an array of functions used to change attributes. It must be 37 * add_abil is an array of functions used to change attributes. It must be
38 * ordered according to the attribute definitions in rogue.h. 38 * ordered according to the attribute definitions in rogue.h.
39 */ 39 */
46 /* 46 /*
47 * res_abil is an array of functions used to change attributes. It must be 47 * res_abil is an array of functions used to change attributes. It must be
48 * ordered according to the attribute definitions in rogue.h. 48 * ordered according to the attribute definitions in rogue.h.
49 */ 49 */
50 50
51 int (*res_abil[NUMABILITIES])() = { 51 void (*res_abil[NUMABILITIES])() = {
52 res_intelligence, res_strength, res_wisdom, res_dexterity, 52 res_intelligence, res_strength, res_wisdom, res_dexterity,
53 res_constitution, res_charisma 53 res_constitution, res_charisma
54 }; 54 };
55 55
56 /* 56 /*
170 lengthen(nohaste, roll(hasttime,hasttime)); 170 lengthen(nohaste, roll(hasttime,hasttime));
171 } 171 }
172 else { 172 else {
173 msg("You feel yourself moving %sfaster.", blessed ? "much " : ""); 173 msg("You feel yourself moving %sfaster.", blessed ? "much " : "");
174 turn_on(player, ISHASTE); 174 turn_on(player, ISHASTE);
175 fuse(nohaste, (VOID *)NULL, roll(hasttime, hasttime), AFTER); 175 fuse(nohaste, NULL, roll(hasttime, hasttime), AFTER);
176 } 176 }
177 } 177 }
178 178
179 /* 179 /*
180 * Increase player's intelligence 180 * Increase player's intelligence
230 on(player, ISSLOW) ? "even " : ""); 230 on(player, ISSLOW) ? "even " : "");
231 if (on(player, ISSLOW)) 231 if (on(player, ISSLOW))
232 lengthen(noslow, roll(HASTETIME,HASTETIME)); 232 lengthen(noslow, roll(HASTETIME,HASTETIME));
233 else { 233 else {
234 turn_on(player, ISSLOW); 234 turn_on(player, ISSLOW);
235 fuse(noslow, (VOID *)NULL, roll(HASTETIME,HASTETIME), AFTER); 235 fuse(noslow, NULL, roll(HASTETIME,HASTETIME), AFTER);
236 } 236 }
237 } 237 }
238 } 238 }
239 239
240 /* 240 /*
351 extinguish(unclrhead); /* If we have a fuse, put it out */ 351 extinguish(unclrhead); /* If we have a fuse, put it out */
352 msg("A strong blue aura surrounds your head."); 352 msg("A strong blue aura surrounds your head.");
353 } 353 }
354 else { /* Just light a fuse for how long player is safe */ 354 else { /* Just light a fuse for how long player is safe */
355 if (off(player, ISCLEAR)) { 355 if (off(player, ISCLEAR)) {
356 fuse(unclrhead, (VOID *)NULL, CLRDURATION, AFTER); 356 fuse(unclrhead, NULL, CLRDURATION, AFTER);
357 msg("A faint blue aura surrounds your head."); 357 msg("A faint blue aura surrounds your head.");
358 } 358 }
359 else { /* If we have a fuse lengthen it, else we 359 else { /* If we have a fuse lengthen it, else we
360 * are permanently clear. 360 * are permanently clear.
361 */ 361 */
516 if (cursed) { 516 if (cursed) {
517 if (!find_slot(sight)) 517 if (!find_slot(sight))
518 { 518 {
519 msg("A cloak of darkness falls around you."); 519 msg("A cloak of darkness falls around you.");
520 turn_on(player, ISBLIND); 520 turn_on(player, ISBLIND);
521 fuse(sight, (VOID *)NULL, SEEDURATION, AFTER); 521 fuse(sight, NULL, SEEDURATION, AFTER);
522 light(&hero); 522 light(&hero);
523 } 523 }
524 else 524 else
525 msg("The darkness around you thickens. "); 525 msg("The darkness around you thickens. ");
526 lengthen(sight, SEEDURATION); 526 lengthen(sight, SEEDURATION);
527 } 527 }
528 else { 528 else {
529 if (off(player, CANSEE)) { 529 if (off(player, CANSEE)) {
530 turn_on(player, CANSEE); 530 turn_on(player, CANSEE);
531 msg("Your eyes begin to tingle."); 531 msg("Your eyes begin to tingle.");
532 fuse(unsee, (VOID *)NULL, blessed ? SEEDURATION*3 :SEEDURATION, AFTER); 532 fuse(unsee, NULL, blessed ? SEEDURATION*3 :SEEDURATION, AFTER);
533 light(&hero); 533 light(&hero);
534 } 534 }
535 else if (find_slot(unsee) != 0) { 535 else if (find_slot(unsee) != 0) {
536 msg("You eyes continue to tingle."); 536 msg("You eyes continue to tingle.");
537 lengthen(unsee, blessed ? SEEDURATION*3 : SEEDURATION); 537 lengthen(unsee, blessed ? SEEDURATION*3 : SEEDURATION);
551 else duration = 1; 551 else duration = 1;
552 552
553 if (on(player, CANINWALL)) 553 if (on(player, CANINWALL))
554 lengthen(unphase, duration*PHASEDURATION); 554 lengthen(unphase, duration*PHASEDURATION);
555 else { 555 else {
556 fuse(unphase, (VOID *)NULL, duration*PHASEDURATION, AFTER); 556 fuse(unphase, NULL, duration*PHASEDURATION, AFTER);
557 turn_on(player, CANINWALL); 557 turn_on(player, CANINWALL);
558 } 558 }
559 msg("You feel %slight-headed!", 559 msg("You feel %slight-headed!",
560 blessed ? "very " : ""); 560 blessed ? "very " : "");
561 } 561 }
575 msg("Nothing happens."); /* Flying by cloak */ 575 msg("Nothing happens."); /* Flying by cloak */
576 say_message = FALSE; 576 say_message = FALSE;
577 } 577 }
578 } 578 }
579 else { 579 else {
580 fuse(land, (VOID *)NULL, duration*FLYTIME, AFTER); 580 fuse(land, NULL, duration*FLYTIME, AFTER);
581 turn_on(player, ISFLY); 581 turn_on(player, ISFLY);
582 } 582 }
583 if (say_message) { 583 if (say_message) {
584 if (is_potion) p_know[P_FLY] = TRUE; 584 if (is_potion) p_know[P_FLY] = TRUE;
585 msg("You feel %slighter than air!", blessed ? "much " : ""); 585 msg("You feel %slighter than air!", blessed ? "much " : "");
639 } 639 }
640 when P_INVIS: 640 when P_INVIS:
641 if (off(player, ISINVIS)) { 641 if (off(player, ISINVIS)) {
642 turn_on(player, ISINVIS); 642 turn_on(player, ISINVIS);
643 msg("You have a tingling feeling all over your body"); 643 msg("You have a tingling feeling all over your body");
644 fuse(appear, (VOID *)NULL, blessed ? GONETIME*3 : GONETIME, AFTER); 644 fuse(appear, NULL, blessed ? GONETIME*3 : GONETIME, AFTER);
645 PLAYER = IPLAYER; 645 PLAYER = IPLAYER;
646 light(&hero); 646 light(&hero);
647 } 647 }
648 else { 648 else {
649 if (find_slot(appear)) { 649 if (find_slot(appear)) {
701 701
702 /* Does he currently have an artifical skill? */ 702 /* Does he currently have an artifical skill? */
703 if (!find_slot(unskill)) { /* No skill */ 703 if (!find_slot(unskill)) { /* No skill */
704 pstats.s_lvladj = -2; 704 pstats.s_lvladj = -2;
705 pstats.s_lvl += pstats.s_lvladj; 705 pstats.s_lvl += pstats.s_lvladj;
706 fuse(unskill, (VOID *)NULL, SKILLDURATION, AFTER); 706 fuse(unskill, NULL, SKILLDURATION, AFTER);
707 } 707 }
708 else { /* Has an artifical skill */ 708 else { /* Has an artifical skill */
709 /* Is the skill beneficial? */ 709 /* Is the skill beneficial? */
710 if (pstats.s_lvladj > 0) { 710 if (pstats.s_lvladj > 0) {
711 /* Decrease the previous skill advantage */ 711 /* Decrease the previous skill advantage */
757 757
758 /* Does he currently have an artifical skill? */ 758 /* Does he currently have an artifical skill? */
759 if (!find_slot(unskill)) { 759 if (!find_slot(unskill)) {
760 pstats.s_lvladj = adjust; 760 pstats.s_lvladj = adjust;
761 pstats.s_lvl += pstats.s_lvladj; 761 pstats.s_lvl += pstats.s_lvladj;
762 fuse(unskill, (VOID *)NULL, 762 fuse(unskill, NULL,
763 blessed ? SKILLDURATION*2 : SKILLDURATION, AFTER); 763 blessed ? SKILLDURATION*2 : SKILLDURATION, AFTER);
764 } 764 }
765 else { /* Has an artifical skill */ 765 else { /* Has an artifical skill */
766 /* Is the skill detrimental? */ 766 /* Is the skill detrimental? */
767 if (pstats.s_lvladj < 0) { 767 if (pstats.s_lvladj < 0) {
817 else if (cursed) { 817 else if (cursed) {
818 msg("You quench your thirst. "); 818 msg("You quench your thirst. ");
819 say_message = FALSE; 819 say_message = FALSE;
820 } 820 }
821 else { 821 else {
822 fuse(nofire, (VOID *)NULL, duration*FIRETIME, AFTER); 822 fuse(nofire, NULL, duration*FIRETIME, AFTER);
823 turn_on(player, NOFIRE); 823 turn_on(player, NOFIRE);
824 } 824 }
825 if (say_message) { 825 if (say_message) {
826 if (is_potion) p_know[P_FIRE] = TRUE; 826 if (is_potion) p_know[P_FIRE] = TRUE;
827 msg("You feel %sfire resistant", blessed ? "very " : ""); 827 msg("You feel %sfire resistant", blessed ? "very " : "");
854 else if (cursed) { 854 else if (cursed) {
855 msg("You quench your thirst. "); 855 msg("You quench your thirst. ");
856 say_message = FALSE; 856 say_message = FALSE;
857 } 857 }
858 else { 858 else {
859 fuse(nocold, (VOID *)NULL, duration*COLDTIME, AFTER); 859 fuse(nocold, NULL, duration*COLDTIME, AFTER);
860 turn_on(player, NOCOLD); 860 turn_on(player, NOCOLD);
861 } 861 }
862 if (say_message) { 862 if (say_message) {
863 if (is_potion) p_know[P_COLD] = TRUE; 863 if (is_potion) p_know[P_COLD] = TRUE;
864 msg("You feel %scold resistant", blessed ? "very " : ""); 864 msg("You feel %scold resistant", blessed ? "very " : "");
888 else if (cursed) { 888 else if (cursed) {
889 msg("You quench your thirst. "); 889 msg("You quench your thirst. ");
890 say_message = FALSE; 890 say_message = FALSE;
891 } 891 }
892 else { 892 else {
893 fuse(nobolt, (VOID *)NULL, duration*BOLTTIME, AFTER); 893 fuse(nobolt, NULL, duration*BOLTTIME, AFTER);
894 turn_on(player, NOBOLT); 894 turn_on(player, NOBOLT);
895 } 895 }
896 if (say_message) { 896 if (say_message) {
897 if (is_potion) p_know[P_LIGHTNING] = TRUE; 897 if (is_potion) p_know[P_LIGHTNING] = TRUE;
898 msg("Your skin turns %sblue!", blessed ? "very " : ""); 898 msg("Your skin turns %sblue!", blessed ? "very " : "");
943 * res_dexterity: 943 * res_dexterity:
944 * Restore player's dexterity 944 * Restore player's dexterity
945 * if called with zero the restore fully 945 * if called with zero the restore fully
946 */ 946 */
947 947
948 int 948 void
949 res_dexterity(int howmuch) 949 res_dexterity(int howmuch)
950 { 950 {
951 short save_max; 951 short save_max;
952 int ring_str; 952 int ring_str;
953 953
954 if (howmuch < 0) return(0); 954 if (howmuch < 0) return;
955 955
956 /* Discount the ring value */ 956 /* Discount the ring value */
957 ring_str = ring_value(R_ADDHIT); 957 ring_str = ring_value(R_ADDHIT);
958 pstats.s_dext -= ring_str; 958 pstats.s_dext -= ring_str;
959 959
968 if (ring_str) { 968 if (ring_str) {
969 save_max = max_stats.s_dext; 969 save_max = max_stats.s_dext;
970 pstats.s_dext += ring_str; 970 pstats.s_dext += ring_str;
971 max_stats.s_dext = save_max; 971 max_stats.s_dext = save_max;
972 } 972 }
973 return(0); 973 return;
974 } 974 }
975 975
976 /* 976 /*
977 * res_intelligence: 977 * res_intelligence:
978 * Restore player's intelligence 978 * Restore player's intelligence
979 */ 979 */
980 980
981 int 981 void
982 res_intelligence(int howmuch) 982 res_intelligence(int howmuch)
983 { 983 {
984 short save_max; 984 short save_max;
985 int ring_str; 985 int ring_str;
986 986
987 if (howmuch <= 0) return(0); 987 if (howmuch <= 0) return;
988 988
989 /* Discount the ring value */ 989 /* Discount the ring value */
990 ring_str = ring_value(R_ADDINTEL); 990 ring_str = ring_value(R_ADDINTEL);
991 pstats.s_intel -= ring_str; 991 pstats.s_intel -= ring_str;
992 992
996 if (ring_str) { 996 if (ring_str) {
997 save_max = max_stats.s_intel; 997 save_max = max_stats.s_intel;
998 pstats.s_intel += ring_str; 998 pstats.s_intel += ring_str;
999 max_stats.s_intel = save_max; 999 max_stats.s_intel = save_max;
1000 } 1000 }
1001 return(0); 1001 return;
1002 } 1002 }
1003 1003
1004 /* 1004 /*
1005 * res_wisdom: 1005 * res_wisdom:
1006 * Restore player's wisdom 1006 * Restore player's wisdom
1007 */ 1007 */
1008 1008
1009 int 1009 void
1010 res_wisdom(int howmuch) 1010 res_wisdom(int howmuch)
1011 { 1011 {
1012 short save_max; 1012 short save_max;
1013 int ring_str; 1013 int ring_str;
1014 1014
1015 if (howmuch <= 0) return(0); 1015 if (howmuch <= 0) return;
1016 1016
1017 /* Discount the ring value */ 1017 /* Discount the ring value */
1018 ring_str = ring_value(R_ADDWISDOM); 1018 ring_str = ring_value(R_ADDWISDOM);
1019 pstats.s_wisdom -= ring_str; 1019 pstats.s_wisdom -= ring_str;
1020 1020
1024 if (ring_str) { 1024 if (ring_str) {
1025 save_max = max_stats.s_wisdom; 1025 save_max = max_stats.s_wisdom;
1026 pstats.s_wisdom += ring_str; 1026 pstats.s_wisdom += ring_str;
1027 max_stats.s_wisdom = save_max; 1027 max_stats.s_wisdom = save_max;
1028 } 1028 }
1029 return(0); 1029 return;
1030 } 1030 }
1031 1031
1032 /* 1032 /*
1033 * res_constitution: 1033 * res_constitution:
1034 * Restore the players constitution. 1034 * Restore the players constitution.
1035 */ 1035 */
1036 1036
1037 int 1037 void
1038 res_constitution(int howmuch) 1038 res_constitution(int howmuch)
1039 { 1039 {
1040 if (howmuch > 0) 1040 if (howmuch > 0)
1041 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const); 1041 pstats.s_const = min(pstats.s_const + howmuch, max_stats.s_const);
1042 1042
1043 return(0); 1043 return;
1044 } 1044 }
1045 1045
1046 /* 1046 /*
1047 * res_charisma: 1047 * res_charisma:
1048 * Restore the players charisma. 1048 * Restore the players charisma.
1049 */ 1049 */
1050 1050
1051 int 1051 void
1052 res_charisma(int howmuch) 1052 res_charisma(int howmuch)
1053 { 1053 {
1054 if (howmuch > 0) 1054 if (howmuch > 0)
1055 pstats.s_charisma = 1055 pstats.s_charisma =
1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma); 1056 min(pstats.s_charisma + howmuch, max_stats.s_charisma);
1057 1057
1058 return(0); 1058 return;
1059 } 1059 }