#include <sys/types.h> #include <sys/time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> /* including main header file */ #include "mud.h" void cmd_mobiles (D_M * ch, char *arg) { char arg1[MAX_BUFFER]; char buf[MAX_BUFFER]; D_MOBILE *dMob = NULL; arg = one_arg(arg, arg1); if (arg1[0] == '\0') { stc("What do you want to do?\nValid Commands are:\n", ch); stc(" mob list\n", ch); stc(" mob create\n", ch); return; } /* * Take care of the list of mobiles */ if (compares(arg1, "list")) { for (dMob = dmobile_list; dMob && dMob->next != dMob; dMob = dMob->next) { sprintf(buf, "Mobile: %s\n", dMob->name); stc(buf, ch); } } else if (compares(arg1, "create")) { dMob = malloc (sizeof(dMob)); dMob->name = "Bob the barbarian"; dMob->is_npc = TRUE; dMob->socket = NULL; dMob->x = ch->x; dMob->y = ch->y; sprintf(buf, "Created mobile %-3d/%-3d @ %s\n", dMob->x, dMob->y, dMob->name); stc(buf, ch); dMob->next = dmobile_list; dmobile_list = dMob; return; } else { cmd_mobiles(ch, ""); return; } }