1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix compilation using older SDL library

This commit is contained in:
Ivan Savenko 2022-11-13 14:59:28 +02:00
parent 38b8fc0af8
commit 2324148187
2 changed files with 6 additions and 6 deletions

View File

@ -530,7 +530,7 @@ void CMusicHandler::musicFinishedCallback()
MusicEntry::MusicEntry(CMusicHandler *owner, std::string setName, std::string musicURI, bool looped, bool fromStart): MusicEntry::MusicEntry(CMusicHandler *owner, std::string setName, std::string musicURI, bool looped, bool fromStart):
owner(owner), owner(owner),
music(nullptr), music(nullptr),
startTime(uint64_t(-1)), startTime(uint32_t(-1)),
startPosition(0), startPosition(0),
loop(looped ? -1 : 1), loop(looped ? -1 : 1),
fromStart(fromStart), fromStart(fromStart),
@ -600,7 +600,7 @@ bool MusicEntry::play()
return false; return false;
} }
startTime = SDL_GetTicks64(); startTime = SDL_GetTicks();
return true; return true;
} }
@ -609,8 +609,8 @@ bool MusicEntry::stop(int fade_ms)
if (Mix_PlayingMusic()) if (Mix_PlayingMusic())
{ {
loop = 0; loop = 0;
uint64_t endTime = SDL_GetTicks64(); uint32_t endTime = SDL_GetTicks();
assert(startTime != uint64_t(-1)); assert(startTime != uint32_t(-1));
float playDuration = (endTime - startTime + startPosition) / 1000.f; float playDuration = (endTime - startTime + startPosition) / 1000.f;
owner->trackPositions[currentName] = playDuration; owner->trackPositions[currentName] = playDuration;
logGlobal->info("Stopping music file %s at %f", currentName, playDuration); logGlobal->info("Stopping music file %s at %f", currentName, playDuration);

View File

@ -100,8 +100,8 @@ class MusicEntry
int loop; // -1 = indefinite int loop; // -1 = indefinite
bool fromStart; bool fromStart;
uint64_t startTime; uint32_t startTime;
uint64_t startPosition; uint32_t startPosition;
//if not null - set from which music will be randomly selected //if not null - set from which music will be randomly selected
std::string setName; std::string setName;
std::string currentName; std::string currentName;