remove circular dependencies between soundevents and gametableimpl

This commit is contained in:
doitux
2012-01-01 19:55:22 +00:00
parent 6a3ffc1f29
commit cbb72bc06a
6 changed files with 28 additions and 14 deletions
+8 -5
View File
@@ -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 -5
View File
@@ -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;
};