Kaynağa Gözat

made chunk loading up to 100 times faster

Kolja Strohm 2 yıl önce
ebeveyn
işleme
a776abf087

+ 16 - 5
FactoryCraft/Chunk.cpp

@@ -209,6 +209,10 @@ void Chunk::removeBlock(Block* zBlock)
 
 void Chunk::load(Framework::StreamReader* zReader)
 {
+    cs.lock();
+    blocks.leeren();
+    cs.unlock();
+    Trie<Block> blockCache;
     isLoading = 1;
     Framework::Vec3<int> pos = {0, 0, 0};
     unsigned short id;
@@ -221,10 +225,16 @@ void Chunk::load(Framework::StreamReader* zReader)
             (index / WORLD_HEIGHT) % CHUNK_SIZE,
             index % WORLD_HEIGHT);
         if (blockTypes[id]->doesNeedInstance())
-            setBlock(blockTypes[id]->createBlock(
+        {
+            cs.lock();
+            Block* b = blockTypes[id]->createBlock(
                 {pos.x + location.x - CHUNK_SIZE / 2,
                     pos.y + location.y - CHUNK_SIZE / 2,
-                    pos.z}));
+                    pos.z});
+            blocks.add(b);
+            blockCache.set((char*)&index, 4, dynamic_cast<Block*>(b->getThis()));
+            cs.unlock();
+        }
         zReader->lese((char*)&id, 2);
     }
     int index = 0;
@@ -246,9 +256,10 @@ void Chunk::load(Framework::StreamReader* zReader)
                 if (pos.x >= 0 && pos.x < CHUNK_SIZE && pos.y >= 0
                     && pos.y < CHUNK_SIZE)
                 {
-                    pos.x += this->location.x - CHUNK_SIZE / 2;
-                    pos.y += this->location.y - CHUNK_SIZE / 2;
-                    Block* zB = zBlockAt(pos);
+                    int cacheIndex
+                        = (pos.x * CHUNK_SIZE + pos.y) * WORLD_HEIGHT + pos.z;
+                    Block* zB
+                        = blockCache.z((char*)&cacheIndex, 4);
                     if (zB)
                     {
                         bool visible = zB->isVisible();

+ 18 - 18
FactoryCraft/CustomUIDX11PixelShader.h

@@ -250,10 +250,10 @@ ret
 
 const BYTE CustomUIDX11PixelShader[] =
 {
-     68,  88,  66,  67,  14, 129, 
-     82, 192,  31, 107,  63,  58, 
-     83, 209,   1, 215,  26, 184, 
-    172, 191,   1,   0,   0,   0, 
+     68,  88,  66,  67, 214, 145, 
+    154, 210,  38, 196, 191,  97, 
+    218,  25, 137, 117, 115, 170, 
+    212, 151,   1,   0,   0,   0, 
      48, 118,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
     252,   4,   0,   0, 164,   5, 
@@ -1368,10 +1368,10 @@ const BYTE CustomUIDX11PixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    197,  38, 192,  98,   1,   0, 
-      0,   0,  28, 184,  22, 166, 
-    217, 216, 130,  74, 156,  59, 
-     64,  20, 107, 127, 235, 200, 
+     44, 192,   0,  99,   1,   0, 
+      0,   0, 228, 128,   6,  78, 
+    190, 123,  29,  72, 141,  39, 
+    197, 137,  62, 118, 154,  11, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1543,9 +1543,9 @@ const BYTE CustomUIDX11PixelShader[] =
     194,  82,   1,   0,  43, 236, 
       3,   0,  28,  19,   2,   0, 
      65,  36,   1,   0, 236, 179, 
-      1,   0,  56,  40,   0,   0, 
+      1,   0, 240,   5,   0,   0, 
     125,  10,   2,   0, 125, 181, 
-      2,   0,  69,  40,   2,   0, 
+      2,   0, 185,  43,   2,   0, 
     193,  33,   3,   0,  65, 185, 
       2,   0, 146, 230,   3,   0, 
      53, 174,   3,   0, 118,  19, 
@@ -2478,7 +2478,7 @@ const BYTE CustomUIDX11PixelShader[] =
      32,  32,  32,  32,  32,  32, 
      32,  32,  32,  32,  27, 226, 
      48,   1, 128,   0,   0,   0, 
-     70, 159, 108, 209,   3, 142, 
+     35,  14, 126, 224, 132, 180, 
     216,   1,   1,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -3467,14 +3467,14 @@ const BYTE CustomUIDX11PixelShader[] =
       6,  16,   0,   0,  23,   0, 
       1,   0,   5,  16,   0,   0, 
      14,   0,  23,  21,   0,  16, 
-      0,   0,   3,   2,   0, 248, 
+      0,   0,   3,   2,  32,   1, 
       0,   0, 242, 241,  10,   0, 
      24,  21,   8,  16,   0,   0, 
       1,   0,   1,   0,  10,   0, 
      24,  21,   9,  16,   0,   0, 
       1,   0,   0,   2,  14,   0, 
      23,  21,   0,   0,   0,   0, 
-     10,   2,   0, 248,   0,   0, 
+     10,   2,  32,   1,   0,   0, 
     242, 241,  10,   0,  24,  21, 
      11,  16,   0,   0,   1,   0, 
       1,   0,  10,   0,  24,  21, 
@@ -4696,10 +4696,10 @@ const BYTE CustomUIDX11PixelShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    197,  38, 192,  98,   1,   0, 
-      0,   0,  28, 184,  22, 166, 
-    217, 216, 130,  74, 156,  59, 
-     64,  20, 107, 127, 235, 200, 
+     44, 192,   0,  99,   1,   0, 
+      0,   0, 228, 128,   6,  78, 
+    190, 123,  29,  72, 141,  39, 
+    197, 137,  62, 118, 154,  11, 
     174,   0,   0,   0,  47,  76, 
     105, 110, 107,  73, 110, 102, 
     111,   0,  47, 110,  97, 109, 
@@ -4799,7 +4799,7 @@ const BYTE CustomUIDX11PixelShader[] =
       0,   0,   0,   0,   2,   0, 
       9,   0,  76,   7,   0,   0, 
       0,   0,   0,   0, 236,   8, 
-      0,   0,   1,   0,   0,   0, 
+      0,   0,   1,   0, 254, 188, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
      84, 101, 120, 116, 117, 114, 

+ 16 - 16
FactoryCraft/CustomUIDX11VertexShader.h

@@ -204,10 +204,10 @@ ret
 
 const BYTE CustomUIDX11VertexShader[] =
 {
-     68,  88,  66,  67, 198, 215, 
-     54,  77, 212,  90, 102,  68, 
-     46, 199, 178,  30, 110, 226, 
-    122, 156,   1,   0,   0,   0, 
+     68,  88,  66,  67,  26, 198, 
+     97,  67, 248,  83,  94,  20, 
+    200, 192, 156, 106,  85,  41, 
+    149, 146,   1,   0,   0,   0, 
     252,  91,   0,   0,   6,   0, 
       0,   0,  56,   0,   0,   0, 
      84,   3,   0,   0,  12,   4, 
@@ -1228,10 +1228,10 @@ const BYTE CustomUIDX11VertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0, 148,  46,  49,   1, 
-    202,  39, 192,  98,   1,   0, 
-      0,   0,  73, 127, 109, 226, 
-    193,  59, 111,  67, 158, 228, 
-    120,  48, 229,  91, 136, 115, 
+     44, 192,   0,  99,   1,   0, 
+      0,   0, 148,   5, 102, 242, 
+    112,  37, 224,  78, 133,  78, 
+     18, 120, 158, 179, 239,  74, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   1,   0,   0,   0, 
       1,   0,   0,   0,   0,   0, 
@@ -1996,8 +1996,8 @@ const BYTE CustomUIDX11VertexShader[] =
      10, 125,  13,  10,  13,  10, 
      99,  98, 117, 102, 102, 101, 
     114,  32,  27, 226,  48,   1, 
-    128,   0,   0,   0, 127, 168, 
-     12, 109,   4, 142, 216,   1, 
+    128,   0,   0,   0, 154, 135, 
+    183, 224, 132, 180, 216,   1, 
       1,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
@@ -3702,11 +3702,11 @@ const BYTE CustomUIDX11VertexShader[] =
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,   0,   0, 
-    148,  46,  49,   1, 202,  39, 
-    192,  98,   1,   0,   0,   0, 
-     73, 127, 109, 226, 193,  59, 
-    111,  67, 158, 228, 120,  48, 
-    229,  91, 136, 115, 175,   0, 
+    148,  46,  49,   1,  44, 192, 
+      0,  99,   1,   0,   0,   0, 
+    148,   5, 102, 242, 112,  37, 
+    224,  78, 133,  78,  18, 120, 
+    158, 179, 239,  74, 175,   0, 
       0,   0,  47,  76, 105, 110, 
     107,  73, 110, 102, 111,   0, 
      47, 110,  97, 109, 101, 115, 
@@ -3806,7 +3806,7 @@ const BYTE CustomUIDX11VertexShader[] =
       0,   0,   2,   0,   9,   0, 
      64,   6,   0,   0,   0,   0, 
       0,   0, 244,   6,   0,   0, 
-      1,   0,   0,   0,   0,   0, 
+      1,   0, 200, 236,   0,   0, 
       0,   0,   0,   0,   0,   0, 
       0,   0,   0,   0,  84, 101, 
     120, 116, 117, 114, 101,  86, 

+ 0 - 364
enc_temp_folder/1a817e8f36ffebee508049966bba3a7f/World.cpp

@@ -1,364 +0,0 @@
-#include "World.h"
-
-#include <AsynchronCall.h>
-#include <GraphicsApi.h>
-#include <iostream>
-#include <Network.h>
-#include <Welt3D.h>
-
-#include "Constants.h"
-#include "Game.h"
-#include "Globals.h"
-#include "Registries.h"
-#include "WorldUpdate.h"
-
-using namespace Network;
-using namespace Framework;
-
-World* World::INSTANCE = 0;
-
-World::World(Bildschirm3D* zScreen, FactoryClient* client)
-    : Thread(),
-      client(client)
-{
-    renderedWorld = new Welt3D();
-    renderedWorld->addDiffuseLight(DiffuseLight{
-        Vec3<float>(0.5f, 0.5f, -1.f), Vec3<float>(1.f, 1.f, 1.f)});
-    currentDimension = new Dimension();
-    zScreenPtr = zScreen;
-    kam = new PlayerKam(zScreen);
-    kam->setWelt(renderedWorld);
-    zScreen->addKamera(kam);
-    firstMessage = 1;
-    ownEntityId = -1;
-    currentTarget = 0;
-    start();
-}
-
-World::~World()
-{
-    zScreenPtr->removeKamera(kam);
-    currentDimension->release();
-    if (currentTarget) currentTarget->release();
-    client->release();
-}
-
-void World::update(bool background)
-{
-    NetworkReader* serverMessageReader = 0;
-    unsigned char type = 0;
-    while (background
-               ? serverMessageReader = client->getNextBackgroundMessage()
-               : serverMessageReader = client->getNextForegroundMessage())
-    {
-        serverMessageReader->lese((char*)&type, 1);
-        if (type == 2) // WORLD UPDATE
-        {
-            int id = 0;
-            serverMessageReader->lese((char*)&id, 4);
-            STATIC_REGISTRY(WorldUpdateType)
-                .zElement(id)
-                ->applyUpdateAndCheck(serverMessageReader);
-        }
-        if (type == 3) // API MESSAGE
-        {
-            int length;
-            serverMessageReader->lese((char*)&length, 4);
-            char* data = new char[length];
-            serverMessageReader->lese(data, length);
-            switch (data[0])
-            {
-            case 1: // dimension message
-                {
-                    currentDimension->api(data + 1);
-                    break;
-                }
-            case 2: // gui message
-                ((Game*)(Menu*)menuRegister->get("game"))->api(data + 1);
-                break;
-            case 3: // set target
-                {
-                    switch (data[1])
-                    {
-                    case 0:
-                        setTarget(0);
-                        break;
-                    case 1:
-                        setTarget(zEntity(*(int*)(data + 2)));
-                        break;
-                    case 2:
-                        setTarget(zBlockAt(Vec3<int>(*(int*)(data + 2),
-                            *(int*)(data + 6),
-                            *(int*)(data + 10))));
-						int side = *(int*)(data + 14);
-						short len = *(short*)(data + 18);
-						char* uiml = new char[len + 1];
-                        memcpy(uiml, data + 20, len);
-                        uiml[len] = 0;
-                        ((Game*)(Menu*)menuRegister->get("game"))
-                            ->setTargetUIML(uiml);
-                        delete[] uiml;
-                        break;
-                    }
-                    break;
-                }
-            }
-            delete[] data;
-            // TODO: process messages
-        }
-        if (type == 4) // POSITION UPDATE
-        {
-            int old = ownEntityId;
-            serverMessageReader->lese((char*)&ownEntityId, 4);
-            kam->setEntityId(ownEntityId);
-            Entity* p = zEntity(ownEntityId);
-            if (p) p->setPlayerControlled();
-            if (old != ownEntityId) client->sendPlayerAction("\5", 1);
-        }
-        client->endMessageReading(background);
-    }
-    client->endMessageReading(background);
-    Entity* player = getCurrentPlayerEntity();
-    if (player)
-    {
-        renderedWorld->lock();
-        currentDimension->removeDistantChunks(
-            {(int)player->getPos().x, (int)player->getPos().y});
-        Punkt currentChunk
-            = getChunkCenter((int)player->getX(), (int)player->getY());
-        for (int x = 0; x <= CHUNK_VISIBILITY_RANGE; x++)
-        {
-            for (int y = 0; y <= CHUNK_VISIBILITY_RANGE; y++)
-            {
-                std::function<void(Punkt)> requestChunk = [this](Punkt center) {
-                    Chunk* zC = currentDimension->zChunk(center);
-                    if (!zC)
-                    {
-                        char msg[1];
-                        msg[0] = 0; // add observer and request chaunk data
-                        Punkt pos = center;
-                        subLock.lock();
-                        bool found = 0;
-                        for (Punkt p : subscriptions)
-                        {
-                            if (p == pos)
-                            {
-                                found = 1;
-                                break;
-                            }
-                        }
-                        if (!found)
-                        {
-                            client->chunkAPIRequest(pos, msg, 1);
-                            subscriptions.add(pos);
-                        }
-                        subLock.unlock();
-                    }
-                };
-                requestChunk(
-                    currentChunk + Punkt(x * CHUNK_SIZE, y * CHUNK_SIZE));
-                if (y > 0)
-                    requestChunk(
-                        currentChunk + Punkt(x * CHUNK_SIZE, -y * CHUNK_SIZE));
-                if (x > 0)
-                {
-                    requestChunk(
-                        currentChunk + Punkt(-x * CHUNK_SIZE, y * CHUNK_SIZE));
-                    if (y > 0)
-                        requestChunk(currentChunk
-                                     + Punkt(-x * CHUNK_SIZE, -y * CHUNK_SIZE));
-                }
-            }
-        }
-        renderedWorld->unlock();
-    }
-}
-
-void World::setChunk(Chunk* chunk)
-{
-    zScreenPtr->lock();
-    renderedWorld->lock();
-    currentDimension->setChunk(chunk, chunk->getCenter());
-    renderedWorld->unlock();
-    zScreenPtr->unlock();
-}
-
-void World::thread()
-{
-    new AsynchronCall("World Update", [this]() {
-        while (true)
-        {
-            zScreenPtr->lock();
-            if (World::INSTANCE != this)
-            {
-                zScreenPtr->unlock();
-                return;
-            }
-            zScreenPtr->unlock();
-            update(0);
-            Sleep(10);
-        }
-    });
-    while (true)
-    {
-        zScreenPtr->lock();
-        if (World::INSTANCE != this)
-        {
-            zScreenPtr->unlock();
-            return;
-        }
-        zScreenPtr->unlock();
-        update(1);
-        Sleep(10);
-    }
-}
-
-Block* World::zBlockAt(Framework::Vec3<int> location) const
-{
-    return currentDimension->zBlock(location);
-    return 0;
-}
-
-Block* World::getBlockAt(Framework::Vec3<int> location) const
-{
-    return currentDimension->getBlock(location);
-    return 0;
-}
-
-Dimension* World::zDimension() const
-{
-    return currentDimension;
-}
-
-void World::setVisibility(Chunk* zChunk, bool visible)
-{
-    renderedWorld->lock();
-    if (visible)
-        renderedWorld->addCollection(
-            dynamic_cast<Framework::Model3DCollection*>(zChunk->getThis()));
-    else
-        renderedWorld->removeCollection(zChunk);
-    renderedWorld->unlock();
-}
-
-void World::setVisibility(Entity* zEntity, bool visible)
-{
-    renderedWorld->lock();
-    if (visible)
-        renderedWorld->addZeichnung(
-            dynamic_cast<Framework::Model3D*>(zEntity->getThis()));
-    else
-        renderedWorld->removeZeichnung(zEntity);
-    renderedWorld->unlock();
-}
-
-Framework::Punkt World::getChunkCenter(int x, int y) const
-{
-    return Punkt(((x < 0 ? x + 1 : x) / CHUNK_SIZE) * CHUNK_SIZE
-                     + (x < 0 ? -CHUNK_SIZE : CHUNK_SIZE) / 2,
-        ((y < 0 ? y + 1 : y) / CHUNK_SIZE) * CHUNK_SIZE
-            + (y < 0 ? -CHUNK_SIZE : CHUNK_SIZE) / 2);
-}
-
-Entity* World::zEntity(int id) const
-{
-    Entity* e = currentDimension->zEntity(id);
-    if (e) return e;
-    return 0;
-}
-
-Entity* World::getEntity(int id) const
-{
-    Entity* e = currentDimension->getEntity(id);
-    if (e) return e;
-    return 0;
-}
-
-void World::removeEntity(int id)
-{
-    currentDimension->removeEntity(id);
-}
-
-PlayerKam* World::zKamera() const
-{
-    return kam;
-}
-
-int World::getCurrentPlayerId() const
-{
-    return ownEntityId;
-}
-
-Entity* World::getCurrentPlayerEntity() const
-{
-    return zEntity(ownEntityId);
-}
-
-void World::setTarget(Framework::Model3D* zTarget)
-{
-    if (zTarget != currentTarget)
-    {
-        targetLock.lock();
-        if (currentTarget)
-        {
-            currentTarget->setAmbientFactor(
-                currentTarget->getAmbientFactor() - 0.2f);
-            currentTarget->release();
-            currentTarget = 0;
-        }
-        if (zTarget)
-        {
-            currentTarget
-                = dynamic_cast<Framework::Model3D*>(zTarget->getThis());
-            if (currentTarget)
-                currentTarget->setAmbientFactor(
-                    currentTarget->getAmbientFactor() + 0.2f);
-        }
-        targetLock.unlock();
-    }
-}
-
-void World::lockWorld()
-{
-    renderedWorld->lock();
-}
-
-void World::unlockWorld()
-{
-    renderedWorld->unlock();
-}
-
-void World::onChunkAdded(Punkt pos)
-{
-    subLock.lock();
-    int index = 0;
-    for (Punkt p : subscriptions)
-    {
-        if (p == pos)
-        {
-            subscriptions.remove(index);
-            break;
-        }
-        index++;
-    }
-    subLock.unlock();
-}
-
-Framework::Model3D* World::getCurrentTarget() const
-{
-    while (targetLock.isLocked())
-        Sleep(1);
-    return currentTarget
-             ? dynamic_cast<Framework::Model3D*>(currentTarget->getThis())
-             : 0;
-}
-
-Chunk* World::zChunk(Punkt center)
-{
-    return currentDimension->zChunk(center);
-}
-
-FactoryClient* World::zClient() const
-{
-    return client;
-}

+ 0 - 204
enc_temp_folder/9b638151c6d234a85fa47499df0b4ba/Game.cpp

@@ -1,204 +0,0 @@
-#include "Game.h"
-
-#include <AsynchronCall.h>
-#include <Bildschirm.h>
-
-#include "Globals.h"
-#include "Initialisierung.h"
-#include "ItemBar.h"
-
-Game::Game(Bildschirm* zScreen)
-    : Menu(zScreen)
-{
-    inventoryDragController = new DragController<InventoryDragSource, int>();
-    logout = initKnopf(10, 10, 200, 20, Knopf::Style::Normal, "Verlassen");
-    logout->setMausEreignis([this, zScreen](void* p, void* o, MausEreignis me) {
-        if (me.id == ME_RLinks)
-        {
-            logout->removeStyle(Knopf::Style::Erlaubt);
-            new AsynchronCall([this, zScreen]() {
-                // TODO
-                /*if (World::INSTANCE->zClient()->leaveGame())
-                {
-                    World::INSTANCE->release();
-                    World::INSTANCE = 0;
-                    zScreen->lock();
-                    hide();
-                    menuRegister->get("directConnect")->show();
-                    zScreen->unlock();
-                }*/
-                logout->addStyle(Knopf::Style::Erlaubt);
-            });
-        }
-        return 1;
-    });
-    elements.add(logout);
-    debug = initTextFeld(10,
-        40,
-        500,
-        250,
-        TextFeld::Style::Text | TextFeld::Style::Mehrzeilig,
-        "");
-    elements.add(debug);
-    guiView = new UIMLView("<v/>", uiFactory);
-    guiView->addKnownElement(new ItemBarElement());
-    guiView->setStyle(UIMLView::Style::Sichtbar);
-    guiView->setSize(window->zBildschirm()->getBackBufferSize());
-    elements.add(guiView);
-    targetUIMLView = new UIMLView("<v/>", uiFactory);
-    targetUIMLView->setStyle(UIMLView::Style::Hintergrund
-                             | UIMLView::Style::HAlpha);
-    targetUIMLView->setHintergrundFarbe(0xA0000000);
-    elements.add(targetUIMLView);
-}
-
-Game::~Game()
-{
-    inventoryDragController->release();
-}
-
-void Game::updatePosition(
-    Vec3<float> position, bool target, Vec3<int> targetPos)
-{
-    Text txt = "Position: (";
-    txt.setPrecision(2);
-    txt += position.x;
-    txt += ", ";
-    txt += position.y;
-    txt += ", ";
-    txt += position.z;
-    txt += ")";
-    if (target)
-    {
-        txt += "\nTarget: (";
-        txt += targetPos.x;
-        txt += ", ";
-        txt += targetPos.y;
-        txt += ", ";
-        txt += targetPos.z;
-        txt += ")\n";
-        Block* b = World::INSTANCE->zBlockAt(targetPos);
-        if (b)
-        {
-            txt += "TargetLight: \n";
-            txt += b->printLightInfo();
-        }
-    }
-    debug->setText(txt);
-}
-
-void Game::api(char* data)
-{
-    switch (data[0])
-    {
-    case 0: // open dialog
-        {
-            bool exists = 0;
-            short len = *(short*)(data + 1);
-            char* dialogName = new char[len + 1];
-            memcpy(dialogName, data + 3, len);
-            dialogName[len] = 0;
-            for (UIMLDialog* dialog : dialogs)
-            {
-                if (dialog->getName().istGleich(dialogName))
-                {
-                    exists = 1;
-                    break;
-                }
-            }
-            delete[] dialogName;
-            if (!exists)
-            {
-                int uimlLen = *(int*)(data + 3 + len);
-                char* uiml = new char[uimlLen + 1];
-                memcpy(uiml, data + 7 + len, uimlLen);
-                uiml[uimlLen] = 0;
-                UIMLDialog* dialog
-                    = new UIMLDialog(uiml, [this](UIMLDialog* dialog) {
-                          logout->postAction([this, dialog]() {
-                              int index = 0;
-                              for (UIMLDialog* d : dialogs)
-                              {
-                                  if (d == dialog)
-                                  {
-                                      dialogs.remove(index);
-                                      window->zBildschirm()->removeMember(d);
-                                      World::INSTANCE->zKamera()
-                                          ->setControlEnabled(
-                                              dialogs.getEintragAnzahl() == 0);
-                                      break;
-                                  }
-                                  index++;
-                              }
-                          });
-                      });
-                dialogs.add(dialog);
-                World::INSTANCE->zKamera()->setControlEnabled(0);
-                window->zBildschirm()->addMember(dialog);
-                delete[] uiml;
-            }
-            break;
-        }
-    case 1:
-        { // element message
-            for (UIMLDialog* dialog : dialogs)
-            {
-                dialog->api(data + 1);
-            }
-            short idLen = *(short*)(data + 1);
-            char* id = new char[idLen + 1];
-            memcpy(id, data + 3, idLen);
-            id[idLen] = 0;
-            NetworkAPIProcessor* processor = dynamic_cast<NetworkAPIProcessor*>(
-                guiView->zZeichnungById(id));
-            if (processor) processor->api(data + 3 + idLen);
-            delete[] id;
-            break;
-        }
-    case 2:
-        { // set gui
-            int uimlLen = *(int*)(data + 1);
-            char* uiml = new char[uimlLen + 1];
-            memcpy(uiml, data + 5, uimlLen);
-            uiml[uimlLen] = 0;
-            guiView->setUIML(uiml);
-            guiView->layout();
-            delete[] uiml;
-        }
-    }
-}
-
-void Game::closeCurrentDialog()
-{
-    if (dialogs.getEintragAnzahl() > 0)
-    {
-        UIMLDialog* d = dialogs.get(dialogs.getEintragAnzahl() - 1);
-        window->zBildschirm()->removeMember(d);
-        dialogs.remove(dialogs.getEintragAnzahl() - 1);
-        World::INSTANCE->zKamera()->setControlEnabled(
-            dialogs.getEintragAnzahl() == 0);
-    }
-}
-
-DragController<InventoryDragSource, int>* Game::zInventoryDragController()
-{
-    return inventoryDragController;
-}
-
-void Game::setTargetUIML(Framework::Text uiml)
-{
-    if (uiml.getLength())
-    {
-        targetUIMLView->setUIML(uiml);
-        targetUIMLView->layout();
-        targetUIMLView->setSize(targetUIMLView->calculateContentSize());
-        targetUIMLView->setPosition(
-            window->zBildschirm()->zGraphicsApi()->getBackBufferSize()
-            - targetUIMLView->getSize());
-        targetUIMLView->addStyle(UIMLView::Style::Sichtbar);
-    }
-    else
-    {
-        targetUIMLView->removeStyle(UIMLView::Style::Sichtbar);
-    }
-}