|
@@ -127,6 +127,7 @@ typedef MiniGameV *( *GetMiniGame )( );
|
|
// Inhalt der MGLaden Klasse aus MiniGames.h
|
|
// Inhalt der MGLaden Klasse aus MiniGames.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
MGSuchen::MGSuchen( MiniGames *mGames )
|
|
MGSuchen::MGSuchen( MiniGames *mGames )
|
|
|
|
+ : Thread()
|
|
{
|
|
{
|
|
this->mGames = mGames;
|
|
this->mGames = mGames;
|
|
start();
|
|
start();
|
|
@@ -161,18 +162,18 @@ void MGSuchen::thread()
|
|
list->release();
|
|
list->release();
|
|
}
|
|
}
|
|
d->release();
|
|
d->release();
|
|
- delete this;
|
|
|
|
|
|
+ release();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// Inhalt der MGLaden Klasse aus MiniGameV.h
|
|
// Inhalt der MGLaden Klasse aus MiniGameV.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
MGLaden::MGLaden( char *name, DLLDateien *zDLLs, API *api )
|
|
MGLaden::MGLaden( char *name, DLLDateien *zDLLs, API *api )
|
|
|
|
+ : Thread()
|
|
{
|
|
{
|
|
this->api = api;
|
|
this->api = api;
|
|
this->name = new Text( name );
|
|
this->name = new Text( name );
|
|
game = 0;
|
|
game = 0;
|
|
- ref = 1;
|
|
|
|
dLLs = zDLLs->getThis();
|
|
dLLs = zDLLs->getThis();
|
|
start();
|
|
start();
|
|
}
|
|
}
|
|
@@ -197,27 +198,23 @@ void MGLaden::thread()
|
|
if( !DateiExistiert( pfad->getThis() ) )
|
|
if( !DateiExistiert( pfad->getThis() ) )
|
|
{
|
|
{
|
|
pfad->release();
|
|
pfad->release();
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
pfad->append( "/mg.ini" );
|
|
pfad->append( "/mg.ini" );
|
|
if( !DateiExistiert( pfad->getThis() ) )
|
|
if( !DateiExistiert( pfad->getThis() ) )
|
|
{
|
|
{
|
|
pfad->release();
|
|
pfad->release();
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
InitDatei *mgIni = new InitDatei( pfad );
|
|
InitDatei *mgIni = new InitDatei( pfad );
|
|
if( !mgIni->laden() )
|
|
if( !mgIni->laden() )
|
|
{
|
|
{
|
|
mgIni->release();
|
|
mgIni->release();
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if( !mgIni->wertExistiert( "DllPfad" ) )
|
|
if( !mgIni->wertExistiert( "DllPfad" ) )
|
|
{
|
|
{
|
|
mgIni->release();
|
|
mgIni->release();
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Text *dllPfad = new Text( "data/Minigames/" );
|
|
Text *dllPfad = new Text( "data/Minigames/" );
|
|
@@ -228,28 +225,22 @@ void MGLaden::thread()
|
|
if( !DateiExistiert( dllPfad->getThis() ) )
|
|
if( !DateiExistiert( dllPfad->getThis() ) )
|
|
{
|
|
{
|
|
dllPfad->release();
|
|
dllPfad->release();
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
HMODULE dll = dLLs->ladeDLL( name->getText(), dllPfad->getText() );
|
|
HMODULE dll = dLLs->ladeDLL( name->getText(), dllPfad->getText() );
|
|
dllPfad->release();
|
|
dllPfad->release();
|
|
if( !dll )
|
|
if( !dll )
|
|
- {
|
|
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
- }
|
|
|
|
GetMiniGame getMiniGame = (GetMiniGame)GetProcAddress( dll, "GetMiniGame" );
|
|
GetMiniGame getMiniGame = (GetMiniGame)GetProcAddress( dll, "GetMiniGame" );
|
|
if( !getMiniGame )
|
|
if( !getMiniGame )
|
|
{
|
|
{
|
|
dLLs->releaseDLL( name->getText() );
|
|
dLLs->releaseDLL( name->getText() );
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
game = getMiniGame();
|
|
game = getMiniGame();
|
|
if( !game )
|
|
if( !game )
|
|
{
|
|
{
|
|
dLLs->releaseDLL( name->getText() );
|
|
dLLs->releaseDLL( name->getText() );
|
|
- run = 0;
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
game->setMinigameClientZ( new MSCWrapper() );
|
|
game->setMinigameClientZ( new MSCWrapper() );
|
|
@@ -259,7 +250,6 @@ void MGLaden::thread()
|
|
game = game->release();
|
|
game = game->release();
|
|
dLLs->releaseDLL( name->getText() );
|
|
dLLs->releaseDLL( name->getText() );
|
|
}
|
|
}
|
|
- run = 0;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// constant
|
|
// constant
|
|
@@ -273,21 +263,6 @@ MiniGameV *MGLaden::zGame() const
|
|
return game;
|
|
return game;
|
|
}
|
|
}
|
|
|
|
|
|
-// Reference Counting
|
|
|
|
-MGLaden *MGLaden::getThis()
|
|
|
|
-{
|
|
|
|
- ref++;
|
|
|
|
- return this;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-MGLaden *MGLaden::release()
|
|
|
|
-{
|
|
|
|
- ref--;
|
|
|
|
- if( !ref )
|
|
|
|
- delete this;
|
|
|
|
- return 0;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
// Inhalt der MiniGames Klasse aus MiniGames.h
|
|
// Inhalt der MiniGames Klasse aus MiniGames.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
@@ -295,7 +270,7 @@ MiniGames::MiniGames( Schrift *zSchrift, DLLDateien *zDLLs, Bildschirm *screen,
|
|
: Zeichnung()
|
|
: Zeichnung()
|
|
{
|
|
{
|
|
this->api = api;
|
|
this->api = api;
|
|
- this->screen = screen->getThis();
|
|
|
|
|
|
+ this->screen = screen;
|
|
dLLs = zDLLs->getThis();
|
|
dLLs = zDLLs->getThis();
|
|
schrift = zSchrift->getThis();
|
|
schrift = zSchrift->getThis();
|
|
bildschirmGröße = BildschirmGröße();
|
|
bildschirmGröße = BildschirmGröße();
|
|
@@ -306,8 +281,7 @@ MiniGames::MiniGames( Schrift *zSchrift, DLLDateien *zDLLs, Bildschirm *screen,
|
|
tickVal = 0;
|
|
tickVal = 0;
|
|
games = new RCArray< MiniGame >();
|
|
games = new RCArray< MiniGame >();
|
|
mgl = 0;
|
|
mgl = 0;
|
|
- ref = 1;
|
|
|
|
- new MGSuchen( getThis() );
|
|
|
|
|
|
+ new MGSuchen( (MiniGames*)getThis() );
|
|
}
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
// Destruktor
|
|
@@ -320,7 +294,6 @@ MiniGames::~MiniGames()
|
|
if( mgl )
|
|
if( mgl )
|
|
mgl->release();
|
|
mgl->release();
|
|
dLLs->release();
|
|
dLLs->release();
|
|
- screen->release();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
// nicht constant
|
|
@@ -366,7 +339,7 @@ void MiniGames::doMausEreignis( MausEreignis &me )
|
|
if( !vera && me.verarbeitet && me.id == ME_RLinks )
|
|
if( !vera && me.verarbeitet && me.id == ME_RLinks )
|
|
{ // spiel starten
|
|
{ // spiel starten
|
|
if( mgl )
|
|
if( mgl )
|
|
- mgl = mgl->release();
|
|
|
|
|
|
+ mgl = (MGLaden*)mgl->release();
|
|
mgl = new MGLaden( games->z( i )->zName()->getText(), dLLs, api );
|
|
mgl = new MGLaden( games->z( i )->zName()->getText(), dLLs, api );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -389,19 +362,19 @@ bool MiniGames::tick( double z )
|
|
{
|
|
{
|
|
if( !mgl->zGame() )
|
|
if( !mgl->zGame() )
|
|
{
|
|
{
|
|
- mgl = mgl->release();
|
|
|
|
|
|
+ mgl = (MGLaden*)mgl->release();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
mgl->zGame()->setSchriftZ( schrift->getThis() );
|
|
mgl->zGame()->setSchriftZ( schrift->getThis() );
|
|
- mgl->zGame()->setBildschirmZ( screen->getThis() );
|
|
|
|
|
|
+ mgl->zGame()->setBildschirmZ( screen );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if( mgl && mgl->zGame() && !alpha2 )
|
|
if( mgl && mgl->zGame() && !alpha2 )
|
|
{
|
|
{
|
|
rend |= mgl->zGame()->tick( z );
|
|
rend |= mgl->zGame()->tick( z );
|
|
if( mgl->zGame()->istEnde() )
|
|
if( mgl->zGame()->istEnde() )
|
|
- mgl = mgl->release();
|
|
|
|
|
|
+ mgl = (MGLaden*)mgl->release();
|
|
}
|
|
}
|
|
if( alpha2 )
|
|
if( alpha2 )
|
|
{
|
|
{
|
|
@@ -453,19 +426,4 @@ void MiniGames::render( Bild &zRObj )
|
|
zRObj.releaseDrawOptions();
|
|
zRObj.releaseDrawOptions();
|
|
if( mgl && mgl->fertig() && mgl->zGame() )
|
|
if( mgl && mgl->fertig() && mgl->zGame() )
|
|
mgl->zGame()->render( zRObj );
|
|
mgl->zGame()->render( zRObj );
|
|
-}
|
|
|
|
-
|
|
|
|
-// Reference Counting
|
|
|
|
-MiniGames *MiniGames::getThis()
|
|
|
|
-{
|
|
|
|
- ref++;
|
|
|
|
- return this;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-MiniGames *MiniGames::release()
|
|
|
|
-{
|
|
|
|
- ref--;
|
|
|
|
- if( !ref )
|
|
|
|
- delete this;
|
|
|
|
- return 0;
|
|
|
|
}
|
|
}
|