Browse Source

fix cast issues

Kolja Strohm 3 years ago
parent
commit
2bd9ba34b8
40 changed files with 325 additions and 331 deletions
  1. 5 5
      Animation.cpp
  2. 1 1
      Array.h
  3. 23 23
      AuswahlBox.cpp
  4. 3 3
      Bild.cpp
  5. 5 5
      Bildschirm.cpp
  6. 6 6
      Cube.cpp
  7. 3 3
      DX11GraphicsApi.cpp
  8. 3 3
      DX12GraphicsApi.cpp
  9. 70 70
      Datei.cpp
  10. 1 1
      DateiDialog.cpp
  11. 75 75
      DateiSystem.cpp
  12. 4 4
      Diagramm.cpp
  13. 6 6
      Dialog.cpp
  14. 12 12
      Fenster.cpp
  15. 3 3
      Fortschritt.cpp
  16. 1 1
      InitDatei.cpp
  17. 6 6
      JSON.cpp
  18. 1 1
      Kam3D.cpp
  19. 1 1
      Kamera2D.cpp
  20. 10 10
      Knopf.cpp
  21. 14 14
      Liste.cpp
  22. 4 4
      M2DVorschau.cpp
  23. 6 6
      Model2D.cpp
  24. 2 2
      Model3D.cpp
  25. 1 1
      ReferenceCounter.cpp
  26. 1 7
      ReferenceCounter.h
  27. 1 1
      RenderThread.cpp
  28. 5 5
      Schrift.cpp
  29. 3 3
      Tabelle.cpp
  30. 4 4
      TextFeld.cpp
  31. 1 1
      Textur.cpp
  32. 1 1
      TexturList.cpp
  33. 2 2
      ToolTip.cpp
  34. 1 1
      UIDialog.cpp
  35. 8 8
      UIInitialization.cpp
  36. 4 4
      UIMLView.cpp
  37. 1 1
      Welt2D.cpp
  38. 20 20
      XML.cpp
  39. 5 5
      Zeichnung.cpp
  40. 2 2
      Zeit.cpp

+ 5 - 5
Animation.cpp

@@ -73,7 +73,7 @@ void Animation2DData::ladeAnimation( InitDatei *datei )
             Text *name = pfad.getTeilText( pfad.positionVon( ".ltdb/", pfad.anzahlVon( ".ltdb/" ) - 1 ) + 6 );
             pfad.setText( pfad.getTeilText( 0, pfad.getLength() - name->getLength() - 1 ) );
             LTDBDatei *dat = new LTDBDatei();
-            dat->setDatei( (Text *)pfad.getThis() );
+            dat->setDatei( dynamic_cast<Text *>( pfad.getThis() ) );
             dat->leseDaten( 0 );
             bilder[ j ] = dat->laden( 0, name );
             dat->release();
@@ -156,7 +156,7 @@ void Animation2DData::reset()
 // constant
 Bild *Animation2DData::getBild( int i ) const
 {
-    return ( i >= 0 && i < bildAnzahl ) ? (Bild *)bilder[ i ]->getThis() : 0;
+    return ( i >= 0 && i < bildAnzahl ) ? dynamic_cast<Bild *>( bilder[ i ]->getThis() ) : 0;
 }
 
 Bild *Animation2DData::zBild( int i ) const
@@ -341,7 +341,7 @@ void Animation2D::render( Bild &zRObj )
 // constant
 Animation2DData *Animation2D::getAnimationData() const
 {
-    return data ? (Animation2DData *)data->getThis() : 0;
+    return data ? dynamic_cast<Animation2DData *>( data->getThis() ) : 0;
 }
 
 Animation2DData *Animation2D::zAnimationData() const
@@ -371,7 +371,7 @@ bool Animation2D::hatRahmen() const
 
 Rahmen *Animation2D::getRahmen() const
 {
-    return ram ? (Rahmen *)ram->getThis() : 0;
+    return ram ? dynamic_cast<Rahmen *>( ram->getThis() ) : 0;
 }
 
 Rahmen *Animation2D::zRahmen() const
@@ -401,7 +401,7 @@ Zeichnung *Animation2D::dublizieren() const
     if( toolTip )
         ret->setToolTipZ( (ToolTip *)toolTip->dublizieren() );
     if( data )
-        ret->setAnimationDataZ( (Animation2DData *)data->getThis() );
+        ret->setAnimationDataZ( dynamic_cast<Animation2DData *>( data->getThis() ) );
     ret->setAPS( aps );
     ret->setSichtbar( sichtbar );
     ret->setAlphaMaske( maxAlpha );

+ 1 - 1
Array.h

@@ -751,7 +751,7 @@ namespace Framework
             for( int a = 0; a < i && e; ++a )
                 e = e->next;
             if( e && e->set && e->var )
-                return (TYP *)e->var->getThis();
+                return dynamic_cast<TYP *>( e->var->getThis() );
             return (TYP *)0;
         }
 

+ 23 - 23
AuswahlBox.cpp

@@ -222,7 +222,7 @@ void AuswahlBox::setSchriftZ( Schrift *schrift ) // setzt die schrift
         textRd = new TextRenderer( schrift );
     else
         textRd->setSchriftZ( schrift );
-    ausfahren->setSchriftZ( (Schrift *)schrift->getThis() );
+    ausfahren->setSchriftZ( dynamic_cast<Schrift *>( schrift->getThis() ) );
     rend = 1;
 }
 
@@ -1065,7 +1065,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                     if( hatStyle( Style::AuswahlBuffer ) )
                     {
                         tmpBuffer = tf->getAlphaFeld();
-                        tf->setAlphaFeldZ( (AlphaFeld *)auswAf->getThis() );
+                        tf->setAlphaFeldZ( dynamic_cast<AlphaFeld *>( auswAf->getThis() ) );
                         tmpB = tf->hatStyle( TextFeld::Style::Buffered );
                         tf->setStyle( TextFeld::Style::Buffered, hatStyle( Style::AuswahlBuffer ) );
                     }
@@ -1078,7 +1078,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::AuswahlHBild ) )
                         {
                             tmpHBild = tf->getHintergrundBild();
-                            tf->setHintergrundBildZ( (Bild *)auswBgB->getThis() );
+                            tf->setHintergrundBildZ( dynamic_cast<Bild *>( auswBgB->getThis() ) );
                             tmpHB = tf->hatStyle( TextFeld::Style::HBild );
                             tf->setStyle( TextFeld::Style::HBild, hatStyle( Style::HBild ) );
                         }
@@ -1091,7 +1091,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                     if( hatStyle( Style::AuswahlRahmen ) )
                     {
                         tmpRahmen = tf->getRahmen();
-                        tf->setRahmenZ( (Rahmen *)auswRahmen->getThis() );
+                        tf->setRahmenZ( dynamic_cast<Rahmen *>( auswRahmen->getThis() ) );
                         tmpR = tf->hatStyle( TextFeld::Style::Rahmen );
                         tf->setStyle( TextFeld::Style::Rahmen, hatStyle( Style::AuswahlRahmen ) );
                     }
@@ -1246,7 +1246,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::AuswahlBuffer ) )
                         {
                             tmpBuffer = tf->getAlphaFeld();
-                            tf->setAlphaFeldZ( (AlphaFeld *)auswAf->getThis() );
+                            tf->setAlphaFeldZ( dynamic_cast<AlphaFeld *>( auswAf->getThis() ) );
                             tmpB = tf->hatStyle( TextFeld::Style::Buffered );
                             tf->setStyle( TextFeld::Style::Buffered, hatStyle( Style::AuswahlBuffer ) );
                         }
@@ -1259,7 +1259,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                             if( hatStyle( Style::AuswahlHBild ) )
                             {
                                 tmpHBild = tf->getHintergrundBild();
-                                tf->setHintergrundBildZ( (Bild *)auswBgB->getThis() );
+                                tf->setHintergrundBildZ( dynamic_cast<Bild *>( auswBgB->getThis() ) );
                                 tmpHB = tf->hatStyle( TextFeld::Style::HBild );
                                 tf->setStyle( TextFeld::Style::HBild, hatStyle( Style::HBild ) );
                             }
@@ -1272,7 +1272,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::AuswahlRahmen ) )
                         {
                             tmpRahmen = tf->getRahmen();
-                            tf->setRahmenZ( (Rahmen *)auswRahmen->getThis() );
+                            tf->setRahmenZ( dynamic_cast<Rahmen *>( auswRahmen->getThis() ) );
                             tmpR = tf->hatStyle( TextFeld::Style::Rahmen );
                             tf->setStyle( TextFeld::Style::Rahmen, hatStyle( Style::AuswahlRahmen ) );
                         }
@@ -1324,7 +1324,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::MausBuffer ) )
                         {
                             tmpBuffer = tf->getAlphaFeld();
-                            tf->setAlphaFeldZ( (AlphaFeld *)mausAf->getThis() );
+                            tf->setAlphaFeldZ( dynamic_cast<AlphaFeld *>( mausAf->getThis() ) );
                             tmpB = tf->hatStyle( TextFeld::Style::Buffered );
                             tf->setStyle( TextFeld::Style::Buffered, hatStyle( Style::MausBuffer ) );
                         }
@@ -1337,7 +1337,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                             if( hatStyle( Style::MausHBild ) )
                             {
                                 tmpHBild = tf->getHintergrundBild();
-                                tf->setHintergrundBildZ( (Bild *)mausBgB->getThis() );
+                                tf->setHintergrundBildZ( dynamic_cast<Bild *>( mausBgB->getThis() ) );
                                 tmpHB = tf->hatStyle( TextFeld::Style::HBild );
                                 tf->setStyle( TextFeld::Style::HBild, hatStyle( Style::HBild ) );
                             }
@@ -1350,7 +1350,7 @@ void AuswahlBox::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::MausRahmen ) )
                         {
                             tmpRahmen = tf->getRahmen();
-                            tf->setRahmenZ( (Rahmen *)mausRahmen->getThis() );
+                            tf->setRahmenZ( dynamic_cast<Rahmen *>( mausRahmen->getThis() ) );
                             tmpR = tf->hatStyle( TextFeld::Style::Rahmen );
                             tf->setStyle( TextFeld::Style::Rahmen, hatStyle( Style::MausRahmen ) );
                         }
@@ -1598,7 +1598,7 @@ Knopf *AuswahlBox::getAusklappKnopf() const // gibt den aus-/einklapp Knopf zur
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return ausfahren ? (Knopf *)ausfahren->getThis() : 0;
+    return ausfahren ? dynamic_cast<Knopf *>( ausfahren->getThis() ) : 0;
 }
 
 Knopf *AuswahlBox::zAusklappKnopf() const
@@ -1711,7 +1711,7 @@ Rahmen *AuswahlBox::getAuswRahmen() const // gibt den Auswahl Rahmen zur
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return auswRahmen ? (Rahmen *)auswRahmen->getThis() : 0;
+    return auswRahmen ? dynamic_cast<Rahmen *>( auswRahmen->getThis() ) : 0;
 }
 
 Rahmen *AuswahlBox::zAuswRahmen() const
@@ -1739,7 +1739,7 @@ AlphaFeld *AuswahlBox::getAuswAlphaFeld() const // gibt das Auswahl AlphaFeld zu
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return auswAf ? (AlphaFeld *)auswAf->getThis() : 0;
+    return auswAf ? dynamic_cast<AlphaFeld *>( auswAf->getThis() ) : 0;
 }
 
 AlphaFeld *AuswahlBox::zAuswAlphaFeld() const
@@ -1774,7 +1774,7 @@ Bild *AuswahlBox::getAuswHintergrundBild() const // gibt das Auswahl Hintergrund
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return auswBgB ? (Bild *)auswBgB->getThis() : 0;
+    return auswBgB ? dynamic_cast<Bild *>( auswBgB->getThis() ) : 0;
 }
 
 Bild *AuswahlBox::zAuswHintergrundBild() const
@@ -1790,7 +1790,7 @@ Rahmen *AuswahlBox::getMsAuswRahmen( int i ) const // gibt den Multistyle Auswah
         return 0;
     if( !msAuswRahmen )
         return 0;
-    return msAuswRahmen->z( i ) ? (Rahmen *)msAuswRahmen->z( i )->getThis() : 0;
+    return msAuswRahmen->z( i ) ? dynamic_cast<Rahmen *>( msAuswRahmen->z( i )->getThis() ) : 0;
 }
 
 Rahmen *AuswahlBox::zMsAuswRahmen( int i ) const
@@ -1826,7 +1826,7 @@ AlphaFeld *AuswahlBox::getMsAuswAlphaFeld( int i ) const // gibt das Multistyle
         return 0;
     if( !msAuswAf )
         return 0;
-    return msAuswAf->z( i ) ? (AlphaFeld *)msAuswAf->z( i )->getThis() : 0;
+    return msAuswAf->z( i ) ? dynamic_cast<AlphaFeld *>( msAuswAf->z( i )->getThis() ) : 0;
 }
 
 AlphaFeld *AuswahlBox::zMsAuswAlphaFeld( int i ) const
@@ -1887,7 +1887,7 @@ Rahmen *AuswahlBox::getMausRahmen() const // gibt den Maus Rahmen zur
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return mausRahmen ? (Rahmen *)mausRahmen->getThis() : 0;
+    return mausRahmen ? dynamic_cast<Rahmen *>( mausRahmen->getThis() ) : 0;
 }
 
 Rahmen *AuswahlBox::zMausRahmen() const
@@ -1915,7 +1915,7 @@ AlphaFeld *AuswahlBox::getMausAlphaFeld() const // gibt das Maus AlphaFeld zur
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return mausAf ? (AlphaFeld *)mausAf->getThis() : 0;
+    return mausAf ? dynamic_cast<AlphaFeld *>( mausAf->getThis() ) : 0;
 }
 
 AlphaFeld *AuswahlBox::zMausAlphaFeld() const
@@ -1950,7 +1950,7 @@ Bild *AuswahlBox::getMausHintergrundBild() const // gibt das Maus Hintergrund Bi
 {
     if( hatStyle( Style::MultiStyled ) )
         return 0;
-    return mausBgB ? (Bild *)mausBgB->getThis() : 0;
+    return mausBgB ? dynamic_cast<Bild *>( mausBgB->getThis() ) : 0;
 }
 
 Bild *AuswahlBox::zMausHintergrundBild() const
@@ -2095,28 +2095,28 @@ Zeichnung *AuswahlBox::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
         obj->setToolTipZ( (ToolTip *)toolTip->dublizieren() );
     obj->setStyle( style );
     if( textRd )
-        obj->setTextRendererZ( (TextRenderer *)textRd->getThis() );
+        obj->setTextRendererZ( dynamic_cast<TextRenderer *>( textRd->getThis() ) );
     if( rahmen )
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     if( ausfahren )
         obj->setAusklappKnopfZ( (Knopf *)ausfahren->dublizieren() );
     obj->setHintergrundFarbe( hintergrundFarbe );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( hintergrundFeld )
         obj->setAlphaFeldZ( (AlphaFeld *)hintergrundFeld->dublizieren() );
     if( auswRahmen )
         obj->setAuswRahmenZ( (Rahmen *)auswRahmen->dublizieren() );
     obj->setAuswHintergrundFarbe( auswBgF );
     if( auswBgB )
-        obj->setAuswHintergrundBild( (Bild *)auswBgB->getThis() );
+        obj->setAuswHintergrundBild( dynamic_cast<Bild *>( auswBgB->getThis() ) );
     if( auswAf )
         obj->setAuswAlphaFeldZ( (AlphaFeld *)auswAf->dublizieren() );
     if( mausRahmen )
         obj->setMausRahmenZ( (Rahmen *)mausRahmen->dublizieren() );
     obj->setMausHintergrundFarbe( mausBgF );
     if( mausBgB )
-        obj->setMausHintergrundBild( (Bild *)mausBgB->getThis() );
+        obj->setMausHintergrundBild( dynamic_cast<Bild *>( mausBgB->getThis() ) );
     if( mausAf )
         obj->setMausAlphaFeldZ( (AlphaFeld *)mausAf->dublizieren() );
     obj->setMaxAuskappHeight( ausklapMaxHeight );

+ 3 - 3
Bild.cpp

@@ -2709,7 +2709,7 @@ void BildZ::render( Bild &zRObj ) // zeichnet nach zRObj
 Bild *BildZ::getBild() const // gibt das Bild zurück
 {
     if( bild )
-        return (Bild *)bild->getThis();
+        return dynamic_cast<Bild *>( bild->getThis() );
     return 0;
 }
 
@@ -2736,9 +2736,9 @@ Zeichnung *BildZ::dublizieren() const // erstellt eine Kopie des Zeichnungs
     if( rahmen )
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( bild )
-        obj->setBild( (Bild *)bild->getThis() );
+        obj->setBild( dynamic_cast<Bild *>( bild->getThis() ) );
     obj->setStyle( style );
     return obj;
 }

+ 5 - 5
Bildschirm.cpp

@@ -272,7 +272,7 @@ bool Bildschirm::removeToolTip( ToolTip *zTip ) // entfernt ToolTip
 // constant 
 Bild *Bildschirm::getRenderBild() const
 {
-    return api->zUIRenderBild()->getThis()->as<Bild>();
+    return dynamic_cast<Bild *>( api->zUIRenderBild()->getThis() );
 }
 
 Bild *Bildschirm::zRenderBild() const
@@ -323,7 +323,7 @@ GraphicsApi *Bildschirm::zGraphicsApi() const
 // Gibt die Grafik API zurück
 GraphicsApi *Bildschirm::getGraphicsApi() const
 {
-    return api ? api->getThis()->as<GraphicsApi>() : 0;
+    return api ? dynamic_cast<GraphicsApi *>( api->getThis() ) : 0;
 }
 
 #ifdef WIN32
@@ -371,7 +371,7 @@ Bildschirm2D::Bildschirm2D( WFenster *fenster )
     : Bildschirm( fenster )
 {
     api = new DirectX9();
-    api->initialize( fenster->getThis()->as<WFenster>(), fenster->getKörperGröße(), 0 );
+    api->initialize( dynamic_cast<WFenster *>( fenster->getThis() ), fenster->getKörperGröße(), 0 );
 }
 
 // Destruktor 
@@ -431,7 +431,7 @@ Bildschirm3D::Bildschirm3D( WFenster *fenster )
         api = new DirectX11();
     else
         api = new DirectX9();
-    api->initialize( (WFenster *)fenster->getThis(), fenster->getKörperGröße(), 0 );
+    api->initialize( dynamic_cast<WFenster *>( fenster->getThis() ), fenster->getKörperGröße(), 0 );
 }
 
 Bildschirm3D::Bildschirm3D( WFenster *fenster, GraphicApiType apiTyp )
@@ -445,7 +445,7 @@ Bildschirm3D::Bildschirm3D( WFenster *fenster, GraphicApiType apiTyp )
         api = new DirectX11();
     if( apiTyp == DIRECTX12 )
         api = new DirectX12();
-    api->initialize( (WFenster *)fenster->getThis(), fenster->getKörperGröße(), 0 );
+    api->initialize( dynamic_cast<WFenster *>( fenster->getThis() ), fenster->getKörperGröße(), 0 );
 }
 
 // Destruktor 

+ 6 - 6
Cube.cpp

@@ -19,7 +19,7 @@ Cube::Cube( float size )
     else
     {
         model = new Model3DData();
-        m3dRegister->addModel( (Model3DData *)model->getThis(), Standart3DTypes::cube );
+        m3dRegister->addModel( dynamic_cast<Model3DData *>( model->getThis() ), Standart3DTypes::cube );
         float stdSize = 100;
         float left, right, top, bottom;
         // Calculate the screen coordinates of the left side of the bitmap.
@@ -164,11 +164,11 @@ Cube::Cube( float size )
 //  textur: Die Textur
 void Cube::setTextur( Textur *textur )
 {
-    this->textur->setPolygonTextur( LINKS, (Textur *)textur->getThis() );
-    this->textur->setPolygonTextur( OBEN, (Textur *)textur->getThis() );
-    this->textur->setPolygonTextur( RECHTS, (Textur *)textur->getThis() );
-    this->textur->setPolygonTextur( UNTEN, (Textur *)textur->getThis() );
-    this->textur->setPolygonTextur( VORNE, (Textur *)textur->getThis() );
+    this->textur->setPolygonTextur( LINKS, dynamic_cast<Textur *>( textur->getThis() ) );
+    this->textur->setPolygonTextur( OBEN, dynamic_cast<Textur *>( textur->getThis() ) );
+    this->textur->setPolygonTextur( RECHTS, dynamic_cast<Textur *>( textur->getThis() ) );
+    this->textur->setPolygonTextur( UNTEN, dynamic_cast<Textur *>( textur->getThis() ) );
+    this->textur->setPolygonTextur( VORNE, dynamic_cast<Textur *>( textur->getThis() ) );
     this->textur->setPolygonTextur( HINTEN, textur );
     rend = 1;
 }

+ 3 - 3
DX11GraphicsApi.cpp

@@ -417,7 +417,7 @@ void DirectX11::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     uiTextur = createOrGetTextur( "_f_Render_Bild", renderB );
 
     texturModel->setSize( this->backBufferSize );
-    texturModel->setTextur( (Textur *)uiTextur->getThis() );
+    texturModel->setTextur( dynamic_cast<Textur *>( uiTextur->getThis() ) );
 
     D3D11_BLEND_DESC blendState;
     ZeroMemory( &blendState, sizeof( D3D11_BLEND_DESC ) );
@@ -569,7 +569,7 @@ void DirectX11::update()
         d3d11Context->Release();
         d3d11Context = NULL;
     }
-    initialize( (WFenster *)fenster->getThis(), backBufferSize, fullScreen );
+    initialize( dynamic_cast<WFenster *>( fenster->getThis() ), backBufferSize, fullScreen );
 }
 
 void DirectX11::beginFrame( bool fill2D, bool fill3D, int fillColor )
@@ -823,7 +823,7 @@ Textur *DirectX11::createOrGetTextur( const char *name, Bild *b )
     Textur *ret = new DX11Textur( d3d11Device, d3d11Context );
     if( b )
         ret->setBildZ( b );
-    texturRegister->addTextur( (Textur *)ret->getThis(), name );
+    texturRegister->addTextur( dynamic_cast<Textur *>( ret->getThis() ), name );
     return ret;
 }
 

+ 3 - 3
DX12GraphicsApi.cpp

@@ -353,7 +353,7 @@ void DirectX12::initialize( WFenster *fenster, Vec2<int> backBufferSize, bool fu
     uiTextur = createOrGetTextur( "_f_Render_Bild", renderB );
 
     texturModel->setSize( Vec2<float>( 2.f, 2.f ) );
-    texturModel->setTextur( (Textur *)uiTextur->getThis() );
+    texturModel->setTextur( dynamic_cast<Textur *>( uiTextur->getThis() ) );
 
     vertexBufferView = new D3D12_VERTEX_BUFFER_VIEW();
     vertexBufferView->StrideInBytes = sizeof( Vertex3D );
@@ -714,7 +714,7 @@ void DirectX12::update()
     renderB->neuBild( this->backBufferSize.x, this->backBufferSize.y, 0 );
     uiTextur = createOrGetTextur( "_f_Render_Bild", renderB );
 
-    texturModel->setTextur( (Textur *)uiTextur->getThis() );
+    texturModel->setTextur( dynamic_cast<Textur *>( uiTextur->getThis() ) );
 
     factory->Release();
 }
@@ -953,7 +953,7 @@ Textur *DirectX12::createOrGetTextur( const char *name, Bild *b )
     Textur *ret = new DX12Textur( device, copyCommandQueue, directCommandQueue );
     if( b )
         ret->setBildZ( b );
-    texturRegister->addTextur( (Textur *)ret->getThis(), name );
+    texturRegister->addTextur( dynamic_cast<Textur *>( ret->getThis() ), name );
     ret->updateTextur();
     copyCommandQueue->execute();
     directCommandQueue->execute();

+ 70 - 70
Datei.cpp

@@ -41,7 +41,7 @@ Datei::~Datei()
 }
 
 // nicht constant 
-void Datei::setDatei( const char* pfad ) // setzt die Datei
+void Datei::setDatei( const char *pfad ) // setzt die Datei
 {
     if( istOffen() )
         close();
@@ -51,7 +51,7 @@ void Datei::setDatei( const char* pfad ) // setzt die Datei
     gr = 0;
 }
 
-void Datei::setDatei( Text* pfad )
+void Datei::setDatei( Text *pfad )
 {
     if( istOffen() )
         close();
@@ -61,7 +61,7 @@ void Datei::setDatei( Text* pfad )
     gr = 0;
 }
 
-bool Datei::umbenennen( const char* pfad ) // benennt die Datei um und verschiebt sie eventuell
+bool Datei::umbenennen( const char *pfad ) // benennt die Datei um und verschiebt sie eventuell
 {
     if( !pfad )
         return 0;
@@ -73,7 +73,7 @@ bool Datei::umbenennen( const char* pfad ) // benennt die Datei um und verschieb
     return 0;
 }
 
-bool Datei::umbenennen( Text* pfad )
+bool Datei::umbenennen( Text *pfad )
 {
     if( !this->pfad )
     {
@@ -93,14 +93,14 @@ bool Datei::remove() // l
 {
     if( !pfad )
         return 0;
-    return DateiRemove( (Text*)pfad->getThis() );
+    return DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 
 bool Datei::erstellen() // erstellt die Datei
 {
     if( !pfad )
         return 0;
-    return DateiPfadErstellen( (Text *)pfad->getThis() );
+    return DateiPfadErstellen( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 
 bool Datei::open( int style ) // öffnet die Datei
@@ -162,7 +162,7 @@ void Datei::setSPosition( __int64 pos, bool ende ) // setzt die Schreibeposition
     tmpSBPos = -1;
 }
 
-void Datei::schreibe( const char* bytes, int len ) // schreibt bytes in datei
+void Datei::schreibe( const char *bytes, int len ) // schreibt bytes in datei
 {
     if( !pfad || !stream )
         return;
@@ -175,8 +175,8 @@ void Datei::schreibe( const char* bytes, int len ) // schreibt bytes in datei
     if( key )
     {
         key->setPos( getSPosition() );
-        Bytes* n = new Bytes( bytes, len );
-        key->codieren( (Bytes*)n->getThis() );
+        Bytes *n = new Bytes( bytes, len );
+        key->codieren( dynamic_cast<Bytes *>( n->getThis() ) );
         stream->write( n->getBytes(), len );
         n->release();
     }
@@ -184,7 +184,7 @@ void Datei::schreibe( const char* bytes, int len ) // schreibt bytes in datei
         stream->write( bytes, len );
 }
 
-void Datei::lese( char* bytes, int len ) // ließt bytes aus datei
+void Datei::lese( char *bytes, int len ) // ließt bytes aus datei
 {
     if( !pfad )
         return;
@@ -195,7 +195,7 @@ void Datei::lese( char* bytes, int len ) // lie
         if( key )
         {
             key->setPos( tmp );
-            Bytes* n = new Bytes();
+            Bytes *n = new Bytes();
             n->setBytesZ( bytes, len );
             key->decodieren( n );
         }
@@ -204,13 +204,13 @@ void Datei::lese( char* bytes, int len ) // lie
     tmpSBPos = -1;
 }
 
-Text* Datei::leseZeile() // ließt eine zeile
+Text *Datei::leseZeile() // ließt eine zeile
 {
     if( !pfad | !stream )
         return 0;
     if( istEnde() )
         return 0;
-    Text* ret = new Text( "" );
+    Text *ret = new Text( "" );
     __int64 len = getSize();
     for( char c = 0; c != '\n' && stream->tellg() < len; )
     {
@@ -219,12 +219,12 @@ Text* Datei::leseZeile() // lie
         if( key )
         {
             key->setPos( tmp );
-            Bytes* n = new Bytes();
+            Bytes *n = new Bytes();
             n->setBytesZ( &c, 1 );
             key->decodieren( n );
         }
         if( c )
-            ret->append( (const char*)&c, 1 );
+            ret->append( (const char *)&c, 1 );
     }
     tmpSBPos = 7;
     tmpSBPos = -1;
@@ -240,8 +240,8 @@ void Datei::close() // schlie
         if( key )
         {
             key->setPos( getSPosition() );
-            Bytes* n = new Bytes( &tmpSByte, 1 );
-            key->codieren( (Bytes*)n->getThis() );
+            Bytes *n = new Bytes( &tmpSByte, 1 );
+            key->codieren( dynamic_cast<Bytes *>( n->getThis() ) );
             stream->write( n->getBytes(), 1 );
             n->release();
         }
@@ -254,7 +254,7 @@ void Datei::close() // schlie
 }
 
 #ifdef WIN32
-bool Datei::setLetzteÄnderung( Zeit* zeit ) // setzt das änderungsdatum der Datei
+bool Datei::setLetzteÄnderung( Zeit *zeit ) // setzt das änderungsdatum der Datei
 {
     if( !pfad )
     {
@@ -303,7 +303,7 @@ bool Datei::setLetzte
 }
 #endif
 
-bool Datei::getNextBit( bool& bit ) // Datei Bitweise auslesen
+bool Datei::getNextBit( bool &bit ) // Datei Bitweise auslesen
 {
     if( !pfad || !stream )
         return 0;
@@ -315,7 +315,7 @@ bool Datei::getNextBit( bool& bit ) // Datei Bitweise auslesen
         if( key )
         {
             key->setPos( tmp );
-            Bytes* n = new Bytes();
+            Bytes *n = new Bytes();
             n->setBytesZ( &tmpLByte, 1 );
             key->decodieren( n );
         }
@@ -337,8 +337,8 @@ bool Datei::setNextBit( bool bit ) // Datei Bitweise speichern
         if( key )
         {
             key->setPos( getSPosition() );
-            Bytes* n = new Bytes( &tmpSByte, 1 );
-            key->codieren( (Bytes*)n->getThis() );
+            Bytes *n = new Bytes( &tmpSByte, 1 );
+            key->codieren( dynamic_cast<Bytes *>( n->getThis() ) );
             stream->write( n->getBytes(), 1 );
             n->release();
         }
@@ -350,11 +350,11 @@ bool Datei::setNextBit( bool bit ) // Datei Bitweise speichern
 }
 
 // Setzt den Schlüssel für die Datei
-void Datei::setKey( char* s, int l )
+void Datei::setKey( char *s, int l )
 {
     if( l == 0 )
     {
-        key = (Key*)key->release();
+        key = (Key *)key->release();
         return;
     }
     if( key )
@@ -368,7 +368,7 @@ bool Datei::istOrdner() const // pr
 {
     if( !pfad )
         return 0;
-    return DateiIstVerzeichnis( (Text *)pfad->getThis() );
+    return DateiIstVerzeichnis( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 
 bool Datei::istOffen() const // prüft, ob die Datei geöffnet ist
@@ -385,7 +385,7 @@ int Datei::getUnterdateiAnzahl() const // gibt die Anzahl der unterdateien an
 #ifdef WIN32
     if( !pfad )
         return 0;
-    if( !DateiIstVerzeichnis( (Text *)pfad->getThis() ) )
+    if( !DateiIstVerzeichnis( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     int ret = 0;
     HANDLE fHandle;
@@ -412,9 +412,9 @@ int Datei::getUnterdateiAnzahl() const // gibt die Anzahl der unterdateien an
     stxt.ersetzen( '\\', '/' );
     if( stxt.positionVon( '/' ) == stxt.getLength() - 1 )
         stxt.remove( stxt.getLength() - 1 );
-    DIR* hdir;
+    DIR *hdir;
     hdir = opendir( stxt.getText() );
-    for( dirent* entry = readdir( hdir ); entry; entry = readdir( hdir ) )
+    for( dirent *entry = readdir( hdir ); entry; entry = readdir( hdir ) )
     {
         if( entry && entry->d_name[ 0 ] != '.' )
             ++ret;
@@ -424,12 +424,12 @@ int Datei::getUnterdateiAnzahl() const // gibt die Anzahl der unterdateien an
 #endif
 }
 
-RCArray< Text >* Datei::getDateiListe() const // gibt eine Liste mit unterdateien zurück
+RCArray< Text > *Datei::getDateiListe() const // gibt eine Liste mit unterdateien zurück
 {
 #ifdef WIN32
     if( !pfad )
         return 0;
-    if( !DateiIstVerzeichnis( (Text *)pfad->getThis() ) )
+    if( !DateiIstVerzeichnis( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     HANDLE fHandle;
     WIN32_FIND_DATA wfd;
@@ -441,11 +441,11 @@ RCArray< Text >* Datei::getDateiListe() const // gibt eine Liste mit unterdateie
         stxt.append( "\\*" );
     fHandle = FindFirstFile( stxt.getText(), &wfd );
     FindNextFile( fHandle, &wfd );
-    RCArray< Text >* ret = new RCArray< Text >();
+    RCArray< Text > *ret = new RCArray< Text >();
     int count = 0;
     while( FindNextFile( fHandle, &wfd ) )
     {
-        Text* txt = new Text( wfd.cFileName );
+        Text *txt = new Text( wfd.cFileName );
         ret->add( txt, count );
         ++count;
     }
@@ -460,13 +460,13 @@ RCArray< Text >* Datei::getDateiListe() const // gibt eine Liste mit unterdateie
     stxt.ersetzen( '\\', '/' );
     if( stxt.positionVon( '/' ) == stxt.getLength() - 1 )
         stxt.remove( stxt.getLength() - 1 );
-    DIR* hdir;
+    DIR *hdir;
     hdir = opendir( stxt.getText() );
     if( hdir )
     {
-        RCArray< Text >* ret = new RCArray< Text >();
+        RCArray< Text > *ret = new RCArray< Text >();
         int count = 0;
-        for( dirent* entry = readdir( hdir ); entry; entry = readdir( hdir ) )
+        for( dirent *entry = readdir( hdir ); entry; entry = readdir( hdir ) )
         {
             if( entry && entry->d_name[ 0 ] != '.' )
             {
@@ -489,7 +489,7 @@ __int64 Datei::getSize() const // gibt die Gr
         return gr;
     if( !stream || !istOffen() )
     {
-        std::fstream* stream = new std::fstream();
+        std::fstream *stream = new std::fstream();
         stream->open( pfad->getText(), std::ios::binary | std::ios::in );
         __int64 tmp = stream->tellg();
         stream->seekg( 0, std::ios::end );
@@ -497,7 +497,7 @@ __int64 Datei::getSize() const // gibt die Gr
         stream->seekg( tmp, std::ios::beg );
         stream->close();
         delete stream;
-        __int64* size = (__int64*)&gr;
+        __int64 *size = (__int64 *)&gr;
         *size = ret;
         return ret;
     }
@@ -505,12 +505,12 @@ __int64 Datei::getSize() const // gibt die Gr
     stream->seekg( 0, std::ios::end );
     __int64 ret = stream->tellg();
     stream->seekg( tmp, std::ios::beg );
-    __int64* size = (__int64*)&gr;
+    __int64 *size = (__int64 *)&gr;
     *size = ret;
     return ret;
 }
 
-Zeit* Datei::getLastChange() const // gibt das Datum der letzten Änderung
+Zeit *Datei::getLastChange() const // gibt das Datum der letzten Änderung
 {
     if( !pfad )
         return 0;
@@ -530,14 +530,14 @@ Zeit* Datei::getLastChange() const // gibt das Datum der letzten 
         return 0;
     if( !SystemTimeToTzSpecificLocalTime( NULL, &stUTC, &stLocal ) )
         return 0;
-    Zeit* ret = new Zeit();
+    Zeit *ret = new Zeit();
     ret->setZeit( stLocal.wYear, stLocal.wMonth, stLocal.wDay, stLocal.wHour, stLocal.wMinute, stLocal.wSecond );
     return ret;
 #else
     struct stat attrib;
     stat( pfad->getText(), &attrib );
-    tm* clock = gmtime( &( attrib.st_mtime ) );
-    Zeit* ret = new Zeit();
+    tm *clock = gmtime( &( attrib.st_mtime ) );
+    Zeit *ret = new Zeit();
     ret->setZeit( clock->tm_year + 1900, clock->tm_mon + 1, clock->tm_mday, clock->tm_hour, clock->tm_min, clock->tm_sec );
     return ret;
 #endif
@@ -547,7 +547,7 @@ bool Datei::existiert() const // pr
 {
     if( !pfad )
         return 0;
-    return DateiExistiert( (Text *)pfad->getThis() );
+    return DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 
 __int64 Datei::getLPosition() const // gibt die Leseposition zurück
@@ -572,18 +572,18 @@ bool Datei::istEnde() const // pr
     return stream->tellg() >= i;
 }
 
-Text* Datei::getPfad() const // gibt den Dateipfad zurück
+Text *Datei::getPfad() const // gibt den Dateipfad zurück
 {
-    return pfad ? (Text *)pfad->getThis() : 0;
+    return pfad ? dynamic_cast<Text *>( pfad->getThis() ) : 0;
 }
 
-Text* Datei::zPfad() const
+Text *Datei::zPfad() const
 {
     return pfad;
 }
 
 // Datei Funktionen
-void Framework::GetFreePfad( Text* zPfad ) // Sucht einen unbenutzten Dateinamen
+void Framework::GetFreePfad( Text *zPfad ) // Sucht einen unbenutzten Dateinamen
 {
     Text txt = zPfad->getText();
     for( int i = 0; DateiExistiert( txt ); i++ )
@@ -594,21 +594,21 @@ void Framework::GetFreePfad( Text* zPfad ) // Sucht einen unbenutzten Dateinamen
     zPfad->setText( txt );
 }
 
-bool Framework::DateiPfadErstellen( Text* pfad ) // Erstellt eine Datei in dem Pfad
+bool Framework::DateiPfadErstellen( Text *pfad ) // Erstellt eine Datei in dem Pfad
 {
     bool ret = DateiPfadErstellen( pfad->getText() );
     pfad->release();
     return ret;
 }
 
-bool Framework::DateiRemove( Text* pfad ) // Löscht die angegebene Datei
+bool Framework::DateiRemove( Text *pfad ) // Löscht die angegebene Datei
 {
     bool ret = DateiRemove( pfad->getText() );
     pfad->release();
     return ret;
 }
 
-bool Framework::DateiUmbenennen( Text* pfad_alt, Text* pfad_neu ) // Benennt die Datei um
+bool Framework::DateiUmbenennen( Text *pfad_alt, Text *pfad_neu ) // Benennt die Datei um
 {
     bool ret = DateiUmbenennen( pfad_alt->getText(), pfad_neu->getText() );
     pfad_alt->release();
@@ -616,21 +616,21 @@ bool Framework::DateiUmbenennen( Text* pfad_alt, Text* pfad_neu ) // Benennt die
     return ret;
 }
 
-bool Framework::DateiExistiert( Text* pfad ) // Prüft, ob Datei existiert
+bool Framework::DateiExistiert( Text *pfad ) // Prüft, ob Datei existiert
 {
     bool ret = DateiExistiert( pfad->getText() );
     pfad->release();
     return ret;
 }
 
-bool Framework::DateiIstVerzeichnis( Text* pfad ) // prüft, ob pfad ein Verzeichnis ist
+bool Framework::DateiIstVerzeichnis( Text *pfad ) // prüft, ob pfad ein Verzeichnis ist
 {
     bool ret = DateiIstVerzeichnis( pfad->getText() );
     pfad->release();
     return ret;
 }
 
-bool Framework::DateiPfadErstellen( const char* pfad ) // Erstellt eine Datei in dem Pfad
+bool Framework::DateiPfadErstellen( const char *pfad ) // Erstellt eine Datei in dem Pfad
 {
     Text pf = pfad;
     bool erst = 1;
@@ -639,14 +639,14 @@ bool Framework::DateiPfadErstellen( const char* pfad ) // Erstellt eine Datei in
     pf.ersetzen( "/", "\\" );
     for( int i = 0; i < pf.anzahlVon( "\\" ); ++i ) // Jeden ordner erstellen wenn er nicht existiert
     {
-        Text* t = pf.getTeilText( 0, pf.positionVon( "\\", i ) );
+        Text *t = pf.getTeilText( 0, pf.positionVon( "\\", i ) );
         if( !t || !t->getLength() )
         {
             if( t )
                 t->release();
             continue;
         }
-        if( !DateiExistiert( (Text *)t->getThis() ) )
+        if( !DateiExistiert( dynamic_cast<Text *>( t->getThis() ) ) )
 #pragma warning(suppress: 6031)
             _mkdir( t->getText() );
         t->release();
@@ -657,7 +657,7 @@ bool Framework::DateiPfadErstellen( const char* pfad ) // Erstellt eine Datei in
     pf.ersetzen( "\\", "/" ); // Pfadangaben korrigieren
     for( int i = 0; i < pf.anzahlVon( "/" ); ++i ) // Jeden ordner erstellen wenn er nicht existiert
     {
-        Text* t = pf.getTeilText( 0, pf.positionVon( "/", i ) );
+        Text *t = pf.getTeilText( 0, pf.positionVon( "/", i ) );
         if( !t || !t->getLength() )
         {
             if( t )
@@ -679,25 +679,25 @@ bool Framework::DateiPfadErstellen( const char* pfad ) // Erstellt eine Datei in
     return DateiExistiert( pf );
 }
 
-bool Framework::DateiRemove( const char* pfad ) // Löscht die angegebene Datei
+bool Framework::DateiRemove( const char *pfad ) // Löscht die angegebene Datei
 {
     Text pfa = pfad;
 #ifdef WIN32
     pfa.ersetzen( '\\', '/' );
     bool ret = 0;
     // prüfen ob Datei existiert
-    if( !DateiIstVerzeichnis( (Text *)pfa.getThis() ) )
+    if( !DateiIstVerzeichnis( dynamic_cast<Text *>( pfa.getThis() ) ) )
         ret = DeleteFile( pfa.getText() ) == 1; // Datei löschen
     else
     {
         ret = 1;
-        Datei* dat = new Datei();
-        dat->setDatei( (Text *)pfa.getThis() );
+        Datei *dat = new Datei();
+        dat->setDatei( dynamic_cast<Text *>( pfa.getThis() ) );
         int anz = dat->getUnterdateiAnzahl();
-        RCArray< Text >* liste = dat->getDateiListe();
+        RCArray< Text > *liste = dat->getDateiListe();
         for( int i = 0; i < anz; ++i )
         {
-            Text* pf = new Text( pfa.getText() );
+            Text *pf = new Text( pfa.getText() );
             if( pf->getText()[ pf->getLength() - 1 ] != '/' )
                 pf->append( "/" );
             pf->append( liste->get( i ) );
@@ -723,13 +723,13 @@ bool Framework::DateiRemove( const char* pfad ) // L
     else
     {
         ret = 1;
-        Datei* dat = new Datei();
+        Datei *dat = new Datei();
         dat->setDatei( pfa.getThis() );
         int anz = dat->getUnterdateiAnzahl();
-        RCArray< Text >* liste = dat->getDateiListe();
+        RCArray< Text > *liste = dat->getDateiListe();
         for( int i = 0; i < anz; ++i )
         {
-            Text* pf = new Text( pfa.getText() );
+            Text *pf = new Text( pfa.getText() );
             if( pf->getText()[ pf->getLength() - 1 ] != '/' )
                 pf->append( "/" );
             pf->append( liste->get( i ) );
@@ -749,7 +749,7 @@ bool Framework::DateiRemove( const char* pfad ) // L
 #endif
 }
 
-bool Framework::DateiUmbenennen( const char* pfad_alt, const char* pfad_neu ) // Benennt die Datei um
+bool Framework::DateiUmbenennen( const char *pfad_alt, const char *pfad_neu ) // Benennt die Datei um
 {
 #ifdef WIN32
     if( pfad_alt && pfad_neu && DateiExistiert( pfad_alt ) )
@@ -766,7 +766,7 @@ bool Framework::DateiUmbenennen( const char* pfad_alt, const char* pfad_neu ) //
             }
             Datei d;
             d.setDatei( pfad_alt );
-            RCArray< Text >* list = d.getDateiListe();
+            RCArray< Text > *list = d.getDateiListe();
             int anz = list->getEintragAnzahl();
             for( int i = 0; i < anz; i++ )
             {
@@ -804,7 +804,7 @@ bool Framework::DateiUmbenennen( const char* pfad_alt, const char* pfad_neu ) //
             }
             Datei d;
             d.setDatei( pfad_alt );
-            RCArray< Text >* list = d.getDateiListe();
+            RCArray< Text > *list = d.getDateiListe();
             int anz = list->getEintragAnzahl();
             for( int i = 0; i < anz; i++ )
             {
@@ -830,7 +830,7 @@ bool Framework::DateiUmbenennen( const char* pfad_alt, const char* pfad_neu ) //
 #endif
 }
 
-bool Framework::DateiExistiert( const char* pfad ) // Prüft, ob Datei existiert
+bool Framework::DateiExistiert( const char *pfad ) // Prüft, ob Datei existiert
 {
 #ifdef WIN32
     bool ret = PathFileExists( pfad ) != 0;
@@ -843,7 +843,7 @@ bool Framework::DateiExistiert( const char* pfad ) // Pr
 #endif
 }
 
-bool Framework::DateiIstVerzeichnis( const char* pfad ) // prüft, ob pfad ein Verzeichnis ist
+bool Framework::DateiIstVerzeichnis( const char *pfad ) // prüft, ob pfad ein Verzeichnis ist
 {
 #ifdef WIN32
     WIN32_FIND_DATA wfd;

+ 1 - 1
DateiDialog.cpp

@@ -232,7 +232,7 @@ void DateiDialogTh::thread()
 // constant
 Text *DateiDialogTh::getPfad() const
 {
-    return ret ? (Text *)ret->getThis() : 0;
+    return ret ? dynamic_cast<Text *>( ret->getThis() ) : 0;
 }
 
 Text *DateiDialogTh::zPfad() const

+ 75 - 75
DateiSystem.cpp

@@ -1040,7 +1040,7 @@ void LTDBBody::laden( FBalken *zF, std::ifstream *inF ) // l
     while( index < gr.x * gr.y ) // für jeden Pixel
     {
         if( !dieser ) // wenn es nicht der erste Pixel ist
-            dieser = new LTDBPixel( (LTDBPixel *)davor->getThis() );
+            dieser = new LTDBPixel( dynamic_cast<LTDBPixel *>( davor->getThis() ) );
         int ende = -1;
         while( ende < 0 ) // Pixel laden
         {
@@ -1055,7 +1055,7 @@ void LTDBBody::laden( FBalken *zF, std::ifstream *inF ) // l
         buff[ ( index % gr.x ) + ( index / gr.x ) * breite ] = dieser->zuFarbe();
         if( davor )
             davor = (LTDBPixel *)davor->release();
-        davor = (LTDBPixel *)dieser->getThis();
+        davor = dynamic_cast<LTDBPixel *>( dieser->getThis() );
         dieser = (LTDBPixel *)dieser->release();
         ++index;
 #ifdef WIN32
@@ -1094,7 +1094,7 @@ void LTDBBody::speichern( FBalken *zF, std::ofstream *outF ) const // speichert
         for( int i = 0; i < gr.x * gr.y; ++i ) // für jeden Pixel
         {
             if( !dieser ) // wenn es nicht der erste Pixel ist
-                dieser = new LTDBPixel( (LTDBPixel *)letzter->getThis() );
+                dieser = new LTDBPixel( dynamic_cast<LTDBPixel *>( letzter->getThis() ) );
             dieser->setFarbe( pBuff[ i ] ); // Farbe des Pixels setzen
             dieser->komprimieren(); // Pixel komprimieren
             ende = -1;
@@ -1115,7 +1115,7 @@ void LTDBBody::speichern( FBalken *zF, std::ofstream *outF ) const // speichert
                 begin = 0;
             if( letzter )
                 letzter->release();
-            letzter = (LTDBPixel *)dieser->getThis(); // dieser wird zu letzter
+            letzter = dynamic_cast<LTDBPixel *>( dieser->getThis() ); // dieser wird zu letzter
             dieser = (LTDBPixel *)dieser->release();
 #ifdef WIN32
             if( zF )
@@ -1134,7 +1134,7 @@ void LTDBBody::speichern( FBalken *zF, std::ofstream *outF ) const // speichert
 
 Bild *LTDBBody::getBild() const // gibt das geladene Bild zurück
 {
-    return (Bild *)b->getThis();
+    return dynamic_cast<Bild *>( b->getThis() );
 }
 
 const Punkt &LTDBBody::getSize() const // gibt die größe des Bildes zurück
@@ -1165,13 +1165,13 @@ void LTDBDatei::setDatei( Text *pfad ) // Setzt den Pfad zur Datei
     if( datKpf )
         datKpf = (LTDBDateiKopf *)datKpf->release();
     // Pfad setzen
-    this->pfad->setText( (Text *)pfad->getThis() );
+    this->pfad->setText( dynamic_cast<Text *>( pfad->getThis() ) );
     pfad->release();
 }
 
 void LTDBDatei::erstellen() // Erstellt die Datei
 {
-    DateiPfadErstellen( (Text *)pfad->getThis() );
+    DateiPfadErstellen( dynamic_cast<Text *>( pfad->getThis() ) );
     std::ofstream *outF = new std::ofstream( pfad->getText(), std::ios::binary );
     int i = 0;
     outF->write( (char *)&i, 2 );
@@ -1180,7 +1180,7 @@ void LTDBDatei::erstellen() // Erstellt die Datei
 
 void LTDBDatei::leseDaten( FBalken *f ) // Die Klasse ließt alle Bilder kurz ein, und merkt sich, an welcher stelle in der Datei was ist
 { // Diese Funktion wird ein wenig Zeit in Anspruch nemen, dafüraber danach die anderen schneller machen
-    if( DateiExistiert( (Text *)pfad->getThis() ) )
+    if( DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
     {
         if( datKpf )
             datKpf->release();
@@ -1193,9 +1193,9 @@ void LTDBDatei::leseDaten( FBalken *f ) // Die Klasse lie
 
 void LTDBDatei::remove() // Löscht die Datei
 {
-    if( DateiExistiert( (Text *)pfad->getThis() ) )
+    if( DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
     {
-        DateiRemove( (Text *)pfad->getThis() );
+        DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
         if( datKpf )
             datKpf->release();
     }
@@ -1203,7 +1203,7 @@ void LTDBDatei::remove() // L
 
 void LTDBDatei::remove( FBalken *f, Text *name ) // Löscht ein Bild aus der Datei
 {
-    if( DateiExistiert( (Text *)pfad->getThis() ) && name )
+    if( DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) && name )
     {
         if( !datKpf )
             leseDaten( 0 ); // Daten einlesen
@@ -1213,7 +1213,7 @@ void LTDBDatei::remove( FBalken *f, Text *name ) // L
             name->release();
             return;
         }
-        int index = datKpf->getBildIndex( (Text *)name->getThis() );
+        int index = datKpf->getBildIndex( dynamic_cast<Text *>( name->getThis() ) );
         if( index == -1 ) // das bild existiert nicht
         {
             name->release();
@@ -1223,7 +1223,7 @@ void LTDBDatei::remove( FBalken *f, Text *name ) // L
         Text *pf_tmp = new Text( pfad->getText() );
         char c = '0';
         pf_tmp->append( "0" );
-        for( int i = 0; DateiExistiert( (Text *)pf_tmp->getThis() ); ++i )
+        for( int i = 0; DateiExistiert( dynamic_cast<Text *>( pf_tmp->getThis() ) ); ++i )
         {
             c = (char)( '0' + ( i % 10 ) );
             if( ( i % 10 ) == 0 )
@@ -1255,7 +1255,7 @@ void LTDBDatei::remove( FBalken *f, Text *name ) // L
             } // zu löschendes Bild überspringen
             LTDBKopf *delkpf = new LTDBKopf();
             delkpf->laden( inF );
-            LTDBBody *delkpr = new LTDBBody( (LTDBKopf *)delkpf->getThis() );
+            LTDBBody *delkpr = new LTDBBody( dynamic_cast<LTDBKopf *>( delkpf->getThis() ) );
             delkpr->laden( f, inF );
             delkpf = (LTDBKopf *)delkpf->release();
             delkpr = (LTDBBody *)delkpr->release(); // restliche bytes kopieren
@@ -1271,8 +1271,8 @@ void LTDBDatei::remove( FBalken *f, Text *name ) // L
             datKpf->speichern( outF );
             inF->close();
             outF->close();
-            DateiRemove( (Text *)pfad->getThis() );
-            DateiUmbenennen( (Text *)pf_tmp->getThis(), (Text *)pfad->getThis() );
+            DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
+            DateiUmbenennen( dynamic_cast<Text *>( pf_tmp->getThis() ), dynamic_cast<Text *>( pfad->getThis() ) );
         }
         delete inF;
         delete outF;
@@ -1286,7 +1286,7 @@ Bild *LTDBDatei::laden( FBalken *f, Text *name ) // L
 {
     if( name )
     {
-        if( !DateiExistiert( (Text *)pfad->getThis() ) )
+        if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         {
             name->release();
             return 0;
@@ -1294,7 +1294,7 @@ Bild *LTDBDatei::laden( FBalken *f, Text *name ) // L
         if( !datKpf )
             leseDaten( 0 );
         LTDBKopf *k_tmp = new LTDBKopf();
-        k_tmp->Init( (Text *)name->getThis(), Punkt( 0, 0 ) );
+        k_tmp->Init( dynamic_cast<Text *>( name->getThis() ), Punkt( 0, 0 ) );
         int index = datKpf->getBildIndex( k_tmp->getTitel() );
         k_tmp->release();
         if( index == -1 )
@@ -1302,7 +1302,7 @@ Bild *LTDBDatei::laden( FBalken *f, Text *name ) // L
             Text *fehler = new Text( "Das Bild " );
             fehler->append( name );
             fehler->append( " wurde nicht in der Datei\n" );
-            fehler->append( (Text *)pfad->getThis() );
+            fehler->append( dynamic_cast<Text *>( pfad->getThis() ) );
             fehler->append( " gefunden!" );
             std::cout << fehler << "\n";
             return 0;
@@ -1314,7 +1314,7 @@ Bild *LTDBDatei::laden( FBalken *f, Text *name ) // L
         LTDBKopf *kpf = new LTDBKopf();
         kpf->laden( inF );
         Text *t = kpf->getTitel();
-        if( !t->istGleich( (Text *)name->getThis() ) )
+        if( !t->istGleich( dynamic_cast<Text *>( name->getThis() ) ) )
         { // Fehlermeldung 
             t->release();
             kpf->release();
@@ -1330,7 +1330,7 @@ Bild *LTDBDatei::laden( FBalken *f, Text *name ) // L
             return 0;
         }
         t->release();
-        LTDBBody *kpr = new LTDBBody( (LTDBKopf *)kpf->getThis() );
+        LTDBBody *kpr = new LTDBBody( dynamic_cast<LTDBKopf *>( kpf->getThis() ) );
         kpr->laden( f, inF ); // Bild laden
         Bild *ret = kpr->getBild();
         kpr->release();
@@ -1348,16 +1348,16 @@ int LTDBDatei::speichern( FBalken *f, Bild *bild, Text *name ) // Speichert ein
     int warn = -1;
     if( name && bild )
     {
-        if( DateiExistiert( (Text *)pfad->getThis() ) )
+        if( DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         {
             if( !datKpf )
                 leseDaten( 0 );
-            int index = datKpf->getBildIndex( (Text *)name->getThis() );
+            int index = datKpf->getBildIndex( dynamic_cast<Text *>( name->getThis() ) );
             if( index == -1 )
             {
                 warn = 0;
                 LTDBKopf *kpf = new LTDBKopf();
-                warn = kpf->Init( (Text *)name->getThis(), bild->getSize() );
+                warn = kpf->Init( dynamic_cast<Text *>( name->getThis() ), bild->getSize() );
                 if( datKpf->getBildIndex( kpf->getTitel() ) != -1 )
                 {
                     std::cout << "Es existiert bereits ein Bild mit diesem Namen!\n";
@@ -1370,7 +1370,7 @@ int LTDBDatei::speichern( FBalken *f, Bild *bild, Text *name ) // Speichert ein
                 Text *pf_tmp = new Text( pfad->getText() );
                 char c = '0';
                 pf_tmp->append( "0" );
-                for( int i = 0; DateiExistiert( (Text *)pf_tmp->getThis() ); ++i )
+                for( int i = 0; DateiExistiert( dynamic_cast<Text *>( pf_tmp->getThis() ) ); ++i )
                 {
                     c = (char)( '0' + ( i % 10 ) );
                     if( ( i % 10 ) == 0 )
@@ -1401,8 +1401,8 @@ int LTDBDatei::speichern( FBalken *f, Bild *bild, Text *name ) // Speichert ein
                     outF->write( &byte, 1 );
                 }
                 kpf->speichern( outF ); // Bild Kopf speichern
-                LTDBBody *kpr = new LTDBBody( (LTDBKopf *)kpf->getThis() );
-                kpr->setBild( (Bild *)bild->getThis() );
+                LTDBBody *kpr = new LTDBBody( dynamic_cast<LTDBKopf *>( kpf->getThis() ) );
+                kpr->setBild( dynamic_cast<Bild *>( bild->getThis() ) );
                 kpr->speichern( f, outF ); // Bild speichern
                 kpf->release();
                 kpr->release();
@@ -1410,8 +1410,8 @@ int LTDBDatei::speichern( FBalken *f, Bild *bild, Text *name ) // Speichert ein
                 outF->close();
                 delete inF;
                 delete outF;
-                DateiRemove( (Text *)pfad->getThis() );
-                DateiUmbenennen( (Text *)pf_tmp, (Text *)pfad->getThis() );
+                DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
+                DateiUmbenennen( (Text *)pf_tmp, dynamic_cast<Text *>( pfad->getThis() ) );
             }
         }
     }
@@ -1434,7 +1434,7 @@ RCArray< Text > *LTDBDatei::zBildListe() // Listet alle Bilder in der datei auf
 // constant 
 Text *LTDBDatei::getPfad() const // Gibt den Pfad zur Datei zurück
 {
-    return (Text *)pfad->getThis();
+    return dynamic_cast<Text *>( pfad->getThis() );
 }
 
 int LTDBDatei::getBildAnzahl() const
@@ -1448,7 +1448,7 @@ bool LTDBDatei::istOffen() const // Pr
 {
     if( !pfad )
         return 0;
-    return DateiExistiert( (Text *)pfad->getThis() );
+    return DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 #ifdef WIN32
 // LTDS Dateivormat 
@@ -2103,7 +2103,7 @@ void LTDSBuchstabenK
         for( int i = 0; i < size.x * size.y; ++i )
         {
             if( !jetzt ) // wenn es nicht der erste Pixel ist
-                jetzt = new LTDSPixel( (LTDSPixel *)vorher->getThis() );
+                jetzt = new LTDSPixel( dynamic_cast<LTDSPixel *>( vorher->getThis() ) );
             int ende = -1;
             while( ende < 0 ) // Pixel laden
             {
@@ -2119,7 +2119,7 @@ void LTDSBuchstabenK
                 buchstabe->setPixel( i, jetzt->getA() );
             if( vorher )
                 vorher = (LTDSPixel *)vorher->release();
-            vorher = (LTDSPixel *)jetzt->getThis();
+            vorher = dynamic_cast<LTDSPixel *>( jetzt->getThis() );
             jetzt = (LTDSPixel *)jetzt->release();
         }
         if( vorher )
@@ -2143,7 +2143,7 @@ void LTDSBuchstabenK
         for( int i = 0; i < size.x * size.y; ++i ) // für jeden Pixel
         {
             if( !jetzt ) // wenn es nicht der erste Pixel ist
-                jetzt = new LTDSPixel( (LTDSPixel *)vorher->getThis() );
+                jetzt = new LTDSPixel( dynamic_cast<LTDSPixel *>( vorher->getThis() ) );
             jetzt->setAlpha( alphaBuff[ i ] ); // Farbe des Pixels setzen
             jetzt->Komp(); // Pixel komprimieren
             ende = -1;
@@ -2164,7 +2164,7 @@ void LTDSBuchstabenK
                 begin = 0;
             if( vorher )
                 vorher->release();
-            vorher = (LTDSPixel *)jetzt->getThis(); // dieser wird zu letzter
+            vorher = dynamic_cast<LTDSPixel *>( jetzt->getThis() ); // dieser wird zu letzter
             jetzt = (LTDSPixel *)jetzt->release();
         }
         if( vorher )
@@ -2179,7 +2179,7 @@ void LTDSBuchstabenK
 
 Buchstabe *LTDSBuchstabenKörper::getBuchstabe() const // gibt den Buchstaben zurück
 {
-    return (Buchstabe *)buchstabe->getThis();
+    return dynamic_cast<Buchstabe *>( buchstabe->getThis() );
 }
 
 unsigned char LTDSBuchstabenKörper::getZeichen() const // gibt das Zeichen zurück
@@ -2214,7 +2214,7 @@ void LTDSDatei::setPfad( Text *txt ) // setzt den Pfad zur Datei
 
 void LTDSDatei::leseDaten() // ließt den Dateikopf
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return;
     if( dateiKopf )
         dateiKopf->release();
@@ -2227,7 +2227,7 @@ void LTDSDatei::leseDaten() // lie
 
 void LTDSDatei::addSchriftgröße( Alphabet *alphabet ) // fügt eine Schriftgröße hinzu
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) ) // prüfen, ob die Datei existiert
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) ) // prüfen, ob die Datei existiert
         return;
     if( !dateiKopf ) // prüfen, ob der Dateikopf schon gelesen wurde
         leseDaten();
@@ -2283,7 +2283,7 @@ void LTDSDatei::addSchriftgr
     dateiKopf->speichern( outF ); // aktualisierter Dateikopf speichern
     outF->seekp( sgPosList[ sganzahl ], std::ios::beg );
     LTDSSchriftKopf *sgkopf = new LTDSSchriftKopf(); // Kopf der neuen Schriftgröße
-    sgkopf->setZeichenAlphabet( (Alphabet *)alphabet->getThis() ); // Kopf der Schriftgröße initialisieren
+    sgkopf->setZeichenAlphabet( dynamic_cast<Alphabet *>( alphabet->getThis() ) ); // Kopf der Schriftgröße initialisieren
     sgkopf->speichern( outF ); // Kopf der Schriftgröße speichern
     int *BuchstabenPosList = sgkopf->getPositionen(); // positionen der verschiedenen Zeichen in der Datei( nuch 0 )
     int count = 0;
@@ -2296,9 +2296,9 @@ void LTDSDatei::addSchriftgr
             LTDSBuchstabenKopf *zeichKpf = new LTDSBuchstabenKopf(); // Zeichenkopf
             zeichKpf->init( i, zeich->getBreite(), zeich->getHeight() );
             zeichKpf->speichern( outF ); // Zeichenkopf speichern
-            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)zeichKpf->getThis() ); // Zeichenkörper
+            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( zeichKpf->getThis() ) ); // Zeichenkörper
             zeichKpf->release();
-            zeichKörp->setBuchstabe( (Buchstabe *)zeich->getThis() );
+            zeichKörp->setBuchstabe( dynamic_cast<Buchstabe *>( zeich->getThis() ) );
             zeichKörp->speichern( outF ); // Zeichenkörper speichern
             zeich->release();
             ++count;
@@ -2310,8 +2310,8 @@ void LTDSDatei::addSchriftgr
     Text *pfad2 = new Text();
     pfad2->setText( pfad->getText() );
     pfad->remove( pfad->getLength() - 1, pfad->getLength() );
-    DateiRemove( (Text *)pfad->getThis() ); // Alte datei Löschen
-    DateiUmbenennen( (Text *)pfad2->getThis(), (Text *)pfad->getThis() ); // neue Datei nach alte umbenennen
+    DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) ); // Alte datei Löschen
+    DateiUmbenennen( dynamic_cast<Text *>( pfad2->getThis() ), dynamic_cast<Text *>( pfad->getThis() ) ); // neue Datei nach alte umbenennen
     pfad2->release(); // Speicher freigeben
     sgkopf->release();
     delete inF;
@@ -2321,7 +2321,7 @@ void LTDSDatei::addSchriftgr
 
 void LTDSDatei::addBuchstabe( int gr, Buchstabe *zeich, unsigned char zeichen ) // Fügt einer Schriftgröße einen Buchstaben hinzu
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) ) // prüfen ob Datei existiert
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) ) // prüfen ob Datei existiert
     {
         zeich->release();
         return;
@@ -2391,9 +2391,9 @@ void LTDSDatei::addBuchstabe( int gr, Buchstabe *zeich, unsigned char zeichen )
         LTDSBuchstabenKopf *zeichKpf = new LTDSBuchstabenKopf(); // Buchstabenkopf
         zeichKpf->init( zeichen, zeich->getSize() );
         zeichKpf->speichern( outF ); // Buchstabenkopf speichern
-        LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)zeichKpf->getThis() ); // Buchstabenkörper
+        LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( zeichKpf->getThis() ) ); // Buchstabenkörper
         zeichKpf->release();
-        zeichKörp->setBuchstabe( (Buchstabe *)zeich->getThis() );
+        zeichKörp->setBuchstabe( dynamic_cast<Buchstabe *>( zeich->getThis() ) );
         zeichKörp->speichern( outF ); // Buchstabenkörper speichern
         zeichKörp->release();
     }
@@ -2434,9 +2434,9 @@ void LTDSDatei::addBuchstabe( int gr, Buchstabe *zeich, unsigned char zeichen )
         LTDSBuchstabenKopf *zeichKpf = new LTDSBuchstabenKopf(); // Zeichenkopf
         zeichKpf->init( zeichen, zeich->getSize() );
         zeichKpf->speichern( outF ); // Zeichenkopf speichern
-        LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)zeichKpf->getThis() ); // Zeichenkörper
+        LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( zeichKpf->getThis() ) ); // Zeichenkörper
         zeichKpf->release();
-        zeichKörp->setBuchstabe( (Buchstabe *)zeich->getThis() );
+        zeichKörp->setBuchstabe( dynamic_cast<Buchstabe *>( zeich->getThis() ) );
         zeichKörp->speichern( outF ); // Zeichenkörper speichern
         zeichKörp->release();
         int nowPos = (int)outF->tellp();
@@ -2476,8 +2476,8 @@ void LTDSDatei::addBuchstabe( int gr, Buchstabe *zeich, unsigned char zeichen )
     outF->close();
     Text *pfad2 = new Text( pfad->getText() );
     pfad->remove( pfad->getLength() - 1, pfad->getLength() );
-    DateiRemove( (Text *)pfad->getThis() ); // Alte Datei löschen
-    DateiUmbenennen( (Text *)pfad2->getThis(), (Text *)pfad->getThis() ); // Neue Datei in alte umbenennen
+    DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) ); // Alte Datei löschen
+    DateiUmbenennen( dynamic_cast<Text *>( pfad2->getThis() ), dynamic_cast<Text *>( pfad->getThis() ) ); // Neue Datei in alte umbenennen
     pfad2->release();// Speicher freigeben
     delete inF;
     delete outF;
@@ -2486,7 +2486,7 @@ void LTDSDatei::addBuchstabe( int gr, Buchstabe *zeich, unsigned char zeichen )
 
 void LTDSDatei::löscheSchrifrGröße( int gr ) // Löscht eine Schriftgröße aus der Datei
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) ) // prüfen, ob Datei existiert
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) ) // prüfen, ob Datei existiert
         return;
     if( !dateiKopf ) // prüfen, ob der Dateikopf geladen wurde
         leseDaten();
@@ -2563,8 +2563,8 @@ void LTDSDatei::l
     outF->close();
     Text *pfad2 = new Text( pfad->getText() );
     pfad->remove( pfad->getLength() - 1, pfad->getLength() );
-    DateiRemove( (Text *)pfad->getThis() ); // alte Datei löschen
-    DateiUmbenennen( (Text *)pfad2->getThis(), (Text *)pfad->getThis() ); // neue Datei zu alter umbenennen
+    DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) ); // alte Datei löschen
+    DateiUmbenennen( dynamic_cast<Text *>( pfad2->getThis() ), dynamic_cast<Text *>( pfad->getThis() ) ); // neue Datei zu alter umbenennen
     pfad2->release();
     delete inF;
     delete outF;
@@ -2572,7 +2572,7 @@ void LTDSDatei::l
 
 void LTDSDatei::löscheBuchstabe( int gr, unsigned char zeichen ) // Löscht einen Buchstaben aus der Datei
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) ) // prüfen, ob die Datei existiert
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) ) // prüfen, ob die Datei existiert
         return;
     if( !dateiKopf ) // prüfen, ob der Dateikopf gelesen wurde
         leseDaten();
@@ -2621,7 +2621,7 @@ void LTDSDatei::l
                 outF->close();
                 delete inF;
                 delete outF;
-                DateiRemove( (Text *)pfad->getThis() );
+                DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
                 pfad->remove( pfad->getLength() - 1, pfad->getLength() );
                 return; // abbruch
             }
@@ -2703,8 +2703,8 @@ void LTDSDatei::l
     outF->close();
     Text *pfad2 = new Text( pfad->getText() );
     pfad->remove( pfad->getLength() - 1, pfad->getLength() );
-    DateiRemove( (Text *)pfad->getThis() ); // alte Datei löschen
-    DateiUmbenennen( (Text *)pfad2->getThis(), (Text *)pfad->getThis() ); // neue Datei nach alte umbenennen
+    DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) ); // alte Datei löschen
+    DateiUmbenennen( dynamic_cast<Text *>( pfad2->getThis() ), dynamic_cast<Text *>( pfad->getThis() ) ); // neue Datei nach alte umbenennen
     pfad2->release(); // Speicher freigeben
     delete inF;
     delete outF;
@@ -2712,16 +2712,16 @@ void LTDSDatei::l
 
 void LTDSDatei::löscheDatei() // Löscht die gesamte Datei
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return;
     if( !dateiKopf )
         leseDaten();
-    DateiRemove( (Text *)pfad->getThis() );
+    DateiRemove( dynamic_cast<Text *>( pfad->getThis() ) );
 }
 
 void LTDSDatei::erstelleDatei() // erstellt die Datei
 {
-    DateiPfadErstellen( (Text *)pfad->getThis() );
+    DateiPfadErstellen( dynamic_cast<Text *>( pfad->getThis() ) );
     if( dateiKopf )
         dateiKopf->release();
     dateiKopf = new LTDSDateiKopf();
@@ -2733,7 +2733,7 @@ void LTDSDatei::erstelleDatei() // erstellt die Datei
 
 void LTDSDatei::speicherSchrift( Schrift *schrift ) // Speichert die übergebene Schrift
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
     {
         schrift->release();
         return;
@@ -2767,8 +2767,8 @@ void LTDSDatei::speicherSchrift( Schrift *schrift ) // Speichert die 
             Buchstabe *zeichen = alp->getBuchstabe( sgKpf->getZeichen()[ i1 ] );
             zeichKpf->init( sgKpf->getZeichen()[ i1 ], zeichen->getBreite(), zeichen->getHeight() );
             zeichKpf->speichern( outF );
-            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)zeichKpf->getThis() );
-            zeichKörp->setBuchstabe( (Buchstabe *)zeichen->getThis() );
+            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( zeichKpf->getThis() ) );
+            zeichKörp->setBuchstabe( dynamic_cast<Buchstabe *>( zeichen->getThis() ) );
             zeichKörp->speichern( outF );
             zeichKörp->release();
             zeichen->release();
@@ -2791,7 +2791,7 @@ void LTDSDatei::speicherSchrift( Schrift *schrift ) // Speichert die 
 // constant 
 Schrift *LTDSDatei::ladeSchrift() // gibt die geladene Schrift zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2808,13 +2808,13 @@ Schrift *LTDSDatei::ladeSchrift() // gibt die geladene Schrift zur
         {
             LTDSBuchstabenKopf *zeichKpf = new LTDSBuchstabenKopf();
             zeichKpf->laden( inF );
-            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)zeichKpf->getThis() );
+            LTDSBuchstabenKörper *zeichKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( zeichKpf->getThis() ) );
             zeichKörp->laden( inF );
             alphabet->setBuchstabe( zeichKpf->getZeichen(), zeichKörp->getBuchstabe() );
             zeichKörp->release();
             zeichKpf->release();
         }
-        ret->addAlphabet( (Alphabet *)alphabet->getThis() );
+        ret->addAlphabet( dynamic_cast<Alphabet *>( alphabet->getThis() ) );
         alphabet->release();
         sgKpf->release();
     }
@@ -2825,7 +2825,7 @@ Schrift *LTDSDatei::ladeSchrift() // gibt die geladene Schrift zur
 
 Alphabet *LTDSDatei::ladeAlphabet( int schriftgröße ) // gibt eine geladene Schrift nur mit der angegebenen Schriftgröße zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2852,7 +2852,7 @@ Alphabet *LTDSDatei::ladeAlphabet( int schriftgr
     {
         LTDSBuchstabenKopf *sgZKpf = new LTDSBuchstabenKopf();
         sgZKpf->laden( inF );
-        LTDSBuchstabenKörper *sgZKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)sgZKpf->getThis() );
+        LTDSBuchstabenKörper *sgZKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( sgZKpf->getThis() ) );
         sgZKörp->laden( inF );
         ret->setBuchstabe( sgZKpf->getZeichen(), sgZKörp->getBuchstabe() );
         sgZKörp->release();
@@ -2866,7 +2866,7 @@ Alphabet *LTDSDatei::ladeAlphabet( int schriftgr
 
 Buchstabe *LTDSDatei::ladeBuchstabe( int schriftgröße, unsigned char zeichen )// Läd einen bestimmten Buchstaben
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2900,7 +2900,7 @@ Buchstabe *LTDSDatei::ladeBuchstabe( int schriftgr
         inF->seekg( sgKpf->getPositionen()[ sgZNum ], std::ios::beg );
         LTDSBuchstabenKopf *sgZKpf = new LTDSBuchstabenKopf();
         sgZKpf->laden( inF );
-        LTDSBuchstabenKörper *sgZKörp = new LTDSBuchstabenKörper( (LTDSBuchstabenKopf *)sgZKpf->getThis() );
+        LTDSBuchstabenKörper *sgZKörp = new LTDSBuchstabenKörper( dynamic_cast<LTDSBuchstabenKopf *>( sgZKpf->getThis() ) );
         sgZKörp->laden( inF );
         ret = sgZKörp->getBuchstabe();
         sgZKörp->release();
@@ -2918,12 +2918,12 @@ Buchstabe *LTDSDatei::ladeBuchstabe( int schriftgr
 
 Text *LTDSDatei::getPfad() const // gibt den Dateipfad zurück
 {
-    return (Text *)pfad->getThis();
+    return dynamic_cast<Text *>( pfad->getThis() );
 }
 
 int LTDSDatei::getAnzahlSchriftgrößen() const // gibt die Anzahl der Schriftgrößen aus der Datei zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2932,7 +2932,7 @@ int LTDSDatei::getAnzahlSchriftgr
 
 unsigned char *LTDSDatei::getSchriftGrößen() const // gibt einen Array von Schriftgrößen zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2941,7 +2941,7 @@ unsigned char *LTDSDatei::getSchriftGr
 
 unsigned char LTDSDatei::getAnzahlBuchstaben( int sg ) // gibt die anzahl gespeicherter Buchstaben einer Schriftgröße zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;
@@ -2974,7 +2974,7 @@ unsigned char LTDSDatei::getAnzahlBuchstaben( int sg ) // gibt die anzahl gespei
 
 unsigned char *LTDSDatei::getBuchstaben( int sg ) // gibt einen Array von Buchstaben einer Schriftgröße zurück
 {
-    if( !DateiExistiert( (Text *)pfad->getThis() ) )
+    if( !DateiExistiert( dynamic_cast<Text *>( pfad->getThis() ) ) )
         return 0;
     if( !dateiKopf )
         return 0;

+ 4 - 4
Diagramm.cpp

@@ -1154,7 +1154,7 @@ void BaseDiag::removeWertStyle( int wNum, int style )
 // constant
 DiagDaten *BaseDiag::getDiagDaten() const // Gibt die Daten des Diagramms zurück
 {
-    return daten ? (DiagDaten *)daten->getThis() : 0;
+    return daten ? dynamic_cast<DiagDaten *>( daten->getThis() ) : 0;
 }
 
 DiagDaten *BaseDiag::zDiagDaten() const
@@ -1852,7 +1852,7 @@ Schrift *LDiag::zSchrift() const
 
 Rahmen *LDiag::getDatenRahmen() const // Gibt den inneren Rahmen um das eigentliche Diagramm zurück
 {
-    return dRam ? (Rahmen *)dRam->getThis() : 0;
+    return dRam ? dynamic_cast<Rahmen *>( dRam->getThis() ) : 0;
 }
 
 Rahmen *LDiag::zDatenRahmen() const
@@ -1877,7 +1877,7 @@ int LDiag::getDatenHintergrundFarbe() const // Gibt den Hintergrund des eigentli
 
 Bild *LDiag::getDatenHintergrundBild() const
 {
-    return dBgB ? (Bild *)dBgB->getThis() : 0;
+    return dBgB ? dynamic_cast<Bild *>( dBgB->getThis() ) : 0;
 }
 
 Bild *LDiag::zDatenHintergrundBild() const
@@ -1887,7 +1887,7 @@ Bild *LDiag::zDatenHintergrundBild() const
 
 AlphaFeld *LDiag::getDatenAlphaFeld() const // Gibt das AlphaFeld des eigentlichen Diagramms zurück
 {
-    return dAf ? (AlphaFeld *)dAf->getThis() : 0;
+    return dAf ? dynamic_cast<AlphaFeld *>( dAf->getThis() ) : 0;
 }
 
 AlphaFeld *LDiag::zDatenAlphaFeld() const

+ 6 - 6
Dialog.cpp

@@ -48,15 +48,15 @@ void *MultiplChoiceDialog::anzeigen( Schrift *zSchrift )
     f->setTastaturAktion( _ret1TE );
     f->erstellen( WS_OVERLAPPEDWINDOW, wc );
     f->setSize( 200, 200 );
-    f->setPosition( Bildschirmmitte( (WFenster *)f->getThis() ) );
+    f->setPosition( Bildschirmmitte( dynamic_cast<WFenster *>( f->getThis() ) ) );
     f->setVerschiebbar( 1 );
     f->setAnzeigeModus( 1 );
-    Bildschirm *b = new Bildschirm2D( (WFenster *)f->getThis() );
-    f->setBildschirm( (Bildschirm *)b->getThis() );
+    Bildschirm *b = new Bildschirm2D( dynamic_cast<WFenster *>( f->getThis() ) );
+    f->setBildschirm( dynamic_cast<Bildschirm *>( b->getThis() ) );
     b->update();
 
     RenderTh *r = new RenderTh();
-    r->setBildschirm( (Bildschirm *)b->getThis() );
+    r->setBildschirm( dynamic_cast<Bildschirm *>( b->getThis() ) );
     r->beginn();
 
     AuswahlBox *ab = new AuswahlBox();
@@ -75,7 +75,7 @@ void *MultiplChoiceDialog::anzeigen( Schrift *zSchrift )
     ab->setAuswAlphaFeldFarbe( 0x0000FF00 );
     ab->setAuswAlphaFeldStrength( -8 );
     ab->setStyle( AuswahlBox::Style::Normal );
-    ab->setSchriftZ( (Schrift *)zSchrift->getThis() );
+    ab->setSchriftZ( dynamic_cast<Schrift *>( zSchrift->getThis() ) );
     for( auto i = entrys->getIterator(); i; i++ )
         ab->addEintrag( i->getText() );
     ab->setMausEreignis( _ret1ME );
@@ -85,7 +85,7 @@ void *MultiplChoiceDialog::anzeigen( Schrift *zSchrift )
     ok->setStyle( Knopf::Style::Normal );
     ok->setPosition( 50, 150 );
     ok->setSize( 100, 20 );
-    ok->setSchriftZ( (Schrift *)zSchrift->getThis() );
+    ok->setSchriftZ( dynamic_cast<Schrift *>( zSchrift->getThis() ) );
     ok->setText( "Ok" );
     ok->setMausEreignis( [this, &ex, &result, ab]( void *p, void *o, MausEreignis me )
     {

+ 12 - 12
Fenster.cpp

@@ -881,7 +881,7 @@ Bildschirm *WFenster::getBildschirm() const
 {
     if( !screen )
         return 0;
-    return (Bildschirm *)screen->getThis();
+    return dynamic_cast<Bildschirm *>( screen->getThis() );
 }
 
 Bildschirm *WFenster::zBildschirm() const
@@ -2063,7 +2063,7 @@ Rahmen *Fenster::getRahmen() const // gibt den Rahmen zur
 {
     if( !rahmen )
         return 0;
-    return (Rahmen *)rahmen->getThis();
+    return dynamic_cast<Rahmen *>( rahmen->getThis() );
 }
 
 Rahmen *Fenster::zRahmen() const
@@ -2104,7 +2104,7 @@ TextFeld *Fenster::getTTextFeld() const // gibt das Titel TextFeld zur
 {
     if( !titel )
         return 0;
-    return (TextFeld *)titel->getThis();
+    return dynamic_cast<TextFeld *>( titel->getThis() );
 }
 
 TextFeld *Fenster::zTTextFeld() const
@@ -2233,7 +2233,7 @@ Bild *Fenster::getKBgBild() const // gibt das K
 {
     if( !bgBodyPicture )
         return 0;
-    return (Bild *)bgBodyPicture->getThis();
+    return dynamic_cast<Bild *>( bgBodyPicture->getThis() );
 }
 
 Bild *Fenster::zKBgBild() const
@@ -2246,7 +2246,7 @@ AlphaFeld *Fenster::getKAlphaFeld() const // gibt das K
 {
     if( !bodyBuffer )
         return 0;
-    return (AlphaFeld *)bodyBuffer->getThis();
+    return dynamic_cast<AlphaFeld *>( bodyBuffer->getThis() );
 }
 
 AlphaFeld *Fenster::zKAlphaFeld() const
@@ -2279,7 +2279,7 @@ Bild *Fenster::getSBgBild() const // gibt das Schlie
 {
     if( !bgClosingBild )
         return 0;
-    return (Bild *)bgClosingBild->getThis();
+    return dynamic_cast<Bild *>( bgClosingBild->getThis() );
 }
 
 Bild *Fenster::zSBgBild() const
@@ -2292,7 +2292,7 @@ AlphaFeld *Fenster::getSAlphaFeld() const // gibt das Schlie
 {
     if( !closeBuffer )
         return 0;
-    return (AlphaFeld *)closeBuffer->getThis();
+    return dynamic_cast<AlphaFeld *>( closeBuffer->getThis() );
 }
 
 AlphaFeld *Fenster::zSAlphaFeld() const
@@ -2319,7 +2319,7 @@ AlphaFeld *Fenster::getSKAlphaFeld() const // gibt das Schlie
 {
     if( !closeKlickBuffer )
         return 0;
-    return (AlphaFeld *)closeKlickBuffer->getThis();
+    return dynamic_cast<AlphaFeld *>( closeKlickBuffer->getThis() );
 }
 
 AlphaFeld *Fenster::zSKAlphaFeld() const
@@ -2367,7 +2367,7 @@ VScrollBar *Fenster::getVScrollBar() const // gibt die Vertikale Scroll Bar zur
 {
     if( !vScroll )
         return 0;
-    return (VScrollBar *)vScroll->getThis();
+    return dynamic_cast<VScrollBar *>( vScroll->getThis() );
 }
 
 VScrollBar *Fenster::zVScrollBar() const
@@ -2379,7 +2379,7 @@ HScrollBar *Fenster::getHScrollBar() const // gibt die Horizontale Scroll Bar zu
 {
     if( !hScroll )
         return 0;
-    return (HScrollBar *)hScroll->getThis();
+    return dynamic_cast<HScrollBar *>( hScroll->getThis() );
 }
 
 HScrollBar *Fenster::zHScrollBar() const
@@ -2419,7 +2419,7 @@ Zeichnung *Fenster::dublizieren() const // Erzeugt eine Kopie des Fensters
         ret->setTTextFeldZ( (TextFeld *)titel->dublizieren() );
     ret->setKBgFarbe( bgBodyColor );
     if( bgBodyPicture )
-        ret->setKBgBild( (Bild *)bgBodyPicture->getThis() );
+        ret->setKBgBild( dynamic_cast<Bild *>( bgBodyPicture->getThis() ) );
     if( bodyBuffer )
     {
         ret->setKAfFarbe( bodyBuffer->getFarbe() );
@@ -2427,7 +2427,7 @@ Zeichnung *Fenster::dublizieren() const // Erzeugt eine Kopie des Fensters
     }
     ret->setSBgFarbe( bgClosingFarbe );
     if( bgClosingBild )
-        ret->setSBgBild( (Bild *)bgClosingBild->getThis() );
+        ret->setSBgBild( dynamic_cast<Bild *>( bgClosingBild->getThis() ) );
     if( closeBuffer )
     {
         ret->setSAfFarbe( closeBuffer->getFarbe() );

+ 3 - 3
Fortschritt.cpp

@@ -268,7 +268,7 @@ __int64 FBalken::getAktion() const // gibt die fertigen Aktionen zur
 Rahmen *FBalken::getFRahmen() const // gibt den Fertig Rahmen zurück
 {
     if( fRahmen )
-        return (Rahmen *)fRahmen->getThis();
+        return dynamic_cast<Rahmen *>( fRahmen->getThis() );
     return 0;
 }
 
@@ -280,7 +280,7 @@ Rahmen *FBalken::zFRahmen() const
 AlphaFeld *FBalken::getFAlphaFeld() const // gibt das Fertig Alpha Feld zurück
 {
     if( fBuffer )
-        return (AlphaFeld *)fBuffer->getThis();
+        return dynamic_cast<AlphaFeld *>( fBuffer->getThis() );
     return 0;
 }
 
@@ -297,7 +297,7 @@ int FBalken::getFBgFarbe() const // gibt die Fertig Hintergrund Farbe zur
 Bild *FBalken::getFBgBild() const // gibt das Fertig Hintergrund Bild zurück
 {
     if( fBgBild )
-        return (Bild *)fBgBild->getThis();
+        return dynamic_cast<Bild *>( fBgBild->getThis() );
     return 0;
 }
 

+ 1 - 1
InitDatei.cpp

@@ -383,7 +383,7 @@ Text *InitDatei::zName( int num )
 
 Text *InitDatei::getPfad() const
 {
-    return (Text *)pfad->getThis();
+    return dynamic_cast<Text *>( pfad->getThis() );
 }
 
 Text *InitDatei::zPfad() const

+ 6 - 6
JSON.cpp

@@ -113,7 +113,7 @@ JSONArray::JSONArray( Text string )
 JSONArray::JSONArray( const JSONArray &arr )
     : JSONValue( ARRAY )
 {
-    array = ( RCArray<JSONValue>* )arr.array->getThis();
+    array = dynamic_cast<RCArray<JSONValue> *>( arr.array->getThis() );
 }
 
 JSONArray::~JSONArray()
@@ -124,7 +124,7 @@ JSONArray::~JSONArray()
 JSONArray &JSONArray::operator=( const JSONArray &arr )
 {
     array->release();
-    array = ( RCArray<JSONValue>* )arr.array->getThis();
+    array = dynamic_cast<RCArray<JSONValue> *>( arr.array->getThis() );
     return *this;
 }
 
@@ -195,8 +195,8 @@ JSONObject::JSONObject( Text string )
 JSONObject::JSONObject( const JSONObject &obj )
     : JSONValue( OBJECT )
 {
-    fields = ( Array<Text>* )obj.fields->getThis();
-    values = ( RCArray<JSONValue>* )obj.values->getThis();
+    fields = dynamic_cast<Array<Text> *>( obj.fields->getThis() );
+    values = dynamic_cast<RCArray<JSONValue> *>( obj.values->getThis() );
 }
 
 JSONObject::~JSONObject()
@@ -210,8 +210,8 @@ JSONObject &JSONObject::operator=( const JSONObject &obj )
 {
     fields->release();
     values->release();
-    fields = ( Array<Text>* )obj.fields->getThis();
-    values = ( RCArray<JSONValue>* )obj.values->getThis();
+    fields = dynamic_cast<Array<Text> *>( obj.fields->getThis() );
+    values = dynamic_cast<RCArray<JSONValue> *>( obj.values->getThis() );
     return *this;
 }
 

+ 1 - 1
Kam3D.cpp

@@ -356,7 +356,7 @@ const Mat4< float > &Kam3D::getViewMatrix() const
 // Gibt die Welt zurück
 Welt3D *Kam3D::getWelt() const
 {
-    return welt ? (Welt3D *)welt->getThis() : 0;
+    return welt ? dynamic_cast<Welt3D *>( welt->getThis() ) : 0;
 }
 
 // Gibt die Welt zurück

+ 1 - 1
Kamera2D.cpp

@@ -155,7 +155,7 @@ const Mat3< float > &Kamera2D::getMatrix()
 
 Text *Kamera2D::getName()
 {
-    return (Text *)name->getThis();
+    return dynamic_cast<Text *>( name->getThis() );
 }
 
 Text *Kamera2D::zName()

+ 10 - 10
Knopf.cpp

@@ -193,7 +193,7 @@ Bild *Knopf::getKlickBild() const // gibt getThis des Klick Bildes zur
 {
     if( !klickBild )
         return 0;
-    return (Bild *)klickBild->getThis();
+    return dynamic_cast<Bild *>( klickBild->getThis() );
 }
 
 Bild *Knopf::zKlickBild() const // gibt einen Zeiger zum Klick Bild zurück
@@ -205,7 +205,7 @@ AlphaFeld *Knopf::getKB() const // gibt getThis des Klick Buffers zur
 {
     if( !klickBuffer )
         return 0;
-    return (AlphaFeld *)klickBuffer->getThis();
+    return dynamic_cast<AlphaFeld *>( klickBuffer->getThis() );
 }
 
 AlphaFeld *Knopf::zKB() const // gibt den Klick Buffer zurück
@@ -251,7 +251,7 @@ Zeichnung *Knopf::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
     if( rahmen )
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( vertikalScrollBar )
     {
         obj->setVertikalKlickScroll( vertikalScrollBar->getKlickScroll() );
@@ -268,7 +268,7 @@ Zeichnung *Knopf::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
     //obj->setAuswahl( getSelectionPos(), getCursorPos() );
     obj->setKlickFarbe( klickFarbe );
     if( klickBild )
-        obj->setKlickBild( (Bild *)klickBild->getThis() );
+        obj->setKlickBild( dynamic_cast<Bild *>( klickBild->getThis() ) );
     if( klickBuffer )
         obj->setKBZ( (AlphaFeld *)klickBuffer->dublizieren() );
     return obj;
@@ -667,7 +667,7 @@ void KontrollKnopf::render( Bild &zRObj ) // zeichnet nach zRObj
 // constant 
 Text *KontrollKnopf::getText() const // gibt den Text zurück
 {
-    return txt ? (Text *)txt->getThis() : 0;
+    return txt ? dynamic_cast<Text *>( txt->getThis() ) : 0;
 }
 
 Text *KontrollKnopf::zText() const
@@ -677,7 +677,7 @@ Text *KontrollKnopf::zText() const
 
 Text *KontrollKnopf::getSText() const // gibt den Select Text zurück
 {
-    return sTxt ? (Text *)sTxt->getThis() : 0;
+    return sTxt ? dynamic_cast<Text *>( sTxt->getThis() ) : 0;
 }
 
 Text *KontrollKnopf::zSText() const
@@ -717,7 +717,7 @@ int KontrollKnopf::getKBgFarbe() const // gibt die Klick Hintergrundfarbe zur
 
 Bild *KontrollKnopf::getSBgBild() const // gibt das Select Hintergrundbild zurück
 {
-    return sBgB ? (Bild *)sBgB->getThis() : 0;
+    return sBgB ? dynamic_cast<Bild *>( sBgB->getThis() ) : 0;
 }
 
 Bild *KontrollKnopf::zSBgBild() const
@@ -727,7 +727,7 @@ Bild *KontrollKnopf::zSBgBild() const
 
 Bild *KontrollKnopf::getKBgBild() const // gibt das Klick Hintergrundbild zurück
 {
-    return kBgB ? (Bild *)kBgB->getThis() : 0;
+    return kBgB ? dynamic_cast<Bild *>( kBgB->getThis() ) : 0;
 }
 
 Bild *KontrollKnopf::zKBgBild() const
@@ -737,7 +737,7 @@ Bild *KontrollKnopf::zKBgBild() const
 
 AlphaFeld *KontrollKnopf::getSAlphaFeld() const // gibt das Select AlphaFeld zurück
 {
-    return sAf ? (AlphaFeld *)sAf->getThis() : 0;
+    return sAf ? dynamic_cast<AlphaFeld *>( sAf->getThis() ) : 0;
 }
 
 AlphaFeld *KontrollKnopf::zSAlphaFeld() const
@@ -749,7 +749,7 @@ AlphaFeld *KontrollKnopf::getKAlphaFeld() const // gibt das Klick AlphaFeld zur
 {
     if( !kAf )
         return 0;
-    return (AlphaFeld *)kAf->getThis();
+    return dynamic_cast<AlphaFeld *>( kAf->getThis() );
 }
 
 AlphaFeld *KontrollKnopf::zKAlphaFeld() const

+ 14 - 14
Liste.cpp

@@ -155,7 +155,7 @@ void AuswahlListe::update() // aktualisiert die Auswahl Liste
             tf->setStyle( TextFeld::Style::HAlpha, FeldHAlpha );
             tf->setStyle( TextFeld::Style::Buffered, FeldBuffer );
             if( schrift )
-                tf->setSchriftZ( (Schrift *)schrift->getThis() );
+                tf->setSchriftZ( dynamic_cast<Schrift *>( schrift->getThis() ) );
         }
     }
     if( hatStyle( Style::MultiStyled ) && tfListe && styles )
@@ -198,7 +198,7 @@ void AuswahlListe::addEintragZ( TextFeld *tf )
     if( !tfListe )
         tfListe = new RCArray< TextFeld >();
     if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) )
-        tf->setSchriftZ( (Schrift *)schrift->getThis() );
+        tf->setSchriftZ( dynamic_cast<Schrift *>( schrift->getThis() ) );
     tfListe->set( tf, entries );
     ++entries;
     rend = 1;
@@ -229,7 +229,7 @@ void AuswahlListe::addEintragZ( int pos, TextFeld *tf )
     if( !tfListe )
         tfListe = new RCArray< TextFeld >();
     if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) )
-        tf->setSchriftZ( (Schrift *)schrift->getThis() );
+        tf->setSchriftZ( dynamic_cast<Schrift *>( schrift->getThis() ) );
     tfListe->add( tf, pos );
     ++entries;
     rend = 1;
@@ -269,7 +269,7 @@ void AuswahlListe::setEintragZ( int pos, TextFeld *tf )
     if( !tfListe )
         tfListe = new RCArray< TextFeld >();
     if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) )
-        tf->setSchriftZ( (Schrift *)schrift->getThis() );
+        tf->setSchriftZ( dynamic_cast<Schrift *>( schrift->getThis() ) );
     tfListe->set( tf, pos );
     rend = 1;
 }
@@ -641,7 +641,7 @@ void AuswahlListe::render( Bild &zRObj ) // zeichnet nach zRObj
                     if( hatStyle( Style::AuswahlBuffer ) && aBuffer )
                     {
                         tmpBuffer = tf->getAlphaFeld();
-                        tf->setAlphaFeldZ( (AlphaFeld *)aBuffer->getThis() );
+                        tf->setAlphaFeldZ( dynamic_cast<AlphaFeld *>( aBuffer->getThis() ) );
                         tmpB = tf->hatStyle( TextFeld::Style::Buffered );
                         tf->setStyle( TextFeld::Style::Buffered, hatStyle( Style::AuswahlBuffer ) );
                     }
@@ -654,7 +654,7 @@ void AuswahlListe::render( Bild &zRObj ) // zeichnet nach zRObj
                         if( hatStyle( Style::AuswahlHBild ) && ahBild )
                         {
                             tmpHBild = tf->getHintergrundBild();
-                            tf->setHintergrundBildZ( (Bild *)ahBild->getThis() );
+                            tf->setHintergrundBildZ( dynamic_cast<Bild *>( ahBild->getThis() ) );
                             tmpHB = tf->hatStyle( TextFeld::Style::HBild );
                             tf->setStyle( TextFeld::Style::HBild, hatStyle( Style::HBild ) );
                         }
@@ -667,7 +667,7 @@ void AuswahlListe::render( Bild &zRObj ) // zeichnet nach zRObj
                     if( hatStyle( Style::AuswahlRahmen ) && aRahmen )
                     {
                         tmpRahmen = tf->getRahmen();
-                        tf->setRahmenZ( (Rahmen *)aRahmen->getThis() );
+                        tf->setRahmenZ( dynamic_cast<Rahmen *>( aRahmen->getThis() ) );
                         tmpR = tf->hatStyle( TextFeld::Style::Rahmen );
                         tf->setStyle( TextFeld::Style::Rahmen, hatStyle( Style::AuswahlRahmen ) );
                     }
@@ -848,7 +848,7 @@ TextFeld *AuswahlListe::getEintrag( int pos ) const // gibt den pos- ten Eintrag
         return 0;
     TextFeld *ret = (TextFeld *)tfListe->get( pos );
     if( ret )
-        return (TextFeld *)ret->getThis();
+        return dynamic_cast<TextFeld *>( ret->getThis() );
     return 0;
 }
 
@@ -862,7 +862,7 @@ TextFeld *AuswahlListe::zEintrag( int pos ) const
 Rahmen *AuswahlListe::getARahmen() const // gibt den Auswahl Rahmen zurück (ohne MultiStyled)
 {
     if( aRahmen )
-        return (Rahmen *)aRahmen->getThis();
+        return dynamic_cast<Rahmen *>( aRahmen->getThis() );
     return 0;
 }
 
@@ -879,7 +879,7 @@ int AuswahlListe::getAHFarbe() const // gibt die Auswahl Hintergrund Farbe zur
 Bild *AuswahlListe::getAHBild() const // gibt das Auswahl Hintergrund Bild zurück (ohne MultiStyled)
 {
     if( ahBild )
-        return (Bild *)ahBild->getThis();
+        return dynamic_cast<Bild *>( ahBild->getThis() );
     return 0;
 }
 
@@ -891,7 +891,7 @@ Bild *AuswahlListe::zAHBild() const
 AlphaFeld *AuswahlListe::getABuffer() const // gibt den Auswahl Buffer zurück (ohne MultiStyled)
 {
     if( aBuffer )
-        return (AlphaFeld *)aBuffer->getThis();
+        return dynamic_cast<AlphaFeld *>( aBuffer->getThis() );
     return 0;
 }
 
@@ -906,7 +906,7 @@ Rahmen *AuswahlListe::getARahmen( int pos ) const // gibt den Auswahl Rahmen zur
     if( aRahmenListe )
         ret = (Rahmen *)aRahmenListe->get( pos );
     if( ret )
-        return (Rahmen *)ret->getThis();
+        return dynamic_cast<Rahmen *>( ret->getThis() );
     return 0;
 }
 
@@ -931,7 +931,7 @@ Bild *AuswahlListe::getAHBild( int pos ) const // gibt das Auswahl Hintergrund B
     if( ahBildListe )
         ret = (Bild *)ahBildListe->get( pos );
     if( ret )
-        return (Bild *)ret->getThis();
+        return dynamic_cast<Bild *>( ret->getThis() );
     return 0;
 }
 
@@ -949,7 +949,7 @@ AlphaFeld *AuswahlListe::getABuffer( int pos ) const // gibt den Auswahl Buffer
     if( aBufferListe )
         ret = (AlphaFeld *)aBufferListe->get( pos );
     if( ret )
-        return (AlphaFeld *)ret->getThis();
+        return dynamic_cast<AlphaFeld *>( ret->getThis() );
     return 0;
 }
 

+ 4 - 4
M2DVorschau.cpp

@@ -80,7 +80,7 @@ void M2DVorschau::doMausEreignis( MausEreignis &me, bool userRet )
 }
 
 // nicht constant
-void M2DVorschau::setModel2DZ( Model2D * mdl )
+void M2DVorschau::setModel2DZ( Model2D *mdl )
 {
     if( this->mdl )
         this->mdl->release();
@@ -88,7 +88,7 @@ void M2DVorschau::setModel2DZ( Model2D * mdl )
     rend = 1;
 }
 
-void M2DVorschau::setModel2D( Model2DData * mdl )
+void M2DVorschau::setModel2D( Model2DData *mdl )
 {
     if( !this->mdl )
         this->mdl = new Model2D();
@@ -104,7 +104,7 @@ bool M2DVorschau::tick( double tv )
     return ZeichnungHintergrund::tick( tv );
 }
 
-void M2DVorschau::render( Bild & rb )
+void M2DVorschau::render( Bild &rb )
 {
     removeStyle( Style::VScroll | Style::HScroll );
     if( hatStyleNicht( Style::Sichtbar ) )
@@ -129,7 +129,7 @@ Model2D *M2DVorschau::zModel() const
 
 Model2D *M2DVorschau::getModel() const
 {
-    return mdl ? (Model2D *)mdl->getThis() : 0;
+    return mdl ? dynamic_cast<Model2D *>( mdl->getThis() ) : 0;
 }
 
 Zeichnung *M2DVorschau::dublizieren() const

+ 6 - 6
Model2D.cpp

@@ -701,7 +701,7 @@ void Model2DObject::setTextur( Textur2D *t )
     if( rData )
     {
         for( auto i = rData->polygons->getIterator(); i; i++ )
-            textur->set( (Textur2D *)t->getThis(), index++ );
+            textur->set( dynamic_cast<Textur2D *>( t->getThis() ), index++ );
     }
     t->release();
 }
@@ -748,7 +748,7 @@ void Model2DObject::setTextur( Textur2D *t, const char *polygonName )
     for( auto i = rData->polygons->getIterator(); i; i++, index++ )
     {
         if( i._.name->istGleich( polygonName ) )
-            textur->set( (Textur2D *)t->getThis(), index );
+            textur->set( dynamic_cast<Textur2D *>( t->getThis() ), index );
     }
     t->release();
 }
@@ -1022,7 +1022,7 @@ Textur2D *Model2DObject::zTextur( const char *polygonName ) const
 
 Model2DData *Model2DObject::getModel() const
 {
-    return rData ? (Model2DData *)rData->getThis() : 0;
+    return rData ? dynamic_cast<Model2DData *>( rData->getThis() ) : 0;
 }
 
 Model2DData *Model2DObject::zModel() const
@@ -1099,7 +1099,7 @@ void Model2D::setTextur( Textur2D *t )
     if( rData )
     {
         for( auto i = rData->polygons->getIterator(); i; i++ )
-            textur->set( (Textur2D *)t->getThis(), index++ );
+            textur->set( dynamic_cast<Textur2D *>( t->getThis() ), index++ );
     }
     t->release();
 }
@@ -1110,7 +1110,7 @@ void Model2D::setTextur( Textur2D *t, const char *polygonName )
     for( auto i = rData->polygons->getIterator(); i; i++, index++ )
     {
         if( i._.name->istGleich( polygonName ) )
-            textur->set( (Textur2D *)t->getThis(), index );
+            textur->set( dynamic_cast<Textur2D *>( t->getThis() ), index );
     }
     t->release();
 }
@@ -1347,7 +1347,7 @@ bool Model2D::istModelInnen( const Model2D *zMdl, bool end ) const
 
 Model2DData *Model2D::getModel() const
 {
-    return rData ? (Model2DData *)rData->getThis() : 0;
+    return rData ? dynamic_cast<Model2DData *>( rData->getThis() ) : 0;
 }
 
 Model2DData *Model2D::zModel() const

+ 2 - 2
Model3D.cpp

@@ -692,7 +692,7 @@ bool Model3D::tick( double tickval )
 // Gibt die Textur zurück
 Model3DTextur *Model3D::getTextur()
 {
-    return textur ? (Model3DTextur *)textur->getThis() : 0;
+    return textur ? dynamic_cast<Model3DTextur *>( textur->getThis() ) : 0;
 }
 
 // Gibt die Textur zurück (ohne erhöhten Reference Counter)
@@ -704,7 +704,7 @@ Model3DTextur *Model3D::zTextur()
 // Gibt die ModelDaten zurück
 Model3DData *Model3D::getModelData()
 {
-    return model ? (Model3DData *)model->getThis() : 0;
+    return model ? dynamic_cast<Model3DData *>( model->getThis() ) : 0;
 }
 
 // Gibt die ModelDaten zurück (ohne erhöhten Reference Counter)

+ 1 - 1
ReferenceCounter.cpp

@@ -16,7 +16,7 @@ ReferenceCounter *ReferenceCounter::getThis()
     return this;
 }
 
-ReferenceCounter *ReferenceCounter::release()
+void *ReferenceCounter::release()
 {
     if( !--ref )
         delete this;

+ 1 - 7
ReferenceCounter.h

@@ -14,12 +14,6 @@ namespace Framework
         DLLEXPORT virtual ~ReferenceCounter();
 
         DLLEXPORT ReferenceCounter *getThis();
-        DLLEXPORT ReferenceCounter *release();
-
-        template<typename T>
-        inline T *as() const
-        {
-            return dynamic_cast<T>( this )
-        }
+        DLLEXPORT void *release();
     };
 }

+ 1 - 1
RenderThread.cpp

@@ -140,7 +140,7 @@ void RenderTh::setTickFunktionParameter( void *p ) // setzt den Parameter der R
 // constant
 Bildschirm *RenderTh::getBildschirm() const // gibt den Bildschirm zurück
 {
-    return bildschirm ? (Bildschirm *)bildschirm->getThis() : 0;
+    return bildschirm ? dynamic_cast<Bildschirm *>( bildschirm->getThis() ) : 0;
 }
 
 Bildschirm *RenderTh::zBildschirm() const

+ 5 - 5
Schrift.cpp

@@ -142,7 +142,7 @@ void Alphabet::setSchriftSize( int gr ) // setzt die Schriftgr
 Buchstabe *Alphabet::getBuchstabe( unsigned char i ) const // gibt einen Buchstaben zurück
 {
     if( zeichen[ i ] )
-        return (Buchstabe *)zeichen[ i ]->getThis();
+        return dynamic_cast<Buchstabe *>( zeichen[ i ]->getThis() );
     return 0;
 }
 
@@ -228,7 +228,7 @@ Alphabet *AlphabetArray::getAlphabet( unsigned char sg ) const // gibt getThis v
     if( !This )
         return 0;
     if( This->getSchriftSize() == sg )
-        return (Alphabet *)This->getThis();
+        return dynamic_cast<Alphabet *>( This->getThis() );
     if( next )
         return next->getAlphabet( sg );
     return 0;
@@ -248,7 +248,7 @@ Alphabet *AlphabetArray::zAlphabet( unsigned char sg ) const // gibt ein Alphabe
 Alphabet *AlphabetArray::getAlphabetI( int index, int count ) const
 {
     if( count == index )
-        return (Alphabet *)This->getThis();
+        return dynamic_cast<Alphabet *>( This->getThis() );
     if( next )
         return next->getAlphabetI( index, count + 1 );
     return 0;
@@ -314,7 +314,7 @@ Alphabet *Schrift::getAlphabet( int sg ) const
                 break;
         }
     }
-    return (Alphabet *)drawAlphabet->getThis();
+    return dynamic_cast<Alphabet *>( drawAlphabet->getThis() );
 }
 
 Alphabet *Schrift::zAlphabet( int sg ) const
@@ -381,7 +381,7 @@ void TextRenderer::setSchriftZ( Schrift *schrift )
 Schrift *TextRenderer::getSchrift()
 {
     if( s )
-        return (Schrift *)s->getThis();
+        return dynamic_cast<Schrift *>( s->getThis() );
     return 0;
 }
 

+ 3 - 3
Tabelle.cpp

@@ -1437,7 +1437,7 @@ int ObjTabelle::getRasterBreite() const // gibt die Breite des Rasters zur
 
 Rahmen *ObjTabelle::getARahmen() const // gibt den auswahl Rahmen zurück
 {
-    return aRam ? (Rahmen *)aRam->getThis() : 0;
+    return aRam ? dynamic_cast<Rahmen *>( aRam->getThis() ) : 0;
 }
 
 Rahmen *ObjTabelle::zARahmen() const
@@ -1447,7 +1447,7 @@ Rahmen *ObjTabelle::zARahmen() const
 
 AlphaFeld *ObjTabelle::getAAlphaFeld() const // gibt das auswahl AlphaFeld zurück
 {
-    return aAf ? (AlphaFeld *)aAf->getThis() : 0;
+    return aAf ? dynamic_cast<AlphaFeld *>( aAf->getThis() ) : 0;
 }
 
 AlphaFeld *ObjTabelle::zAAlphaFeld() const
@@ -1566,7 +1566,7 @@ Zeichnung *ObjTabelle::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     obj->setHintergrundFarbe( hintergrundFarbe );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( hintergrundFeld )
         obj->setAlphaFeldZ( (AlphaFeld *)hintergrundFeld->dublizieren() );
     obj->setRasterFarbe( rasterFarbe );

+ 4 - 4
TextFeld.cpp

@@ -1482,7 +1482,7 @@ Text *TextFeld::getText() const // gibt vom Text zur
 {
     if( !tm->text )
         return 0;
-    return (Text *)tm->text->getThis();
+    return dynamic_cast<Text *>( tm->text->getThis() );
 }
 
 Text *TextFeld::zText() const // gibt den Text zurück
@@ -1525,7 +1525,7 @@ Schrift *TextFeld::zSchrift( int rendererIndex ) const
 TextRenderer *TextFeld::getTextRenderer() const
 {
     tm->resetIteration();
-    return (TextRenderer *)tm->zCurrentRenderer()->getThis();
+    return dynamic_cast<TextRenderer *>( tm->zCurrentRenderer()->getThis() );
 }
 
 TextRenderer *TextFeld::zTextRenderer() const
@@ -1717,7 +1717,7 @@ Zeichnung *TextFeld::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
         obj->setToolTipZ( (ToolTip *)toolTip->dublizieren() );
     obj->setStyle( style );
     obj->tm->renderer->release();
-    obj->tm->renderer = ( RCArray<TextRenderer> * )tm->renderer->getThis();
+    obj->tm->renderer = dynamic_cast<RCArray<TextRenderer> *>( tm->renderer->getThis() );
     obj->tm->textStyle.leeren();
     for( auto i = tm->textStyle.getIterator(); i; i++ )
         obj->tm->textStyle.add( i._ );
@@ -1732,7 +1732,7 @@ Zeichnung *TextFeld::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
     if( rahmen )
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( vertikalScrollBar )
     {
         obj->setVertikalKlickScroll( vertikalScrollBar->getKlickScroll() );

+ 1 - 1
Textur.cpp

@@ -55,7 +55,7 @@ void Textur::setBild( Bild *b )
 // Gibt einen Zeiger auf das Bild zurück
 Bild *Textur::getBild() const
 {
-    return bild ? (Bild *)bild->getThis() : 0;
+    return bild ? dynamic_cast<Bild *>( bild->getThis() ) : 0;
 }
 
 // Gibt einen Zeiger auf das Bild ohne erhöhten Reference Counter zurück

+ 1 - 1
TexturList.cpp

@@ -121,7 +121,7 @@ Textur *TexturList::getTextur( int id ) const
         if( i->getId() == id )
         {
             cs.unlock();
-            return (Textur *)i->getThis();
+            return dynamic_cast<Textur *>( i->getThis() );
         }
     }
     cs.unlock();

+ 2 - 2
ToolTip.cpp

@@ -30,7 +30,7 @@ ToolTip::ToolTip( Bildschirm *zScreen )
 {
     style = Style::MEIgnoreInside | Style::MEIgnoreParentInside | Style::MEIgnoreSichtbar | Style::MEIgnoreVerarbeitet | Style::Erlaubt;
     members = new RCArray< Zeichnung >();
-    bildschirm->addToolTip( (ToolTip *)this->getThis() );
+    bildschirm->addToolTip( dynamic_cast<ToolTip *>( this->getThis() ) );
     setMausEreignis( _ret1ME );
 }
 
@@ -321,6 +321,6 @@ Zeichnung *ToolTip::dublizieren() const
     ret->zeichnen = zeichnen;
     ret->mausIn2 = mausIn2;
     for( auto z = members->getIterator(); z; z++ )
-        ret->addMember( (Zeichnung *)z->getThis() );
+        ret->addMember( dynamic_cast<Zeichnung *>( z->getThis() ) );
     return ret;
 }

+ 1 - 1
UIDialog.cpp

@@ -88,7 +88,7 @@ UIMessageDialog::UIMessageDialog( const char *titel, const char *message, Schrif
     msg->setStyle( TextFeld::Style::Text );
     msg->setText( message );
     msg->setPosition( 5, 5 );
-    TextRenderer tr( (Schrift *)schrift->getThis() );
+    TextRenderer tr( dynamic_cast<Schrift *>( schrift->getThis() ) );
     tr.textFormatieren( msg->zText(), 590 );
     int br = tr.getTextBreite( message );
     int hö = tr.getTextHeight( message );

+ 8 - 8
UIInitialization.cpp

@@ -24,7 +24,7 @@ AuswahlBox *createAuswahlBox( UIInitParam &p )
     ret->setHintergrundFarbe( 0xFF000000 );
     ret->setMausEreignis( _ret1ME );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setRahmenBreite( 1 );
     ret->setRahmenFarbe( 0xFFFFFFFF );
     ret->setMaxAuskappHeight( 100 );
@@ -44,7 +44,7 @@ AuswahlListe *createAuswahlListe( UIInitParam &p )
     AuswahlListe *ret = new AuswahlListe();
     ret->setStyle( AuswahlListe::Style::Normal );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setAlphaFeldFarbe( 0x5500FF00 );
     ret->setAlphaFeldStrength( -5 );
     ret->setRahmenBreite( 1 );
@@ -73,7 +73,7 @@ FBalken *createFBalken( UIInitParam &p )
     FBalken *ret = new FBalken();
     ret->setStyle( FBalken::Style::normal );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setSFarbe( 0xFFFFFFFF );
     ret->setSSize( 12 );
     ret->setRahmenFarbe( 0xFFFFFFFF );
@@ -109,7 +109,7 @@ Fenster *createFenster( UIInitParam &p )
     ret->setRFarbe( 0xFFFFFFFF );
     ret->setTitel( "" );
     if( p.schrift )
-        ret->setTSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setTSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setTSFarbe( 0xFFFFFFFF );
     ret->zTTextFeld()->setSize( 0, 20 );
     ret->zTTextFeld()->addStyle( TextFeld::Style::Sichtbar | TextFeld::Style::Center | TextFeld::Style::Rahmen );
@@ -126,7 +126,7 @@ Knopf *createKnopf( UIInitParam &p )
 {
     Knopf *ret = new Knopf();
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setStyle( Knopf::Style::Normal );
     return ret;
 }
@@ -137,7 +137,7 @@ KontrollKnopf *createKontrollKnopf( UIInitParam &p )
     ret->setMausEreignis( _ret1ME );
     ret->setStyle( KontrollKnopf::Style::Normal );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setSFarbe( 0xFFFFFFFF );
     ret->setSSize( 12 );
     ret->setAlphaFeldFarbe( 0x5500FF00 );
@@ -155,7 +155,7 @@ LDiag *createLDiag( UIInitParam &p )
     LDiag *ret = new LDiag();
     ret->setStyle( LDiag::Style::normal );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setRahmenBreite( 1 );
     ret->setRahmenFarbe( 0xFFFFFFFF );
     ret->setDatenRahmenBreite( 1 );
@@ -191,7 +191,7 @@ TextFeld *createTextFeld( UIInitParam &p )
     TextFeld *ret = new TextFeld();
     ret->setStyle( TextFeld::Style::Text );
     if( p.schrift )
-        ret->setSchriftZ( (Schrift *)p.schrift->getThis() );
+        ret->setSchriftZ( dynamic_cast<Schrift *>( p.schrift->getThis() ) );
     ret->setSchriftFarbe( 0xFFFFFFFF );
     ret->setSchriftSize( 12 );
     ret->setAlphaFeldFarbe( 0x5500FF00 );

+ 4 - 4
UIMLView.cpp

@@ -120,7 +120,7 @@ void UIMLView::parseTable( Iterator<XML::Element *> childs, ObjTabelle *table )
                 if( table->getSpaltenAnzahl() < c )
                     table->addSpalte( Text( c - 1 ) );
                 if( z )
-                    table->setZeichnungZ( (char *)Text( c - 1 ), (char *)line, z->getThis()->as<Zeichnung>() );
+                    table->setZeichnungZ( (char *)Text( c - 1 ), (char *)line, dynamic_cast<Zeichnung *>( z->getThis() ) );
                 c++;
             }
         }
@@ -133,7 +133,7 @@ void UIMLView::parseFrame( Iterator<XML::Element *> childs, Fenster *frame )
     {
         Zeichnung *z = parseElement( i._ );
         if( z )
-            frame->addMember( z->getThis()->as<Zeichnung>() );
+            frame->addMember( dynamic_cast<Zeichnung *>( z->getThis() ) );
     }
 }
 
@@ -537,7 +537,7 @@ Text UIMLView::addMember( Text uiml, Text parentId )
                 Zeichnung *z = parseElement( e );
                 if( z )
                 {
-                    ( (Fenster *)members->z( parentId ) )->addMember( z->getThis()->as<Zeichnung>() );
+                    dynamic_cast<Fenster *>( members->z( parentId ) )->addMember( dynamic_cast<Zeichnung *>( z->getThis() ) );
                     ed2.getIterator()->addChild( e );
                 }
                 return e->getAttributeValue( "id" );
@@ -626,5 +626,5 @@ XML::Element *UIMLView::zDom() const
 // Änderungen am Dom Tree sollten vermieden werden (nur änderungen von attributen einzelner elemente sind erlaubt)
 XML::Element *UIMLView::getDom() const
 {
-    return dom ? dom->getThis()->as<XML::Element>() : 0;
+    return dom ? dynamic_cast<XML::Element *>( dom->getThis() ) : 0;
 }

+ 1 - 1
Welt2D.cpp

@@ -301,7 +301,7 @@ Object2D *Welt2D::zObjectAt( int x, int y, bool ignoreTransparentFlag )
 Object2D *Welt2D::getObjectAt( int x, int y, bool ignoreTransparentFlag )
 {
     Object2D *tmp = zObjectAt( x, y, ignoreTransparentFlag );
-    return tmp ? (Object2D *)tmp->getThis() : 0;
+    return tmp ? dynamic_cast<Object2D *>( tmp->getThis() ) : 0;
 }
 
 void Welt2D::addObject( Object2D *obj )

+ 20 - 20
XML.cpp

@@ -306,7 +306,7 @@ void Element::removeAllChilds()
 void Element::removeChilds( RCArray<Element> *childs )
 {
     for( auto i = childs->getIterator(); i; i++ )
-        removeChild( (XML::Element *)i->getThis() );
+        removeChild( dynamic_cast<XML::Element *>( i->getThis() ) );
     childs->release();
 }
 
@@ -314,7 +314,7 @@ void Element::removeChilds( RCArray<Element> *childs )
 void Element::remove()
 {
     if( parent )
-        parent->removeChild( (XML::Element *)getThis() );
+        parent->removeChild( dynamic_cast<XML::Element *>( getThis() ) );
 }
 
 // setzt den Text in dem Element falls es keine childs gibt
@@ -351,7 +351,7 @@ Element *Element::zChild( int i ) const
 // gibt das parent element zurück
 Element *Element::getParent() const
 {
-    return parent ? (Element *)parent->getThis() : 0;
+    return parent ? dynamic_cast<Element *>( parent->getThis() ) : 0;
 }
 
 // gibt das parent element zurück (ohne erhöhten reference Counter)
@@ -369,7 +369,7 @@ Iterator< Element * > Element::getChilds() const
 // gibt einen selector zurück der alle childs beinhaltet
 Editor Element::selectChildren() const
 {
-    return Editor( ( RCArray<XML::Element> * )children->getThis() );
+    return Editor( dynamic_cast<RCArray<XML::Element> *>( children->getThis() ) );
 }
 
 // gibt eine Liste mit childs zurück, die einen bestimmten Namen haben
@@ -380,7 +380,7 @@ Editor Element::selectChildsByName( Text name ) const
     for( auto i = children->getIterator(); i; i++ )
     {
         if( i->getName().istGleich( name ) )
-            tmp->add( (XML::Element *)i->getThis() );
+            tmp->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( tmp );
 }
@@ -393,7 +393,7 @@ Editor Element::selectChildsByAttribute( Text attribute ) const
     for( auto i = children->getIterator(); i; i++ )
     {
         if( i->hasAttribute( attribute ) )
-            tmp->add( (XML::Element *)i->getThis() );
+            tmp->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( tmp );
 }
@@ -407,7 +407,7 @@ Editor Element::selectChildsByAttribute( Text attribute, Text value ) const
     for( auto i = children->getIterator(); i; i++ )
     {
         if( i->hasAttribute( attribute ) && i->getAttributeValue( attribute ).istGleich( value ) )
-            tmp->add( (XML::Element *)i->getThis() );
+            tmp->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( tmp );
 }
@@ -535,12 +535,12 @@ Editor::Editor( RCArray< Element > *elements )
 {
     this->elements = new RCArray< Element >();
     for( auto i = elements->getIterator(); i; i++ )
-        this->elements->add( (XML::Element *)i->getThis() );
+        this->elements->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     elements->release();
 }
 
 Editor::Editor( const Editor &e )
-    : Editor( ( RCArray<XML::Element> * )e.elements->getThis() )
+    : Editor( dynamic_cast<RCArray<XML::Element> *>( e.elements->getThis() ) )
 {}
 
 Editor::~Editor()
@@ -579,7 +579,7 @@ void Editor::addChild( Element *child )
 void Editor::removeChild( Element *child )
 {
     for( auto i = elements->getIterator(); i; i++ )
-        i->removeChild( (XML::Element *)child->getThis() );
+        i->removeChild( dynamic_cast<XML::Element *>( child->getThis() ) );
     child->release();
 }
 
@@ -603,7 +603,7 @@ void Editor::removeAllChilds()
 void Editor::removeChilds( RCArray<Element> *childs )
 {
     for( auto i = elements->getIterator(); i; i++ )
-        i->removeChilds( ( RCArray<XML::Element> * )childs->getThis() );
+        i->removeChilds( dynamic_cast<RCArray<XML::Element> *>( childs->getThis() ) );
     childs->release();
 }
 
@@ -636,7 +636,7 @@ Editor Editor::selectChildren() const
     {
         for( auto j = i->selectChildren().getIterator(); j; j++ )
         {
-            list->add( (XML::Element *)j->getThis() );
+            list->add( dynamic_cast<XML::Element *>( j->getThis() ) );
         }
     }
     return Editor( list );
@@ -649,7 +649,7 @@ Editor Editor::selectParents() const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->parent )
-            list->add( (XML::Element *)i->parent->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->parent->getThis() ) );
     }
     return Editor( list );
 }
@@ -662,7 +662,7 @@ Editor Editor::whereNameEquals( Text name ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->getName().istGleich( name ) )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -675,7 +675,7 @@ Editor Editor::whereChildWithNameExists( Text name ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->selectChildsByName( name ).elements->getEintragAnzahl() )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -688,7 +688,7 @@ Editor Editor::whereChildWithAttributeExists( Text attribute ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->selectChildsByAttribute( attribute ).elements->getEintragAnzahl() )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -702,7 +702,7 @@ Editor Editor::whereChildWithAttributeExists( Text attribute, Text value ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->selectChildsByAttribute( attribute, value ).elements->getEintragAnzahl() )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -715,7 +715,7 @@ Editor Editor::whereAttributeExists( Text attribute ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->hasAttribute( attribute ) )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -729,7 +729,7 @@ Editor Editor::whereAttributeEquals( Text attribute, Text value ) const
     for( auto i = elements->getIterator(); i; i++ )
     {
         if( i->hasAttribute( attribute ) && i->getAttributeValue( attribute ).istGleich( value ) )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }
@@ -745,7 +745,7 @@ Editor Editor::without( Editor e ) const
         for( auto j = e.elements->getIterator(); j; j++ )
             found |= i._ == j._;
         if( !found )
-            list->add( (XML::Element *)i->getThis() );
+            list->add( dynamic_cast<XML::Element *>( i->getThis() ) );
     }
     return Editor( list );
 }

+ 5 - 5
Zeichnung.cpp

@@ -419,7 +419,7 @@ bool Zeichnung::istPunktInnen( int x, int y ) const
 
 ToolTip *Zeichnung::getToolTip() const // gibt den ToolTip Text
 {
-    return (ToolTip *)toolTip->getThis();
+    return dynamic_cast<ToolTip *>( toolTip->getThis() );
 }
 
 ToolTip *Zeichnung::zToolTip() const
@@ -807,7 +807,7 @@ Bild *ZeichnungHintergrund::getHintergrundBild() const // gibt getThis vom Hinte
 {
     if( !hintergrundBild )
         return 0;
-    return (Bild *)hintergrundBild->getThis();
+    return dynamic_cast<Bild *>( hintergrundBild->getThis() );
 }
 
 Bild *ZeichnungHintergrund::zHintergrundBild() const // gibt das Hintergrund Bild zurück
@@ -824,7 +824,7 @@ AlphaFeld *ZeichnungHintergrund::getAlphaFeld() const // gibt getThir vom Hinter
 {
     if( !hintergrundFeld )
         return 0;
-    return (AlphaFeld *)hintergrundFeld->getThis();
+    return dynamic_cast<AlphaFeld *>( hintergrundFeld->getThis() );
 }
 
 AlphaFeld *ZeichnungHintergrund::zAlphaFeld() const // gibt den Hintergrund Buffer zurück
@@ -848,7 +848,7 @@ Rahmen *ZeichnungHintergrund::getRahmen() const // gibt getThis des Rahmens zur
 {
     if( !rahmen )
         return 0;
-    return (Rahmen *)rahmen->getThis();
+    return dynamic_cast<Rahmen *>( rahmen->getThis() );
 }
 
 Rahmen *ZeichnungHintergrund::zRahmen() const // gibt den Rahmen zurück
@@ -926,7 +926,7 @@ Zeichnung *ZeichnungHintergrund::dublizieren() const // Erzeugt eine Kopie des Z
     if( rahmen )
         obj->setRahmenZ( (Rahmen *)rahmen->dublizieren() );
     if( hintergrundBild )
-        obj->setHintergrundBild( (Bild *)hintergrundBild->getThis() );
+        obj->setHintergrundBild( dynamic_cast<Bild *>( hintergrundBild->getThis() ) );
     if( vertikalScrollBar )
     {
         obj->setVertikalKlickScroll( vertikalScrollBar->getKlickScroll() );

+ 2 - 2
Zeit.cpp

@@ -1557,7 +1557,7 @@ bool Zeit::istGleich( int jahr, int monat, int tag, int stunde, int minute, int
 
 Datum *Zeit::getDatum() const // gibt das Datum zurück
 {
-    return (Datum *)datum->getThis();
+    return dynamic_cast<Datum *>( datum->getThis() );
 }
 
 Datum *Zeit::zDatum() const
@@ -1567,7 +1567,7 @@ Datum *Zeit::zDatum() const
 
 Uhrzeit *Zeit::getUhrzeit() const // gibt die Uhrzeit zurück
 {
-    return (Uhrzeit *)uhrzeit->getThis();
+    return dynamic_cast<Uhrzeit *>( uhrzeit->getThis() );
 }
 
 Uhrzeit *Zeit::zUhrzeit() const