/************************************************************************** * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. * * * * Merc Diku Mud improvements copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * * * In order to use any part of this Merc Diku Mud, you must comply with * * both the original Diku license in 'license.doc' as well the Merc * * license in 'license.txt'. In particular, you may not remove either of * * these copyright notices. * * * * Much time and thought has gone into this software and you are * * benefiting. We hope that you share your changes too. What goes * * around, comes around. * *************************************************************************** * ROM 2.4 is copyright 1993-1998 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@hypercube.org) * * Gabrielle Taylor (gtaylor@hypercube.org) * * Brian Moore (zump@rom.org) * * By using this code, you have agreed to follow the terms of the * * ROM license, in the file Rom24/doc/rom.license * *************************************************************************** * 1stMUD ROM Derivative (c) 2001-2003 by Ryan Jennings * * http://1stmud.dlmud.com/ <r-jenn@shaw.ca> * ***************************************************************************/ #include "merc.h" #include "olc.h" #include "lookup.h" #include "recycle.h" #include "interp.h" #include "globals.h" #include "tables.h" #include "music.h" OLCED(songedit_show) { int lines; SONG_DATA *pSong; BUFFER *buffer; EDIT_SONG(ch, pSong); buffer = new_buf(); bprintlnf(buffer, "Name : %s", pSong->name); bprintlnf(buffer, "Band : %s", pSong->group); bprintln(buffer, "Lyrics:"); for (lines = 0; lines < MAX_LINES; lines++) { if (pSong->lyrics[lines] == NULL) break; bprintln(buffer, pSong->lyrics[lines]); } sendpage(ch, buf_string(buffer)); free_buf(buffer); return TRUE; } OLCED(songedit_lyrics) { char arg[MIL]; SONG_DATA *pSong; EDIT_SONG(ch, pSong); argument = one_argument(argument, arg); if (IS_NULLSTR(arg)) { chprintln(ch, "Syntax: lyrics + <string> or lyrics -"); return FALSE; } if (!str_cmp(arg, "+")) { if (IS_NULLSTR(argument)) { chprintln(ch, "No Blank Lines."); return FALSE; } if (pSong->lines >= MAX_LINES) { chprintln(ch, "I'm afraid you can't add any more lines."); return FALSE; } replace_string(pSong->lyrics[pSong->lines], argument); pSong->lines += 1; chprintln(ch, "Ok."); return TRUE; } if (!str_cmp(arg, "-")) { pSong->lines -= 1; if (pSong->lines < 0) { pSong->lines = 0; chprintln(ch, "Lyrics Cleared."); return FALSE; } replace_string(pSong->lyrics[pSong->lines], " "); chprintln(ch, "Line Deleted."); return TRUE; } chprintln(ch, "Type lyrics + <string> or lyrics -"); return FALSE; } OLCED(songedit_create) { int j, i = maxSongs; SONG_DATA *pSong; struct song_data *new_table; char buf[MIL]; if (!IS_NULLSTR(argument) && song_lookup(argument) == -1) sprintf(buf, argument); else sprintf(buf, "New Song%d", maxSongs + 1); maxSongs++; alloc_mem(new_table, struct song_data, maxSongs); if (!new_table) { chprintln(ch, "Memory Allocation Failed!!! Unable to create song."); return FALSE; } for (j = 0; j < i; j++) new_table[j] = song_table[j]; free_mem(song_table); song_table = new_table; song_table[i].name = str_dup(buf); song_table[i].group = &str_empty[0]; for (j = 0; j < MAX_LINES; j++) song_table[i].lyrics[j] = NULL; pSong = &song_table[i]; song_table[maxSongs].name = NULL; edit_start(ch, pSong, ED_SONG); chprintln(ch, "Song created."); return TRUE; } OLCED(songedit_delete) { SONG_DATA *pSong; EDIT_SONG(ch, pSong); if (str_cmp(argument, "confirm")) { chprintln (ch, "Typing 'delete confirm' again will permanetely remove this command!"); return FALSE; } else { int i, j = 0, c; struct song_data *new_table; alloc_mem(new_table, struct song_data, maxSongs); if (!new_table) { chprintln(ch, "Memory Allocation error!!! Unable to delete liquid."); return FALSE; } c = song_lookup(pSong->name); for (i = 0; i < maxSongs; i++) if (i != c) new_table[j++] = song_table[i]; free_mem(song_table); song_table = new_table; maxSongs--; pSong = &song_table[0]; ch->desc->pEdit = (void *) pSong; chprintln(ch, "Song deleted."); } return TRUE; }