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