Browse Source

Und noch ein paar kleinigkeiten

Kolja Strohm 5 years ago
parent
commit
5fb41ce9ef

+ 18 - 7
Asteroids/Editor/Interface/RightTools/ObjektOptionen/ObjektOptionen.cpp

@@ -12,11 +12,16 @@ ObjektTool::ObjektTool( Schrift *zSchrift, KarteDaten *daten )
     this->daten = daten;
     schrift = zSchrift->getThis();
     objekte = new AuswahlListe();
-    objekte->setStyle( AuswahlListe::Style::Normal | AuswahlBox::Style::VScroll );
+    objekte->setStyle( ( AuswahlListe::Style::Normal & ~AuswahlListe::Style::FeldHAlpha ) | AuswahlBox::Style::VScroll );
     objekte->setRahmenFarbe( 0xFFFFFFFF );
     objekte->setRahmenBreite( 1 );
     objekte->setSchriftZ( zSchrift->getThis() );
     objekte->setSize( 290, 200 );
+    objekte->setAAFFarbe( 0x5500FF00 );
+    objekte->setAAFStrength( -5 );
+    objekte->setALRFarbe( 0xFF00FF00 );
+    objekte->setALRBreite( 1 );
+    objekte->setVertikalKlickScroll( 1 );
     int anz = daten->getObjektAnzahl();
     for( int i = 0; i < anz; i++ )
     {
@@ -75,7 +80,7 @@ ObjektTool::ObjektTool( Schrift *zSchrift, KarteDaten *daten )
         return 1;
     } );
     model = new M2DVorschau();
-    model->setStyle( M2DVorschau::Style::Rahmen | M2DVorschau::Style::UsrRot | M2DVorschau::Style::UsrMove );
+    model->setStyle( M2DVorschau::Style::Rahmen | M2DVorschau::Style::UsrRot | M2DVorschau::Style::UsrMove | M2DVorschau::Style::Erlaubt );
     model->setSize( 290, 290 );
     model->setPosition( 0, 230 );
     changeModel = initKnopf( 0, 520, 142, 20, zSchrift, Knopf::Style::Normal, "Model ändern" );
@@ -86,8 +91,10 @@ ObjektTool::ObjektTool( Schrift *zSchrift, KarteDaten *daten )
             cs.lock();
             if( dialog )
                 dialog->release();
-            dialog = new ResourceDialog( new TextRenderer( schrift->getThis() ), SELECT_MODEL2D, (KarteDaten*)this->daten->getThis(), [ this ]( const char *path )
+            dialog = new ResourceDialog( new TextRenderer( schrift->getThis() ), SELECT_MODEL2D, (KarteDaten *)this->daten->getThis(), [ this ]( const char *path )
             {
+                if( !path )
+                    return;
                 modelPath = path;
                 model->setModel2D( this->daten->loadModelFromPath( modelPath ) );
                 Textur2D *textur = new Textur2D();
@@ -108,6 +115,8 @@ ObjektTool::ObjektTool( Schrift *zSchrift, KarteDaten *daten )
                 dialog->release();
             dialog = new ResourceDialog( new TextRenderer( schrift->getThis() ), SELECT_TEXTUR, (KarteDaten *)this->daten->getThis(), [ this ]( const char *path )
             {
+                if( !path )
+                    return;
                 texturPath = path;
                 Textur2D *textur = new Textur2D();
                 textur->setTexturZ( this->daten->loadBildFromPath( texturPath ) );
@@ -140,7 +149,7 @@ ObjektTool::ObjektTool( Schrift *zSchrift, KarteDaten *daten )
             this->daten->getResourceIdFromPath( modelPath, [ this, o ]( int id )
             {
                 o->m2d = id;
-                this->daten->getResourceIdFromPath( texturPath, [ this, o ]( int id ) 
+                this->daten->getResourceIdFromPath( texturPath, [ this, o ]( int id )
                 {
                     o->bild = id;
                     o->maxStabilität = *stabilität->zText();
@@ -203,8 +212,8 @@ void ObjektTool::doMausEreignis( MausEreignis & me )
     me.my = tmpM.y;
     me.mx -= pos.x;
     me.my -= pos.y;
+    team->doMausEreignis( me );
     int ausw = objekte->getAuswahl();
-    akkuLeistung->doMausEreignis( me );
     objekte->doMausEreignis( me );
     if( objekte->getAuswahl() != ausw && objekte->getAuswahl() >= 0 )
         selectObject( *objekte->zEintrag( objekte->getAuswahl() )->zText() );
@@ -294,7 +303,7 @@ void ObjektTool::render( Bild & rObj )
     }
 }
 
-void ObjektTool::renderDialogs( Bild &rObj )
+void ObjektTool::renderDialogs( Bild & rObj )
 {
     cs.lock();
     if( dialog )
@@ -335,8 +344,10 @@ void ObjektTool::selectObject( int id )
         objekte->setAuswahl( index );
         ObjektDaten *o = daten->getObjekt( daten->getObjektIndexById( id ) );
         model->setModel2D( daten->loadModelFromRessource( o->m2d ) );
+        model->zModel()->addStyle( Model2D::Style::Sichtbar | Model2D::Style::Mesh | Model2D::Style::Erlaubt );
+        model->zModel()->setFarbe( 0xFFFFFFFF );
         modelPath = daten->getResource( daten->getResourceIndexById( o->m2d ) )->path;
-        Textur2D *textur = new Textur2D();
+        Textur2D * textur = new Textur2D();
         textur->setTexturZ( daten->loadBildFromRessource( o->bild ) );
         texturPath = daten->getResource( daten->getResourceIndexById( o->bild ) )->path;
         model->zModel()->setTextur( textur );

+ 1 - 0
Asteroids/Editor/Interface/RightTools/ObjektOptionen/ObjektOptionen.h

@@ -36,6 +36,7 @@ namespace Editor
         ResourceDialog *dialog;
         ResourceDialog *dialog2;
         Punkt screenSize;
+        Critical cs;
 
     public:
         ObjektTool( Schrift *zSchrift, KarteDaten *daten );

+ 8 - 0
Asteroids/Editor/Netzwerk/EditorKlient.cpp

@@ -587,6 +587,7 @@ Bild *EditorKlient::loadBild( const char *templatePath )
         pfad.append( txt.getTeilText( 5 ) );
         if( pfad.hat( ".ltdb/" ) )
         {
+            cs.lock();
             if( klient->deResetPath() )
             {
                 while( pfad.anzahlVon( "/" ) > 1 )
@@ -601,8 +602,10 @@ Bild *EditorKlient::loadBild( const char *templatePath )
                 Bild * res = klient->deBildLaden( datei, bild, 0 );
                 datei->release();
                 bild->release();
+                cs.unlock();
                 return res;
             }
+            cs.unlock();
         }
     }
     error = klient->getLetzterFehler();
@@ -633,6 +636,7 @@ Model2DData *EditorKlient::loadModel( const char *templatePath )
         pfad.append( txt.getTeilText( 5 ) );
         if( pfad.hat( ".m2/" ) )
         {
+            cs.lock();
             if( klient->deResetPath() )
             {
                 while( pfad.anzahlVon( "/" ) > 1 )
@@ -647,8 +651,10 @@ Model2DData *EditorKlient::loadModel( const char *templatePath )
                 Model2DData * res = klient->deModelLaden( datei, model, 0 );
                 datei->release();
                 model->release();
+                cs.unlock();
                 return res;
             }
+            cs.unlock();
         }
     }
     error = klient->getLetzterFehler();
@@ -657,9 +663,11 @@ Model2DData *EditorKlient::loadModel( const char *templatePath )
 
 RCArray< Text > *EditorKlient::getAllMapResourcePaths()
 {
+    cs.lock();
     klient->deResetPath();
     RCArray< Text > *result = new RCArray< Text >();
     loadMapResourcePathsFromFolder( "map:", result );
+    cs.unlock();
     return result;
 }
 

+ 2 - 0
Asteroids/Editor/Netzwerk/EditorKlient.h

@@ -2,6 +2,7 @@
 
 #include <KSGNetwork.h>
 #include <Punkt.h>
+#include <Critical.h>
 
 namespace Editor
 {
@@ -25,6 +26,7 @@ namespace Editor
         KSGClient::EditorServerClient *klient;
         Text error;
         int ref;
+        Critical cs;
 
         void loadMapResourcePathsFromFolder( const char *folderPath, RCArray< Text > *zPaths );