Skip to content

Instantly share code, notes, and snippets.

@jonm
Created October 4, 2015 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonm/1285b69e8d41f69631b1 to your computer and use it in GitHub Desktop.
Save jonm/1285b69e8d41f69631b1 to your computer and use it in GitHub Desktop.
the special function has an early return statement without a return value
int special(struct char_data *ch, int cmd, char *arg)
{
register struct obj_data *i;
register struct char_data *k;
int j;
if (ch->in_room == NOWHERE) {
char_to_room(ch, 3001);
return;
}
/* special in room? */
if (real_roomp(ch->in_room)->funct)
if ((*real_roomp(ch->in_room)->funct)(ch, cmd, arg, real_roomp(ch->in_room), PULSE_COMMAND))
return(1);
/* special in equipment list? */
for (j = 0; j <= (MAX_WEAR - 1); j++)
if (ch->equipment[j] && ch->equipment[j]->item_number>=0)
if (obj_index[ch->equipment[j]->item_number].func)
if ((*obj_index[ch->equipment[j]->item_number].func)
(ch, cmd, arg, ch->equipment[j], PULSE_COMMAND))
return(1);
/* special in inventory? */
for (i = ch->carrying; i; i = i->next_content)
if (i->item_number>=0)
if (obj_index[i->item_number].func)
if ((*obj_index[i->item_number].func)(ch, cmd, arg, i, PULSE_COMMAND))
return(1);
/* special in mobile present? */
for (k = real_roomp(ch->in_room)->people; k; k = k->next_in_room)
if ( IS_MOB(k) )
if (mob_index[k->nr].func)
if ((*mob_index[k->nr].func)(ch, cmd, arg, k, PULSE_COMMAND))
return(1);
/* special in object present? */
for (i = real_roomp(ch->in_room)->contents; i; i = i->next_content)
if (i->item_number>=0)
if (obj_index[i->item_number].func)
if ((*obj_index[i->item_number].func)(ch, cmd, arg, i, PULSE_COMMAND))
return(1);
return(0);
}
/* This is an excerpt from a DikuMUD-derived codebase. DikuMUD was created by Sebastian Hammer, Michael Seifert</a>,
Hans Henrik Stærfeldt, Tom Madsen, and Katja Nyboe. This code is subject to the DikuMud License, as found at
https://github.com/jonm/SillyMUD/blob/43344e6dc864de7518c2fc0dbf7b7cf14f5924a2/doc/license.doc
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment