tbamud/src/oasis_delete.c

108 lines
3 KiB
C
Raw Normal View History

/**************************************************************************
* File: oasis_delete.c Part of tbaMUD *
* Usage: Oasis OLC deletion. *
* *
* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
* 2002 Kip Potter [Mythran]. *
**************************************************************************/
2006-12-19 22:56:18 +00:00
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "handler.h"
#include "db.h"
#include "genolc.h"
#include "oasis.h"
#include "improved-edit.h"
/* Free's strings from any object, room, mobiles, or player. TRUE if successful,
* otherwise, it returns FALSE. Type - The OLC type constant relating to the
* data type of data. */
2006-12-19 22:56:18 +00:00
int free_strings(void *data, int type)
{
struct room_data *room;
struct config_data *config;
int i;
2006-12-19 22:56:18 +00:00
switch (type) {
case OASIS_WLD:
room = (struct room_data *) data;
2006-12-19 22:56:18 +00:00
/* Free Descriptions */
if (room->name)
free(room->name);
if (room->description)
2006-12-19 22:56:18 +00:00
free(room->description);
if (room->ex_description)
2006-12-19 22:56:18 +00:00
free_ex_descriptions(room->ex_description);
/* Return the return value of free_strings(). */
return (free_strings(room, OASIS_EXI));
2006-12-19 22:56:18 +00:00
case OASIS_EXI:
room = (struct room_data *) data;
2006-12-19 22:56:18 +00:00
for (i = 0; i < NUM_OF_DIRS; i++) {
if (room->dir_option[i]) {
if (room->dir_option[i]->general_description) {
free(room->dir_option[i]->general_description);
room->dir_option[i]->general_description = NULL;
}
if (room->dir_option[i]->keyword) {
free(room->dir_option[i]->keyword);
room->dir_option[i]->keyword = NULL;
}
2006-12-19 22:56:18 +00:00
free(room->dir_option[i]);
room->dir_option[i] = NULL;
}
}
2006-12-19 22:56:18 +00:00
return (TRUE);
2006-12-19 22:56:18 +00:00
case OASIS_MOB:
case OASIS_OBJ:
return (FALSE); /* For now... */
2006-12-19 22:56:18 +00:00
case OASIS_CFG:
config = (struct config_data *) data;
2006-12-19 22:56:18 +00:00
if (config->play.OK)
free(config->play.OK);
2006-12-19 22:56:18 +00:00
if (config->play.NOPERSON)
free(config->play.NOPERSON);
2006-12-19 22:56:18 +00:00
if (config->play.NOEFFECT)
free(config->play.NOEFFECT);
2006-12-19 22:56:18 +00:00
if (config->operation.DFLT_IP)
free(config->operation.DFLT_IP);
2006-12-19 22:56:18 +00:00
if (config->operation.DFLT_DIR)
free(config->operation.DFLT_DIR);
2006-12-19 22:56:18 +00:00
if (config->operation.LOGNAME)
free(config->operation.LOGNAME);
2006-12-19 22:56:18 +00:00
if (config->operation.MENU)
free(config->operation.MENU);
2006-12-19 22:56:18 +00:00
if (config->operation.WELC_MESSG)
free(config->operation.WELC_MESSG);
2006-12-19 22:56:18 +00:00
if (config->operation.START_MESSG)
free(config->operation.START_MESSG);
2006-12-19 22:56:18 +00:00
return (TRUE);
2006-12-19 22:56:18 +00:00
default:
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: oasis_delete.c: free_strings: Invalid type handled (Type %d).", type);
return (FALSE);
}
}