Skip to content

Instantly share code, notes, and snippets.

@jonm
Created October 4, 2015 01:40
Show Gist options
  • Save jonm/3d935bbfc875bb0409d1 to your computer and use it in GitHub Desktop.
Save jonm/3d935bbfc875bb0409d1 to your computer and use it in GitHub Desktop.
the `shop_keeper` function from `shop.c` is missing some return values
int shop_keeper(struct char_data *ch, int cmd, char *arg, char *mob, int type)
{
char argm[100], buf[MAX_STRING_LENGTH];
struct char_data *temp_char;
struct char_data *keeper;
int shop_nr;
int citizen(struct char_data *ch, int cmd, char *arg, struct char_data *mob, int type);
if(type == EVENT_DWARVES_STRIKE) {
ch->generic = DWARVES_STRIKE;
return;
}
if(type == EVENT_FAMINE) {
ch->generic = FAMINE;
return;
}
keeper = 0;
if (!real_roomp(ch->in_room))
return;
for (temp_char = real_roomp(ch->in_room)->people; (!keeper) && (temp_char) ;
temp_char = temp_char->next_in_room)
if (IS_MOB(temp_char))
if (mob_index[temp_char->nr].func == shop_keeper)
keeper = temp_char;
for(shop_nr=0 ; shop_index[shop_nr].keeper != keeper->nr; shop_nr++);
if (!cmd) {
if (keeper->specials.fighting) {
return(citizen(keeper,0,"", keeper,0));
}
}
if(DoIHateYou(ch) && number(0,3) == 2) {
act("$n sneers at you.", TRUE, keeper, 0, ch, TO_VICT);
act("$n sneers at $N.",TRUE, keeper, 0, ch, TO_NOTVICT);
}
if((cmd == 56) && (ch->in_room == shop_index[shop_nr].in_room))
/* Buy */
{
shopping_buy(arg,ch,keeper,shop_nr);
return(TRUE);
}
if((cmd ==57 ) && (ch->in_room == shop_index[shop_nr].in_room))
/* Sell */
{
shopping_sell(arg,ch,keeper,shop_nr);
return(TRUE);
}
if((cmd == 58) && (ch->in_room == shop_index[shop_nr].in_room))
/* value */
{
shopping_value(arg,ch,keeper,shop_nr);
return(TRUE);
}
if((cmd == 59) && (ch->in_room == shop_index[shop_nr].in_room))
/* List */
{
shopping_list(arg,ch,keeper,shop_nr);
return(TRUE);
}
if ((cmd == 25) || (cmd==70)) /* Kill or Hit */
{
only_argument(arg, argm);
if (keeper == get_char_room(argm,ch->in_room))
{
shopping_kill(arg,ch,keeper,shop_nr);
return(TRUE);
}
} else if ((cmd==84) || (cmd==207) || (cmd==172)) { /* Cast, recite, use */
act("$N tells you 'No magic here - kid!'.", FALSE, ch, 0, keeper, TO_CHAR);
return TRUE;
}
return(FALSE);
}
/* 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