Found it. Anyone have a recommendation for hosting all of our downloads? Every time I pick a solution it goes under in a year or two and is no longer supported. I'm thinking maybe just Google drive. Thoughts?
Code:
V1.00
Hello! Welcome to my patch command. This combines the current news and changelog command and takes them to a better system.
First off, the patch commad just allows you to type what you just type. patch Warriors damage Whirlwind damage has been reduced. Now where will that appear? That will now show up in the News file. The players (news) icon will now show up in their prompt showing a new update. Now lets get this patch underway:
1). Open act.wizard.c and go to the end of the file:
ACMD(do_patch)
{
time_t rawtime;
char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE],
buf[READ_SIZE];
FILE *fl, *new;
skip_spaces(&argument);
if (!*argument) {
send_to_char(ch, "Usage: patch <change>\r\n");
return;
}
sprintf(buf, "%s.bak", NEWS_FILE);
if (rename(NEWS_FILE, buf)) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error making backup news file (%s)", buf);
return;
}
if (!(fl = fopen(buf, "r"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening backup news file (%s)", buf);
return;
}
if (!(new = fopen(NEWS_FILE, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening new news file (%s)", NEWS_FILE);
return;
}
while (get_line(fl, line)) {
if (*line != '[')
fprintf(new, "%s\n", line);
else {
strcpy(last_buf, line);
break;
}
}
rawtime = time(0);
strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime));
sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch));
fprintf(new, "%s\n", buf);
fprintf(new, "%s\n", argument);
if (strcmp(buf, last_buf))
fprintf(new, "%s\n", line);
while (get_line(fl, line))
fprintf(new, "%s\n", line);
fclose(fl);
fclose(new);
reboot_news();
}
2. Close act.wizard.c
3. open act.h and under do_zunlock add:
ACMD(do_patch)
4. close act.h and open interpreter.c
5. search pardon and under it add:
{ "patch" , "patch" , POS_DEAD , do_patch , LVL_IMPL, 0 },
6. close interpreter.c and open db.c
7. search reboot_wizlists and under it add:
void reboot_news(void)
{
file_to_string_alloc(NEWS_FILE, &news);
}
8. close db.c and open db.h
9. search reboot_wizlists and under it add:
void reboot_news(void);
10. close db.h and compile. :)
I hope you like this. I think it brings use to the news file. :)
- Liko 4/25/2014