diff 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
line wrap: on
line diff
--- a/xrogue/misc.c	Tue Mar 08 19:45:41 2016 -0500
+++ b/xrogue/misc.c	Fri Mar 11 19:47:52 2016 -0500
@@ -24,9 +24,9 @@
  */
 
 void
-changeclass(long *newclass)
+changeclass(int newclass)
 {
-    if (*newclass == player.t_ctype) {
+    if (newclass == player.t_ctype) {
         msg("You feel more skillful.");
         raise_level();
     }
@@ -38,19 +38,19 @@
          */
         long save;
 
-        msg("You are transformed into a %s! ", char_class[*newclass].name);
+        msg("You are transformed into a %s! ", char_class[newclass].name);
 
         /*
          * if he becomes a thief or an assassin give him studded leather armor
          */
-        if ((*newclass == C_THIEF || *newclass == C_ASSASSIN) &&
+        if ((newclass == C_THIEF || newclass == C_ASSASSIN) &&
             cur_armor != NULL && cur_armor->o_which != STUDDED_LEATHER)
                 cur_armor->o_which = STUDDED_LEATHER;
         /*
          * if he becomes a monk he can't wear any armor
      * so give him a cloak of protection
          */
-        if (*newclass == C_MONK && cur_armor != NULL) {
+        if (newclass == C_MONK && cur_armor != NULL) {
                 cur_armor->o_ac = armors[cur_armor->o_which].a_class - 
                                   cur_armor->o_ac;
                 cur_armor->o_type = MM;
@@ -62,8 +62,8 @@
     /*
      * otherwise give him plate armor
      */
-        if ((*newclass != C_THIEF ||
-         *newclass != C_ASSASSIN || *newclass != C_MONK) &&
+        if ((newclass != C_THIEF ||
+         newclass != C_ASSASSIN || newclass != C_MONK) &&
          cur_armor != NULL && cur_armor->o_which != PLATE_ARMOR) 
                 cur_armor->o_which = PLATE_ARMOR;
 
@@ -81,12 +81,12 @@
         /*
          * if he becomes a spell caster of some kind, give him a fuse
          */
-        if (*newclass == C_MAGICIAN || *newclass == C_RANGER)
-                fuse(spell_recovery, (VOID *)NULL, SPELLTIME, AFTER);
-        if (*newclass == C_DRUID || *newclass == C_MONK)
-                fuse(chant_recovery, (VOID *)NULL, SPELLTIME, AFTER);
-        if ((*newclass==C_CLERIC || *newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
-                fuse(prayer_recovery, (VOID *)NULL, SPELLTIME, AFTER);
+        if (newclass == C_MAGICIAN || newclass == C_RANGER)
+                fuse(spell_recovery, NULL, SPELLTIME, AFTER);
+        if (newclass == C_DRUID || newclass == C_MONK)
+                fuse(chant_recovery, NULL, SPELLTIME, AFTER);
+        if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
+                fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
         /*
          * if he's changing from a fighter, ranger, or paladin then we
      * may have to change his sword since only these types can wield
@@ -98,8 +98,8 @@
         cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
             (cur_weapon->o_which == BASWORD  ||
         cur_weapon->o_which == TWOSWORD) &&
-            !(*newclass == C_FIGHTER || *newclass == C_RANGER ||
-            *newclass == C_PALADIN)  &&
+            !(newclass == C_FIGHTER || newclass == C_RANGER ||
+            newclass == C_PALADIN)  &&
         cur_weapon->o_which == TWOSWORD)
                 cur_weapon->o_which = SWORD;
 
@@ -113,8 +113,8 @@
         cur_weapon != NULL && cur_weapon->o_type == WEAPON &&
             (cur_weapon->o_which == BASWORD  ||
             cur_weapon->o_which == TWOSWORD) &&
-            !(*newclass == C_THIEF || *newclass == C_ASSASSIN ||
-            *newclass == C_MONK)   &&
+            !(newclass == C_THIEF || newclass == C_ASSASSIN ||
+            newclass == C_MONK)   &&
         cur_weapon->o_which == BASWORD)
                 cur_weapon->o_which = SWORD;
 
@@ -130,12 +130,12 @@
          * if he becomes a thief, assassin, or monk then add 
      * the trap_look() daemon
          */
-        if (*newclass == C_THIEF || *newclass == C_ASSASSIN ||
-        *newclass == C_MONK)
-                start_daemon(trap_look, (VOID *)NULL, AFTER);
+        if (newclass == C_THIEF || newclass == C_ASSASSIN ||
+        newclass == C_MONK)
+                start_daemon(trap_look, NULL, AFTER);
 
     /* adjust stats */
-        char_type = player.t_ctype = *newclass;
+        char_type = player.t_ctype = newclass;
         save = pstats.s_hpt;
         max_stats.s_hpt = pstats.s_hpt = 0;
         max_stats.s_lvl = pstats.s_lvl = 0; 
@@ -1029,7 +1029,7 @@
             else msg("Ahh.. Ahh... Choo!! ");
             if (!find_slot(dust_appear)) {
                 turn_on(player, ISINVIS);
-                fuse(dust_appear, (VOID *)NULL, DUSTTIME, AFTER);
+                fuse(dust_appear, NULL, DUSTTIME, AFTER);
                 PLAYER = IPLAYER;
                 light(&hero);
             }
@@ -1059,7 +1059,7 @@
                 if (find_slot(unchoke))
                     lengthen(unchoke, DUSTTIME);
                 else
-                    fuse(unchoke, (VOID *)NULL, DUSTTIME, AFTER);
+                    fuse(unchoke, NULL, DUSTTIME, AFTER);
                 turn_on(player, ISHUH);
                 turn_on(player, ISBLIND);
                 light(&hero);
@@ -1103,7 +1103,7 @@
         when MM_SKILLS:
             detach (pack, item);
             inpack--;
-            changeclass(&obj->o_ac);
+            changeclass(obj->o_ac);
     when MM_CRYSTAL:
     {
         register char *str;