void medit_setup_existing(struct descriptor_data *d, int rmob_num) { struct char_data *mob; /* Allocate a scratch mobile structure. */ CREATE(mob, struct char_data, 1); copy_mobile(mob, mob_proto + rmob_num); OLC_MOB(d) = mob; OLC_ITEM_TYPE(d) = MOB_TRIGGER; dg_olc_script_copy(d); /* * The edited mob must not have a script. * It will be assigned to the updated mob later, after editing. */ SCRIPT(mob) = NULL; OLC_MOB(d)->proto_script = NULL; }
void medit_setup_existing(struct descriptor_data *d, int rmob_num) { struct char_data *mob; #if defined(OASIS_MPROG) MPROG_DATA *temp; MPROG_DATA *head; #endif /* * Allocate a scratch mobile structure. */ CREATE(mob, struct char_data, 1); copy_mobile(mob, mob_proto + rmob_num); #if defined(OASIS_MPROG) /* * I think there needs to be a brace from the if statement to the #endif * according to the way the original patch was indented. If this crashes, * try it with the braces and report to [email protected] on if that works. */ if (GET_MPROG(mob)) CREATE(OLC_MPROGL(d), MPROG_DATA, 1); head = OLC_MPROGL(d); for (temp = GET_MPROG(mob); temp;temp = temp->next) { OLC_MPROGL(d)->type = temp->type; OLC_MPROGL(d)->arglist = str_dup(temp->arglist); OLC_MPROGL(d)->comlist = str_dup(temp->comlist); if (temp->next) { CREATE(OLC_MPROGL(d)->next, MPROG_DATA, 1); OLC_MPROGL(d) = OLC_MPROGL(d)->next; } } OLC_MPROGL(d) = head; OLC_MPROG(d) = OLC_MPROGL(d); #endif OLC_MOB(d) = mob; OLC_ITEM_TYPE(d) = MOB_TRIGGER; dg_olc_script_copy(d); medit_disp_menu(d); }
void medit_setup_existing(struct descriptor_data *d, int rmob_num) { struct char_data *mob; /* * Allocate a scratch mobile structure. */ CREATE(mob, struct char_data, 1); copy_mobile(mob, mob_proto + rmob_num); #if CONFIG_OASIS_MPROG { MPROG_DATA *temp; MPROG_DATA *head; if (GET_MPROG(mob)) CREATE(OLC_MPROGL(d), MPROG_DATA, 1); head = OLC_MPROGL(d); for (temp = GET_MPROG(mob); temp; temp = temp->next) { OLC_MPROGL(d)->type = temp->type; OLC_MPROGL(d)->arglist = str_dup(temp->arglist); OLC_MPROGL(d)->comlist = str_dup(temp->comlist); if (temp->next) { CREATE(OLC_MPROGL(d)->next, MPROG_DATA, 1); OLC_MPROGL(d) = OLC_MPROGL(d)->next; } } OLC_MPROGL(d) = head; OLC_MPROG(d) = OLC_MPROGL(d); } #endif OLC_MOB(d) = mob; medit_disp_menu(d); }
int add_mobile(struct char_data *mob, mob_vnum vnum) { int rnum, i, found = FALSE, shop, cmd_no; zone_rnum zone; struct char_data *live_mob; if ((rnum = real_mobile(vnum)) != NOBODY) { /* Copy over the mobile and free() the old strings. */ copy_mobile(&mob_proto[rnum], mob); /* Now re-point all existing mobile strings to here. */ for (live_mob = character_list; live_mob; live_mob = live_mob->next) if (rnum == live_mob->nr) update_mobile_strings(live_mob, &mob_proto[rnum]); add_to_save_list(zone_table[real_zone_by_thing(vnum)].number, SL_MOB); log("GenOLC: add_mobile: Updated existing mobile #%d.", vnum); return TRUE; } RECREATE(mob_proto, struct char_data, top_of_mobt + 2); RECREATE(mob_index, struct index_data, top_of_mobt + 2); top_of_mobt++; for (i = top_of_mobt; i > 0; i--) { if (vnum > mob_index[i - 1].vnum) { mob_proto[i] = *mob; mob_proto[i].nr = i; copy_mobile_strings(mob_proto + i, mob); mob_index[i].vnum = vnum; mob_index[i].number = 0; mob_index[i].func = 0; found = i; break; } mob_index[i] = mob_index[i - 1]; mob_proto[i] = mob_proto[i - 1]; mob_proto[i].nr++; } if (!found) { mob_proto[0] = *mob; mob_proto[0].nr = 0; copy_mobile_strings(&mob_proto[0], mob); mob_index[0].vnum = vnum; mob_index[0].number = 0; mob_index[0].func = 0; } log("GenOLC: add_mobile: Added mobile %d at index #%d.", vnum, found); #if CONFIG_GENOLC_MOBPROG GET_MPROG(OLC_MOB(d)) = OLC_MPROGL(d); GET_MPROG_TYPE(OLC_MOB(d)) = (OLC_MPROGL(d) ? OLC_MPROGL(d)->type : 0); while (OLC_MPROGL(d)) { GET_MPROG_TYPE(OLC_MOB(d)) |= OLC_MPROGL(d)->type; OLC_MPROGL(d) = OLC_MPROGL(d)->next; } #endif /* * Update live mobile rnums. */ for (live_mob = character_list; live_mob; live_mob = live_mob->next) GET_MOB_RNUM(live_mob) += (GET_MOB_RNUM(live_mob) >= found); /* * Update zone table. */ for (zone = 0; zone <= top_of_zone_table; zone++) for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) if (ZCMD(zone, cmd_no).command == 'M') ZCMD(zone, cmd_no).arg1 += (ZCMD(zone, cmd_no).arg1 >= found); /* * Update shop keepers. */ if (shop_index) for (shop = 0; shop <= top_shop - top_shop_offset; shop++) SHOP_KEEPER(shop) += (SHOP_KEEPER(shop) >= found); add_to_save_list(zone_table[real_zone_by_thing(vnum)].number, SL_MOB); return found; }