remove circular dependencies between soundevents and gametableimpl
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
#include "sdlplayer.h"
|
||||
#include "configfile.h"
|
||||
#include "gametableimpl.h"
|
||||
#include "session.h"
|
||||
#include "game.h"
|
||||
#include "soundevents.h"
|
||||
|
||||
SoundEvents::SoundEvents(ConfigFile *c, gameTableImpl *w): myConfig(c), myW(w), lastSBValue(0), lastSBLevel(0), lastGameId(0)
|
||||
SoundEvents::SoundEvents(ConfigFile *c): myConfig(c), lastSBValue(0), lastSBLevel(0), newGameNow(false)
|
||||
{
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
}
|
||||
@@ -17,12 +16,11 @@ SoundEvents::~SoundEvents()
|
||||
|
||||
void SoundEvents::blindsWereSet(int sB)
|
||||
{
|
||||
int currentGameId = myW->getSession()->getCurrentGame()->getMyGameID();
|
||||
if(currentGameId != lastGameId)
|
||||
if(newGameNow)
|
||||
{
|
||||
lastSBLevel = 0;
|
||||
lastSBValue = sB;
|
||||
lastGameId = currentGameId;
|
||||
newGameNow = false;
|
||||
}
|
||||
|
||||
if(sB > lastSBValue) {
|
||||
@@ -44,3 +42,8 @@ void SoundEvents::blindsWereSet(int sB)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundEvents::newGameStarts()
|
||||
{
|
||||
newGameNow = true;
|
||||
}
|
||||
|
||||
@@ -3,24 +3,22 @@
|
||||
|
||||
class SDLPlayer;
|
||||
class ConfigFile;
|
||||
class gameTableImpl;
|
||||
class SoundEvents
|
||||
{
|
||||
public:
|
||||
SoundEvents(ConfigFile*, gameTableImpl*);
|
||||
SoundEvents(ConfigFile*);
|
||||
~SoundEvents();
|
||||
|
||||
void blindsWereSet(int sB);
|
||||
|
||||
void newGameStarts();
|
||||
|
||||
private:
|
||||
SDLPlayer *mySDLPlayer;
|
||||
ConfigFile *myConfig;
|
||||
gameTableImpl *myW;
|
||||
|
||||
unsigned int lastSBValue;
|
||||
unsigned int lastSBLevel;
|
||||
unsigned int lastGameId;
|
||||
bool newGameNow;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user