void free_room_index (ROOM_INDEX_DATA * pRoom) { int door; EXTRA_DESCR_DATA *pExtra; RESET_DATA *pReset; free_string (pRoom->name); free_string (pRoom->description); free_string (pRoom->owner); for (door = 0; door < MAX_DIR; door++) { if (pRoom->exit[door]) free_exit (pRoom->exit[door]); } for (pExtra = pRoom->extra_descr; pExtra; pExtra = pExtra->next) { free_extra_descr (pExtra); } for (pReset = pRoom->reset_first; pReset; pReset = pReset->next) { free_reset_data (pReset); } pRoom->next = room_index_free; room_index_free = pRoom; return; }
static void free_stmt(PLpgSQL_stmt *stmt) { switch ((enum PLpgSQL_stmt_types) stmt->cmd_type) { case PLPGSQL_STMT_BLOCK: free_block((PLpgSQL_stmt_block *) stmt); break; case PLPGSQL_STMT_ASSIGN: free_assign((PLpgSQL_stmt_assign *) stmt); break; case PLPGSQL_STMT_IF: free_if((PLpgSQL_stmt_if *) stmt); break; case PLPGSQL_STMT_CASE: free_case((PLpgSQL_stmt_case *) stmt); break; case PLPGSQL_STMT_LOOP: free_loop((PLpgSQL_stmt_loop *) stmt); break; case PLPGSQL_STMT_WHILE: free_while((PLpgSQL_stmt_while *) stmt); break; case PLPGSQL_STMT_FORI: free_fori((PLpgSQL_stmt_fori *) stmt); break; case PLPGSQL_STMT_FORS: free_fors((PLpgSQL_stmt_fors *) stmt); break; case PLPGSQL_STMT_FORC: free_forc((PLpgSQL_stmt_forc *) stmt); break; case PLPGSQL_STMT_FOREACH_A: free_foreach_a((PLpgSQL_stmt_foreach_a *) stmt); break; case PLPGSQL_STMT_EXIT: free_exit((PLpgSQL_stmt_exit *) stmt); break; case PLPGSQL_STMT_RETURN: free_return((PLpgSQL_stmt_return *) stmt); break; case PLPGSQL_STMT_RETURN_NEXT: free_return_next((PLpgSQL_stmt_return_next *) stmt); break; case PLPGSQL_STMT_RETURN_QUERY: free_return_query((PLpgSQL_stmt_return_query *) stmt); break; case PLPGSQL_STMT_RAISE: free_raise((PLpgSQL_stmt_raise *) stmt); break; case PLPGSQL_STMT_ASSERT: free_assert((PLpgSQL_stmt_assert *) stmt); break; case PLPGSQL_STMT_EXECSQL: free_execsql((PLpgSQL_stmt_execsql *) stmt); break; case PLPGSQL_STMT_DYNEXECUTE: free_dynexecute((PLpgSQL_stmt_dynexecute *) stmt); break; case PLPGSQL_STMT_DYNFORS: free_dynfors((PLpgSQL_stmt_dynfors *) stmt); break; case PLPGSQL_STMT_GETDIAG: free_getdiag((PLpgSQL_stmt_getdiag *) stmt); break; case PLPGSQL_STMT_OPEN: free_open((PLpgSQL_stmt_open *) stmt); break; case PLPGSQL_STMT_FETCH: free_fetch((PLpgSQL_stmt_fetch *) stmt); break; case PLPGSQL_STMT_CLOSE: free_close((PLpgSQL_stmt_close *) stmt); break; case PLPGSQL_STMT_PERFORM: free_perform((PLpgSQL_stmt_perform *) stmt); break; default: elog(ERROR, "unrecognized cmd_type: %d", stmt->cmd_type); break; } }
/*************************************************************************** * change_exit * * change the values of an exit ***************************************************************************/ static bool change_exit(struct char_data *ch, const char *argument, int door) { struct room_index_data *room; char command[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH]; int value; EDIT_ROOM(ch, room); /* set the exit flags - needs full argument */ if ((value = flag_value(exit_flags, argument)) != NO_FLAG) { struct room_index_data *pToRoom; int rev; if (!room->exit[door]) { send_to_char("Exit does not exist.\n\r", ch); return false; } /* this room */ TOGGLE_BIT(room->exit[door]->rs_flags, value); room->exit[door]->exit_info = room->exit[door]->rs_flags; /* connected room */ pToRoom = room->exit[door]->u1.to_room; rev = rev_dir[door]; if (pToRoom->exit[rev] != NULL) { pToRoom->exit[rev]->rs_flags = room->exit[door]->rs_flags; pToRoom->exit[rev]->exit_info = room->exit[door]->exit_info; } send_to_char("Exit flag toggled.\n\r", ch); return true; } /* parse the arguments */ argument = one_argument(argument, command); one_argument(argument, arg); if (command[0] == '\0' && argument[0] == '\0') { move_char(ch, door, true); return false; } if (command[0] == '?') { show_help(ch->desc, "OLC_EXIT", NULL); return false; } if (!str_cmp(command, "delete")) { struct room_index_data *pToRoom; int rev; if (!room->exit[door]) { send_to_char("REdit: Cannot delete a null exit.\n\r", ch); return false; } /* remove ToRoom exit */ rev = rev_dir[door]; pToRoom = room->exit[door]->u1.to_room; if (pToRoom->exit[rev]) { free_exit(pToRoom->exit[rev]); pToRoom->exit[rev] = NULL; } /* remove this exit */ free_exit(room->exit[door]); room->exit[door] = NULL; send_to_char("Exit unlinked.\n\r", ch); return true; } if (!str_cmp(command, "link")) { struct exit_data *pExit; struct room_index_data *toRoom; if (arg[0] == '\0' || !is_number(arg)) { send_to_char("Syntax: [direction] link [vnum]\n\r", ch); return false; } value = parse_int(arg); if (!(toRoom = get_room_index(value))) { send_to_char("REdit: Cannot link to non-existant room.\n\r", ch); return false; } if (!IS_BUILDER(ch, toRoom->area)) { send_to_char("REdit: Cannot link to that area.\n\r", ch); return false; } if (toRoom->exit[rev_dir[door]]) { send_to_char("REdit: Remote side's exit already exists.\n\r", ch); return false; } if (!room->exit[door]) room->exit[door] = new_exit(); room->exit[door]->u1.to_room = toRoom; room->exit[door]->orig_door = door; door = rev_dir[door]; pExit = new_exit(); pExit->u1.to_room = room; pExit->orig_door = door; toRoom->exit[door] = pExit; send_to_char("Two-way link established.\n\r", ch); return true; } if (!str_cmp(command, "dig")) { char buf[MAX_STRING_LENGTH]; if (arg[0] == '\0' || !is_number(arg)) { send_to_char("Syntax: [direction] dig <vnum>\n\r", ch); return false; } redit_create(ch, arg); sprintf(buf, "link %s", arg); change_exit(ch, buf, door); return true; } if (!str_cmp(command, "room")) { struct room_index_data *toRoom; if (arg[0] == '\0' || !is_number(arg)) { send_to_char("Syntax: [direction] room [vnum]\n\r", ch); return false; } value = parse_int(arg); if (!(toRoom = get_room_index(value))) { send_to_char("REdit: Cannot link to non-existant room.\n\r", ch); return false; } if (!room->exit[door]) room->exit[door] = new_exit(); room->exit[door]->u1.to_room = toRoom; room->exit[door]->orig_door = door; send_to_char("One-way link established.\n\r", ch); return true; } if (!str_cmp(command, "key")) { struct objectprototype *key; if (arg[0] == '\0' || !is_number(arg)) { send_to_char("Syntax: [direction] key [vnum]\n\r", ch); return false; } if (!room->exit[door]) { send_to_char("Exit does not exist.\n\r", ch); return false; } value = parse_int(arg); if (!(key = objectprototype_getbyvnum(value))) { send_to_char("REdit: Key doesn't exist.\n\r", ch); return false; } if (key->item_type != ITEM_KEY) { send_to_char("REdit: Object is not a key.\n\r", ch); return false; } room->exit[door]->key = value; send_to_char("Exit key set.\n\r", ch); return true; } if (!str_cmp(command, "name")) { if (arg[0] == '\0') { send_to_char("Syntax: [direction] name [string]\n\r", ch); send_to_char(" [direction] name none\n\r", ch); return false; } if (!room->exit[door]) { send_to_char("Exit does not exist.\n\r", ch); return false; } free_string(room->exit[door]->keyword); if (str_cmp(arg, "none")) room->exit[door]->keyword = str_dup(arg); else room->exit[door]->keyword = str_dup(""); send_to_char("Exit name set.\n\r", ch); return true; } if (!str_prefix(command, "description")) { if (arg[0] == '\0') { if (!room->exit[door]) { send_to_char("Exit does not exist.\n\r", ch); return false; } string_append(ch, &room->exit[door]->description); return true; } send_to_char("Syntax: [direction] desc\n\r", ch); return false; } return false; }