comparison xrogue/misc.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 e1cd27c5464f
children
comparison
equal deleted inserted replaced
232:bac2c81fec78 239:837044d2c362
22 * changeclass: 22 * changeclass:
23 * Change the player's class to the specified one. 23 * Change the player's class to the specified one.
24 */ 24 */
25 25
26 void 26 void
27 changeclass(long *newclass) 27 changeclass(int newclass)
28 { 28 {
29 if (*newclass == player.t_ctype) { 29 if (newclass == player.t_ctype) {
30 msg("You feel more skillful."); 30 msg("You feel more skillful.");
31 raise_level(); 31 raise_level();
32 } 32 }
33 else { 33 else {
34 /* 34 /*
36 * points and the right level for his exp pts 36 * points and the right level for his exp pts
37 * drop exp pts by 10% 37 * drop exp pts by 10%
38 */ 38 */
39 long save; 39 long save;
40 40
41 msg("You are transformed into a %s! ", char_class[*newclass].name); 41 msg("You are transformed into a %s! ", char_class[newclass].name);
42 42
43 /* 43 /*
44 * if he becomes a thief or an assassin give him studded leather armor 44 * if he becomes a thief or an assassin give him studded leather armor
45 */ 45 */
46 if ((*newclass == C_THIEF || *newclass == C_ASSASSIN) && 46 if ((newclass == C_THIEF || newclass == C_ASSASSIN) &&
47 cur_armor != NULL && cur_armor->o_which != STUDDED_LEATHER) 47 cur_armor != NULL && cur_armor->o_which != STUDDED_LEATHER)
48 cur_armor->o_which = STUDDED_LEATHER; 48 cur_armor->o_which = STUDDED_LEATHER;
49 /* 49 /*
50 * if he becomes a monk he can't wear any armor 50 * if he becomes a monk he can't wear any armor
51 * so give him a cloak of protection 51 * so give him a cloak of protection
52 */ 52 */
53 if (*newclass == C_MONK && cur_armor != NULL) { 53 if (newclass == C_MONK && cur_armor != NULL) {
54 cur_armor->o_ac = armors[cur_armor->o_which].a_class - 54 cur_armor->o_ac = armors[cur_armor->o_which].a_class -
55 cur_armor->o_ac; 55 cur_armor->o_ac;
56 cur_armor->o_type = MM; 56 cur_armor->o_type = MM;
57 cur_armor->o_which = MM_PROTECT; 57 cur_armor->o_which = MM_PROTECT;
58 cur_armor->o_flags &= ~(ISPROT | ISKNOW); 58 cur_armor->o_flags &= ~(ISPROT | ISKNOW);
60 cur_armor = NULL; 60 cur_armor = NULL;
61 } 61 }
62 /* 62 /*
63 * otherwise give him plate armor 63 * otherwise give him plate armor
64 */ 64 */
65 if ((*newclass != C_THIEF || 65 if ((newclass != C_THIEF ||
66 *newclass != C_ASSASSIN || *newclass != C_MONK) && 66 newclass != C_ASSASSIN || newclass != C_MONK) &&
67 cur_armor != NULL && cur_armor->o_which != PLATE_ARMOR) 67 cur_armor != NULL && cur_armor->o_which != PLATE_ARMOR)
68 cur_armor->o_which = PLATE_ARMOR; 68 cur_armor->o_which = PLATE_ARMOR;
69 69
70 /* 70 /*
71 * if he used to be a spell caster of some sort, kill the fuse 71 * if he used to be a spell caster of some sort, kill the fuse
79 extinguish(prayer_recovery); 79 extinguish(prayer_recovery);
80 80
81 /* 81 /*
82 * if he becomes a spell caster of some kind, give him a fuse 82 * if he becomes a spell caster of some kind, give him a fuse
83 */ 83 */
84 if (*newclass == C_MAGICIAN || *newclass == C_RANGER) 84 if (newclass == C_MAGICIAN || newclass == C_RANGER)
85 fuse(spell_recovery, (VOID *)NULL, SPELLTIME, AFTER); 85 fuse(spell_recovery, NULL, SPELLTIME, AFTER);
86 if (*newclass == C_DRUID || *newclass == C_MONK) 86 if (newclass == C_DRUID || newclass == C_MONK)
87 fuse(chant_recovery, (VOID *)NULL, SPELLTIME, AFTER); 87 fuse(chant_recovery, NULL, SPELLTIME, AFTER);
88 if ((*newclass==C_CLERIC || *newclass==C_PALADIN) && !cur_misc[HEIL_ANKH]) 88 if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
89 fuse(prayer_recovery, (VOID *)NULL, SPELLTIME, AFTER); 89 fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
90 /* 90 /*
91 * if he's changing from a fighter, ranger, or paladin then we 91 * if he's changing from a fighter, ranger, or paladin then we
92 * may have to change his sword since only these types can wield 92 * may have to change his sword since only these types can wield
93 * the two-handed sword. 93 * the two-handed sword.
94 */ 94 */
96 player.t_ctype == C_RANGER || 96 player.t_ctype == C_RANGER ||
97 player.t_ctype == C_PALADIN) && 97 player.t_ctype == C_PALADIN) &&
98 cur_weapon != NULL && cur_weapon->o_type == WEAPON && 98 cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
99 (cur_weapon->o_which == BASWORD || 99 (cur_weapon->o_which == BASWORD ||
100 cur_weapon->o_which == TWOSWORD) && 100 cur_weapon->o_which == TWOSWORD) &&
101 !(*newclass == C_FIGHTER || *newclass == C_RANGER || 101 !(newclass == C_FIGHTER || newclass == C_RANGER ||
102 *newclass == C_PALADIN) && 102 newclass == C_PALADIN) &&
103 cur_weapon->o_which == TWOSWORD) 103 cur_weapon->o_which == TWOSWORD)
104 cur_weapon->o_which = SWORD; 104 cur_weapon->o_which = SWORD;
105 105
106 /* 106 /*
107 * if he's changing from a thief, assassin, fighter, or monk 107 * if he's changing from a thief, assassin, fighter, or monk
111 if ((player.t_ctype == C_THIEF || player.t_ctype == C_ASSASSIN || 111 if ((player.t_ctype == C_THIEF || player.t_ctype == C_ASSASSIN ||
112 player.t_ctype == C_FIGHTER || player.t_ctype == C_MONK) && 112 player.t_ctype == C_FIGHTER || player.t_ctype == C_MONK) &&
113 cur_weapon != NULL && cur_weapon->o_type == WEAPON && 113 cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
114 (cur_weapon->o_which == BASWORD || 114 (cur_weapon->o_which == BASWORD ||
115 cur_weapon->o_which == TWOSWORD) && 115 cur_weapon->o_which == TWOSWORD) &&
116 !(*newclass == C_THIEF || *newclass == C_ASSASSIN || 116 !(newclass == C_THIEF || newclass == C_ASSASSIN ||
117 *newclass == C_MONK) && 117 newclass == C_MONK) &&
118 cur_weapon->o_which == BASWORD) 118 cur_weapon->o_which == BASWORD)
119 cur_weapon->o_which = SWORD; 119 cur_weapon->o_which = SWORD;
120 120
121 /* 121 /*
122 * if he was a thief, assassin, or monk then take out 122 * if he was a thief, assassin, or monk then take out
128 128
129 /* 129 /*
130 * if he becomes a thief, assassin, or monk then add 130 * if he becomes a thief, assassin, or monk then add
131 * the trap_look() daemon 131 * the trap_look() daemon
132 */ 132 */
133 if (*newclass == C_THIEF || *newclass == C_ASSASSIN || 133 if (newclass == C_THIEF || newclass == C_ASSASSIN ||
134 *newclass == C_MONK) 134 newclass == C_MONK)
135 start_daemon(trap_look, (VOID *)NULL, AFTER); 135 start_daemon(trap_look, NULL, AFTER);
136 136
137 /* adjust stats */ 137 /* adjust stats */
138 char_type = player.t_ctype = *newclass; 138 char_type = player.t_ctype = newclass;
139 save = pstats.s_hpt; 139 save = pstats.s_hpt;
140 max_stats.s_hpt = pstats.s_hpt = 0; 140 max_stats.s_hpt = pstats.s_hpt = 0;
141 max_stats.s_lvl = pstats.s_lvl = 0; 141 max_stats.s_lvl = pstats.s_lvl = 0;
142 max_stats.s_lvladj = pstats.s_lvladj = 0; 142 max_stats.s_lvladj = pstats.s_lvladj = 0;
143 max_stats.s_exp = pstats.s_exp + rnd(4); 143 max_stats.s_exp = pstats.s_exp + rnd(4);
1027 obj->o_charges--; 1027 obj->o_charges--;
1028 if (terse) msg("You sneeze! "); 1028 if (terse) msg("You sneeze! ");
1029 else msg("Ahh.. Ahh... Choo!! "); 1029 else msg("Ahh.. Ahh... Choo!! ");
1030 if (!find_slot(dust_appear)) { 1030 if (!find_slot(dust_appear)) {
1031 turn_on(player, ISINVIS); 1031 turn_on(player, ISINVIS);
1032 fuse(dust_appear, (VOID *)NULL, DUSTTIME, AFTER); 1032 fuse(dust_appear, NULL, DUSTTIME, AFTER);
1033 PLAYER = IPLAYER; 1033 PLAYER = IPLAYER;
1034 light(&hero); 1034 light(&hero);
1035 } 1035 }
1036 else lengthen(dust_appear, DUSTTIME); 1036 else lengthen(dust_appear, DUSTTIME);
1037 1037
1057 else { 1057 else {
1058 msg("You begin to cough and choke uncontrollably! "); 1058 msg("You begin to cough and choke uncontrollably! ");
1059 if (find_slot(unchoke)) 1059 if (find_slot(unchoke))
1060 lengthen(unchoke, DUSTTIME); 1060 lengthen(unchoke, DUSTTIME);
1061 else 1061 else
1062 fuse(unchoke, (VOID *)NULL, DUSTTIME, AFTER); 1062 fuse(unchoke, NULL, DUSTTIME, AFTER);
1063 turn_on(player, ISHUH); 1063 turn_on(player, ISHUH);
1064 turn_on(player, ISBLIND); 1064 turn_on(player, ISBLIND);
1065 light(&hero); 1065 light(&hero);
1066 } 1066 }
1067 1067
1101 * Note that it takes a while to read. 1101 * Note that it takes a while to read.
1102 */ 1102 */
1103 when MM_SKILLS: 1103 when MM_SKILLS:
1104 detach (pack, item); 1104 detach (pack, item);
1105 inpack--; 1105 inpack--;
1106 changeclass(&obj->o_ac); 1106 changeclass(obj->o_ac);
1107 when MM_CRYSTAL: 1107 when MM_CRYSTAL:
1108 { 1108 {
1109 register char *str; 1109 register char *str;
1110 1110
1111 detach (pack, item); 1111 detach (pack, item);