Hey, i noticed that the mud's date always reset when the game restarted.
This si what i did to fix that.
Add this to structs.h:
----------------------
struct time_write {
int year, month, day;
};
Put this right under the line "tics++" in comm.c:
-------------------------------------------------
write_mud_date_to_file();
Add this function and prototype it in comm.c:
---------------------------------------------
void write_mud_date_to_file(void)
{
FILE *f;
struct time_write date;
f = fopen("etc/date_record", "w");
date.year = time_info.year;
date.month = time_info.month;
date.day = time_info.day;
fwrite(&date,sizeof(struct time_write),1,f);
fclose(f);
}
Add this line in the reset time function right after time_info = <blah> in
db.c:
----------------------------------------------------------------------------
----
read_mud_date_from_file();
Add this function and prototype it in db.c:
-------------------------------------------
void read_mud_date_from_file(void)
{
FILE *f;
struct time_write read_date;
f = fopen("etc/date_record", "r");
if(!f) {
log("SYSERR: File etc/date_record not found, mud date will be reset
to default!");
return;
}
fread(&read_date, sizeof(struct time_write), 1, f);
time_info.year = read_date.year;
time_info.month = read_date.month;
time_info.day = read_date.day;
fclose(f);
}
Chuck
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST