// update crops HASH_ITER(hh, crop_table, crop, next_crop) { found = delete_mob_from_spawn_list(&GET_CROP_SPAWNS(crop), vnum); found |= delete_from_interaction_list(&GET_CROP_INTERACTIONS(crop), TYPE_MOB, vnum); if (found) { save_library_file_for_vnum(DB_BOOT_CROP, GET_CROP_VNUM(crop)); } }
/** * Checks for common crop problems and reports them to ch. * * @param crop_data *cp The item to audit. * @param char_data *ch The person to report to. * @return bool TRUE if any problems were reported; FALSE if all good. */ bool audit_crop(crop_data *cp, char_data *ch) { extern adv_data *get_adventure_for_vnum(rmt_vnum vnum); extern struct icon_data *get_icon_from_set(struct icon_data *set, int type); extern const char *icon_types[]; struct interaction_item *inter; char temp[MAX_STRING_LENGTH]; bool problem = FALSE; bool harv, forage; adv_data *adv; int iter; adv = get_adventure_for_vnum(GET_CROP_VNUM(cp)); if (!GET_CROP_NAME(cp) || !*GET_CROP_NAME(cp) || !str_cmp(GET_CROP_NAME(cp), "Unnamed Crop")) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No name set"); problem = TRUE; } strcpy(temp, GET_CROP_NAME(cp)); strtolower(temp); if (strcmp(GET_CROP_NAME(cp), temp)) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "Non-lowercase name"); problem = TRUE; } if (!GET_CROP_TITLE(cp) || !*GET_CROP_TITLE(cp) || !str_cmp(GET_CROP_TITLE(cp), "An Unnamed Crop")) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No title set"); problem = TRUE; } if (adv && !CROP_FLAGGED(cp, CROPF_NOT_WILD)) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "Missing !WILD flag in adventure crop"); problem = TRUE; } if (!adv && CROP_FLAGGED(cp, CROPF_NOT_WILD)) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "!WILD flag on non-adventure crop"); problem = TRUE; } if (GET_CROP_MAPOUT(cp) == 0) { // slightly magic-numbered olc_audit_msg(ch, GET_CROP_VNUM(cp), "Mapout color not set"); problem = TRUE; } for (iter = 0; iter < NUM_TILESETS; ++iter) { if (!get_icon_from_set(GET_CROP_ICONS(cp), iter)) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No icon for '%s' tileset", icon_types[iter]); problem = TRUE; } } if (GET_CROP_CLIMATE(cp) == CLIMATE_NONE) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "Climate not set"); problem = TRUE; } if (!GET_CROP_SPAWNS(cp)) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No spawns set"); problem = TRUE; } harv = forage = FALSE; LL_FOREACH(GET_CROP_INTERACTIONS(cp), inter) { if (inter->type == INTERACT_HARVEST) { harv = TRUE; } else if (inter->type == INTERACT_FORAGE) { forage = TRUE; } } if (!harv) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No HARVEST"); problem = TRUE; } if (!forage) { olc_audit_msg(ch, GET_CROP_VNUM(cp), "No FORAGE"); problem = TRUE; } return problem; }