60 lines
1.8 KiB
Plaintext
60 lines
1.8 KiB
Plaintext
const string CALENDAR_DB = "ala_calendar";
|
|
|
|
const string CALENDAR_YEAR = "year";
|
|
const string CALENDAR_MONTH = "month";
|
|
const string CALENDAR_DAY = "day";
|
|
|
|
const string CALENDAR_HOUR = "hour";
|
|
const string CALENDAR_MINUTE = "minute";
|
|
const string CALENDAR_SECOND = "second";
|
|
const string CALENDAR_MILLISECOND = "msecond";
|
|
|
|
|
|
// Save the current in-game time and date to the database
|
|
void SaveCalendar();
|
|
|
|
// Fetch the last stored in-game time and date from the database
|
|
void LoadCalendar();
|
|
|
|
void SaveCalendar()
|
|
{
|
|
int year = GetCalendarYear();
|
|
int month = GetCalendarMonth();
|
|
int day = GetCalendarDay();
|
|
int hour = GetTimeHour();
|
|
int minute = GetTimeMinute();
|
|
int second = GetTimeSecond();
|
|
int millisecond = GetTimeMillisecond();
|
|
|
|
|
|
// TODO replace with new persistance-system
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_YEAR, year);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_MONTH, month);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_DAY, day);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_HOUR, hour);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_MINUTE, minute);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_SECOND, second);
|
|
SetCampaignInt(CALENDAR_DB, CALENDAR_MILLISECOND, millisecond);
|
|
|
|
}
|
|
|
|
void LoadCalendar()
|
|
{
|
|
int year = GetCampaignInt(CALENDAR_DB, CALENDAR_YEAR);
|
|
int month = GetCampaignInt(CALENDAR_DB, CALENDAR_MONTH);
|
|
int day = GetCampaignInt(CALENDAR_DB, CALENDAR_DAY);
|
|
int hour = GetCampaignInt(CALENDAR_DB, CALENDAR_HOUR);
|
|
int minute = GetCampaignInt(CALENDAR_DB, CALENDAR_MINUTE);
|
|
int second = GetCampaignInt(CALENDAR_DB, CALENDAR_SECOND);
|
|
int millisecond = GetCampaignInt(CALENDAR_DB, CALENDAR_MILLISECOND);
|
|
|
|
if (millisecond != 0 || second != 0 || minute != 0 || hour != 0 || day != 0 || month != 0 || year != 0)
|
|
{
|
|
SetTime(hour, minute, second, millisecond);
|
|
SetCalendar(year, month, day);
|
|
}
|
|
|
|
}
|
|
|
|
//void main(){}
|