mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-21 21:40:49 +02:00
Addressed warnings from -Weverything subset:
-Wconditional-uninitialized -Wshadow -Wswitch-enum -Wunreachable-code-break -Wunused-macros
This commit is contained in:
parent
821cb709c0
commit
4590ba16d6
20 changed files with 11 additions and 46 deletions
|
@ -3228,7 +3228,6 @@ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, c
|
|||
break;
|
||||
case 53: /* variable */
|
||||
return perform_set_dg_var(ch, vict, val_arg);
|
||||
break;
|
||||
case 54: /* weight */
|
||||
GET_WEIGHT(vict) = value;
|
||||
affect_total(vict);
|
||||
|
@ -3484,11 +3483,6 @@ struct zcheck_armor {
|
|||
{ITEM_WEAR_HOLD, 10, "Held item"}
|
||||
};
|
||||
|
||||
/*These are strictly boolean*/
|
||||
#define CAN_WEAR_WEAPONS 0 /* toggle - can a weapon also be a piece of armor? */
|
||||
#define MAX_APPLIES_LIMIT 1 /* toggle - is there a limit at all? */
|
||||
#define CHECK_ITEM_RENT 0 /* do we check for rent cost == 0 ? */
|
||||
#define CHECK_ITEM_COST 0 /* do we check for item cost == 0 ? */
|
||||
/* Applies limits !! Very Important: Keep these in the same order as in Structs.h.
|
||||
* To ignore an apply, set max_aff to -99. These will be ignored if MAX_APPLIES_LIMIT = 0 */
|
||||
struct zcheck_affs {
|
||||
|
|
|
@ -93,7 +93,6 @@
|
|||
|
||||
# include "conf.h"
|
||||
# include "sysdep.h"
|
||||
# define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
|
||||
#if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */
|
||||
# undef HAVE_SNPRINTF
|
||||
|
|
11
src/class.c
11
src/class.c
|
@ -8,9 +8,6 @@
|
|||
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
|
||||
**************************************************************************/
|
||||
|
||||
/** Help buffer the global variable definitions */
|
||||
#define __CLASS_C__
|
||||
|
||||
/* This file attempts to concentrate most of the code which must be changed
|
||||
* in order for new classes to be added. If you're adding a new class, you
|
||||
* should go through this entire file from beginning to end and add the
|
||||
|
@ -1866,7 +1863,6 @@ const char *title_male(int chclass, int level)
|
|||
case LVL_GRGOD: return "the God of Magic";
|
||||
default: return "the Mage";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_CLERIC:
|
||||
switch (level) {
|
||||
|
@ -1896,7 +1892,6 @@ const char *title_male(int chclass, int level)
|
|||
case LVL_GRGOD: return "the God of Good and Evil";
|
||||
default: return "the Cleric";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_THIEF:
|
||||
switch (level) {
|
||||
|
@ -1926,7 +1921,6 @@ const char *title_male(int chclass, int level)
|
|||
case LVL_GRGOD: return "the God of Thieves and Tradesmen";
|
||||
default: return "the Thief";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_WARRIOR:
|
||||
switch(level) {
|
||||
|
@ -1956,7 +1950,6 @@ const char *title_male(int chclass, int level)
|
|||
case LVL_GRGOD: return "the God of War";
|
||||
default: return "the Warrior";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Default title for classes which do not have titles defined */
|
||||
|
@ -2010,7 +2003,6 @@ const char *title_female(int chclass, int level)
|
|||
case LVL_GRGOD: return "the Goddess of Magic";
|
||||
default: return "the Witch";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_CLERIC:
|
||||
switch (level) {
|
||||
|
@ -2040,7 +2032,6 @@ const char *title_female(int chclass, int level)
|
|||
case LVL_GRGOD: return "the Goddess of Good and Evil";
|
||||
default: return "the Cleric";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_THIEF:
|
||||
switch (level) {
|
||||
|
@ -2070,7 +2061,6 @@ const char *title_female(int chclass, int level)
|
|||
case LVL_GRGOD: return "the Goddess of Thieves and Tradesmen";
|
||||
default: return "the Thief";
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_WARRIOR:
|
||||
switch(level) {
|
||||
|
@ -2100,7 +2090,6 @@ const char *title_female(int chclass, int level)
|
|||
case LVL_GRGOD: return "the Goddess of War";
|
||||
default: return "the Warrior";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Default title for classes which do not have titles defined */
|
||||
|
|
5
src/db.c
5
src/db.c
|
@ -1553,12 +1553,9 @@ static void parse_simple_mob(FILE *mob_f, int i, int nr)
|
|||
* assigns the correct value to the mob as appropriate. Adding new e-specs is
|
||||
* absurdly easy -- just add a new CASE statement to this function! No other
|
||||
* changes need to be made anywhere in the code.
|
||||
* CASE : Requires a parameter through 'value'.
|
||||
* BOOL_CASE : Being specified at all is its value. */
|
||||
* CASE : Requires a parameter through 'value'. */
|
||||
#define CASE(test) \
|
||||
if (value && !matched && !str_cmp(keyword, test) && (matched = TRUE))
|
||||
#define BOOL_CASE(test) \
|
||||
if (!value && !matched && !str_cmp(keyword, test) && (matched = TRUE))
|
||||
#define RANGE(low, high) \
|
||||
(num_arg = MAX((low), MIN((high), (num_arg))))
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ static void mob_log(char_data *mob, const char *format, ...)
|
|||
/* Macro to determine if a mob is permitted to use these commands. */
|
||||
#define MOB_OR_IMPL(ch) \
|
||||
((IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original) >= LVL_IMPL)) || (SCRIPT(ch) && TRIGGERS(SCRIPT(ch))))
|
||||
#define MOB_OR_PLAYER(ch) (GET_LEVEL(ch) > 0)
|
||||
|
||||
/* mob commands */
|
||||
/* prints the argument to all the rooms aroud the mobile */
|
||||
|
|
|
@ -285,7 +285,6 @@ int entry_mtrigger(char_data *ch)
|
|||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_ENTRY) && (rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||
return script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1133,6 @@ int drop_wtrigger(obj_data *obj, char_data *actor)
|
|||
return 0;
|
||||
else
|
||||
return ret_val;
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
|
||||
**************************************************************************/
|
||||
|
||||
#define __GENOLC_C__
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
#include "structs.h"
|
||||
|
|
|
@ -1018,7 +1018,6 @@ void ibtedit_parse(struct descriptor_data *d, char *arg)
|
|||
write_to_output(d, "Do you wish to save your changes? : ");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case IBTEDIT_MAIN_MENU:
|
||||
switch (*arg) {
|
||||
|
@ -1080,7 +1079,6 @@ void ibtedit_parse(struct descriptor_data *d, char *arg)
|
|||
ibtedit_disp_main_menu(d);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case IBTEDIT_NAME:
|
||||
smash_tilde(arg);
|
||||
|
|
|
@ -1354,7 +1354,6 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
case CON_GET_PROTOCOL:
|
||||
write_to_output(d, "Collecting Protocol Information... Please Wait.\r\n");
|
||||
return;
|
||||
break;
|
||||
case CON_GET_NAME: /* wait for input of name */
|
||||
if (d->character == NULL) {
|
||||
CREATE(d->character, struct char_data, 1);
|
||||
|
|
|
@ -205,7 +205,6 @@ void * next_in_list(struct iterator_data * pIterator)
|
|||
|
||||
struct item_data * find_in_list(void * pContent, struct list_data * pList)
|
||||
{
|
||||
struct iterator_data Iterator;
|
||||
void * pFoundItem;
|
||||
struct item_data *pItem = NULL;
|
||||
bool found;
|
||||
|
@ -281,7 +280,6 @@ void * simple_list(struct list_data * pList)
|
|||
|
||||
void * random_from_list(struct list_data * pList)
|
||||
{
|
||||
struct iterator_data Iterator;
|
||||
void * pFoundItem;
|
||||
bool found;
|
||||
int number;
|
||||
|
|
|
@ -969,7 +969,7 @@ void mag_creations(int level, struct char_data *ch, int spellnum)
|
|||
void mag_rooms(int level, struct char_data *ch, int spellnum)
|
||||
{
|
||||
room_rnum rnum;
|
||||
int duration;
|
||||
int duration = 0;
|
||||
bool failure = FALSE;
|
||||
event_id IdNum = eNULL;
|
||||
const char *msg = NULL;
|
||||
|
|
|
@ -571,7 +571,6 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
|||
write_to_output(d, "Do you wish to save your changes? : ");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case MEDIT_MAIN_MENU:
|
||||
i = 0;
|
||||
|
|
|
@ -77,6 +77,12 @@ EVENTFUNC(event_countdown)
|
|||
REMOVE_BIT_AR(ROOM_FLAGS(rnum), ROOM_DARK);
|
||||
send_to_room(rnum, "The dark shroud disappates.\r\n");
|
||||
break;
|
||||
case ePROTOCOLS:
|
||||
break;
|
||||
case eWHIRLWIND:
|
||||
break;
|
||||
case eNULL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -234,7 +240,7 @@ void clear_char_event_list(struct char_data * ch)
|
|||
void change_event_duration(struct char_data * ch, event_id iId, long time)
|
||||
{
|
||||
struct event * pEvent;
|
||||
struct mud_event_data * pMudEvent;
|
||||
struct mud_event_data * pMudEvent = 0;
|
||||
bool found = FALSE;
|
||||
|
||||
if (ch->events == NULL)
|
||||
|
|
|
@ -408,8 +408,6 @@ ACMD(do_oasis_list)
|
|||
return;
|
||||
}
|
||||
else if (is_abbrev(arg, "level") || is_abbrev(arg, "flags")) {
|
||||
int i;
|
||||
|
||||
if (!*arg2) {
|
||||
send_to_char(ch, "Which mobile flag or level do you want to list?\r\n");
|
||||
for (i = 0; i < NUM_MOB_FLAGS; i++) {
|
||||
|
|
|
@ -1185,7 +1185,7 @@ static int Crash_load_objs(struct char_data *ch) {
|
|||
unsigned long cost;
|
||||
struct obj_data *cont_row[MAX_BAG_ROWS];
|
||||
int rentcode = RENT_UNDEF;
|
||||
int timed,netcost,gold,account,nitems;
|
||||
int timed=0,netcost=0,gold,account,nitems;
|
||||
obj_save_data *loaded, *current;
|
||||
|
||||
if (!get_filename(filename, sizeof(filename), CRASH_FILE, GET_NAME(ch)))
|
||||
|
|
|
@ -113,7 +113,6 @@ static const char s_Gauge5[] = "\005\002Opponent\002darkred\002OPPONENT_HEALTH\
|
|||
#define NUMBER_READ_ONLY false, false, false, false, -1, -1, 0, NULL
|
||||
#define NUMBER_READ_ONLY_SET_TO(x) false, false, false, false, -1, -1, x, NULL
|
||||
#define STRING_READ_ONLY true, false, false, false, -1, -1, 0, NULL
|
||||
#define NUMBER_IN_THE_RANGE(x,y) false, true, false, false, x, y, 0, NULL
|
||||
#define BOOLEAN_SET_TO(x) false, true, false, false, 0, 1, x, NULL
|
||||
#define STRING_WITH_LENGTH_OF(x,y) true, true, false, false, x, y, 0, NULL
|
||||
#define STRING_WRITE_ONCE(x,y) true, true, true, false, -1, -1, 0, NULL
|
||||
|
|
|
@ -407,7 +407,6 @@ void qedit_parse(struct descriptor_data *d, char *arg)
|
|||
"Invalid choice!\r\nDo you wish to save the quest? : ");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
/*-------------------------------------------------------------------*/
|
||||
case QEDIT_CONFIRM_DELETE:
|
||||
switch (*arg) {
|
||||
|
@ -433,7 +432,6 @@ void qedit_parse(struct descriptor_data *d, char *arg)
|
|||
"Invalid choice!\r\nDo you wish to delete the quest? : ");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
case QEDIT_MAIN_MENU:
|
||||
|
@ -747,3 +745,4 @@ void qedit_string_cleanup(struct descriptor_data *d, int terminator)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,6 @@ void parse_quest(FILE *quest_f, int nr)
|
|||
case 'S':
|
||||
total_quests = ++i;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* parse_quest */
|
||||
|
|
|
@ -467,7 +467,6 @@ void sedit_parse(struct descriptor_data *d, char *arg)
|
|||
write_to_output(d, "Invalid choice!\r\nDo you wish to save your changes? : ");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case SEDIT_MAIN_MENU:
|
||||
i = 0;
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
* Makefile: # Any special flags you want to pass to the compiler
|
||||
* Makefile: MYFLAGS = -Wall -DMEMORY_DEBUG */
|
||||
|
||||
/* protect our calloc() and free() calls from recursive redefinition: */
|
||||
#define ZMALLOC_H
|
||||
|
||||
#include "conf.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue