- improved timer information output in debugger
- fixed timer data loading svn-id: r31215
This commit is contained in:
parent
2a4aa9c379
commit
5107404089
3 changed files with 16 additions and 2 deletions
|
@ -179,8 +179,9 @@ bool Debugger_v1::cmd_queryFlag(int argc, const char **argv) {
|
|||
}
|
||||
|
||||
bool Debugger_v1::cmd_listTimers(int argc, const char **argv) {
|
||||
DebugPrintf("Current time: %-8u\n", g_system->getMillis());
|
||||
for (int i = 0; i < _vm->timer()->count(); i++)
|
||||
DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i));
|
||||
DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i %-8u\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i), _vm->timer()->getNextRun(i));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ struct TimerResync : public Common::UnaryFunction<TimerEntry&, void> {
|
|||
|
||||
void operator()(TimerEntry &entry) const {
|
||||
if (entry.lastUpdate < 0) {
|
||||
if ((entry.lastUpdate + _curTime) <= 0)
|
||||
if ((uint32)(ABS(entry.lastUpdate)) >= entry.countdown * _tickLength)
|
||||
entry.nextRun = 0;
|
||||
else
|
||||
entry.nextRun = _curTime + entry.lastUpdate + entry.countdown * _tickLength;
|
||||
|
@ -164,6 +164,17 @@ int32 TimerManager::getDelay(uint8 id) const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint32 TimerManager::getNextRun(uint8 id) const {
|
||||
debugC(9, kDebugLevelTimer, "TimerManager::getNextRun(%d)", id);
|
||||
|
||||
CIterator timer = Common::find_if(_timers.begin(), _timers.end(), TimerEqual(id));
|
||||
if (timer != _timers.end())
|
||||
return timer->nextRun;
|
||||
|
||||
warning("TimerManager::getNextRun: No timer %d", id);
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool TimerManager::isEnabled(uint8 id) const {
|
||||
debugC(9, kDebugLevelTimer, "TimerManager::isEnabled(%d)", id);
|
||||
|
||||
|
@ -232,6 +243,7 @@ void TimerManager::loadDataFromFile(Common::InSaveFile *file, int version) {
|
|||
timer->enabled = file->readByte();
|
||||
timer->countdown = file->readSint32BE();
|
||||
timer->lastUpdate = file->readSint32BE();
|
||||
debug("%d %d", id, timer->lastUpdate);
|
||||
} else {
|
||||
warning("Loading timer data for non existing timer %d", id);
|
||||
file->seek(7, SEEK_CUR);
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
void setCountdown(uint8 id, int32 countdown);
|
||||
void setDelay(uint8 id, int32 countdown);
|
||||
int32 getDelay(uint8 id) const;
|
||||
uint32 getNextRun(uint8 id) const;
|
||||
|
||||
bool isEnabled(uint8 id) const;
|
||||
void enable(uint8 id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue