diff options
author | Eugene Sandulenko | 2007-12-28 07:43:52 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2007-12-28 07:43:52 +0000 |
commit | ef319ad6745678275a4c5eb159d6d95fdf17649f (patch) | |
tree | 216cba22fab48bcce82cdf12edcd95a74f6afb21 /engines/scumm | |
parent | d4d072fe0484918b6caf4571b933a9b374177e5b (diff) | |
download | scummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.tar.gz scummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.tar.bz2 scummvm-rg350-ef319ad6745678275a4c5eb159d6d95fdf17649f.zip |
Patch #1859448: Add OSystem::getTimeAndDate API
svn-id: r30034
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/saveload.cpp | 23 | ||||
-rw-r--r-- | engines/scumm/script_v6.cpp | 21 |
2 files changed, 21 insertions, 23 deletions
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 629ac31901..9e979cbab9 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/config-manager.h" #include "common/savefile.h" #include "common/system.h" @@ -555,10 +553,12 @@ bool ScummEngine::loadInfos(Common::InSaveFile *file, InfoStuff *stuff) { // For header version 1, we load the data in with our old method if (section.version == 1) { - time_t tmp = section.timeTValue; - tm *curTime = localtime(&tmp); - stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF; - stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF; + //time_t tmp = section.timeTValue; + //tm *curTime = localtime(&tmp); + //stuff->date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF; + //stuff->time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF; + stuff->date = 0; + stuff->time = 0; } if (section.version >= 2) { @@ -588,11 +588,12 @@ void ScummEngine::saveInfos(Common::OutSaveFile* file) { // still save old format for older versions section.timeTValue = time(0); section.playtime = _system->getMillis() / 1000 - _engineStartTime; - - time_t curTime_ = time(0); - tm *curTime = localtime(&curTime_); - section.date = (curTime->tm_mday & 0xFF) << 24 | ((curTime->tm_mon + 1) & 0xFF) << 16 | (curTime->tm_year + 1900) & 0xFFFF; - section.time = (curTime->tm_hour & 0xFF) << 8 | (curTime->tm_min) & 0xFF; + + tm curTime; + _system->getTimeAndDate(curTime); + + section.date = (curTime.tm_mday & 0xFF) << 24 | ((curTime.tm_mon + 1) & 0xFF) << 16 | (curTime.tm_year + 1900) & 0xFFFF; + section.time = (curTime.tm_hour & 0xFF) << 8 | (curTime.tm_min) & 0xFF; file->writeUint32BE(section.type); file->writeUint32BE(section.version); diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 8696b83fe2..4a2e8fd0bb 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -23,9 +23,8 @@ * */ - - #include "common/config-manager.h" +#include "common/system.h" #include "scumm/actor.h" #include "scumm/charset.h" @@ -3003,19 +3002,17 @@ void ScummEngine_v6::o6_pickVarRandom() { } void ScummEngine_v6::o6_getDateTime() { - struct tm *t; - time_t now = time(NULL); - - t = localtime(&now); + struct tm t; + _system->getTimeAndDate(t); - VAR(VAR_TIMEDATE_YEAR) = t->tm_year; - VAR(VAR_TIMEDATE_MONTH) = t->tm_mon; - VAR(VAR_TIMEDATE_DAY) = t->tm_mday; - VAR(VAR_TIMEDATE_HOUR) = t->tm_hour; - VAR(VAR_TIMEDATE_MINUTE) = t->tm_min; + VAR(VAR_TIMEDATE_YEAR) = t.tm_year; + VAR(VAR_TIMEDATE_MONTH) = t.tm_mon; + VAR(VAR_TIMEDATE_DAY) = t.tm_mday; + VAR(VAR_TIMEDATE_HOUR) = t.tm_hour; + VAR(VAR_TIMEDATE_MINUTE) = t.tm_min; if (_game.version == 8) - VAR(VAR_TIMEDATE_SECOND) = t->tm_sec; + VAR(VAR_TIMEDATE_SECOND) = t.tm_sec; } void ScummEngine_v6::o6_getPixel() { |