Browse Source

initial commit

Kolja Strohm 2 years ago
commit
3620864d4a
48 changed files with 2174 additions and 0 deletions
  1. 266 0
      .gitignore
  2. 31 0
      FactoryCraft.sln
  3. 22 0
      FactoryCraft/AddChunkUpdate.cpp
  4. 16 0
      FactoryCraft/AddChunkUpdate.h
  5. 24 0
      FactoryCraft/Area.h
  6. 28 0
      FactoryCraft/Block.h
  7. 37 0
      FactoryCraft/BlockType.cpp
  8. 25 0
      FactoryCraft/BlockType.h
  9. 28 0
      FactoryCraft/Chunk.h
  10. 10 0
      FactoryCraft/CurrentPlayer.h
  11. 21 0
      FactoryCraft/Dimension.h
  12. 36 0
      FactoryCraft/DirectConnect.cpp
  13. 14 0
      FactoryCraft/DirectConnect.h
  14. 8 0
      FactoryCraft/Entity.h
  15. 76 0
      FactoryCraft/FactoryClient.cpp
  16. 22 0
      FactoryCraft/FactoryClient.h
  17. 220 0
      FactoryCraft/FactoryCraft.vcxproj
  18. 162 0
      FactoryCraft/FactoryCraft.vcxproj.filters
  19. 27 0
      FactoryCraft/Game.cpp
  20. 13 0
      FactoryCraft/Game.h
  21. 41 0
      FactoryCraft/Globals.cpp
  22. 27 0
      FactoryCraft/Globals.h
  23. 155 0
      FactoryCraft/Initialisierung.cpp
  24. 28 0
      FactoryCraft/Initialisierung.h
  25. 26 0
      FactoryCraft/Inventory.h
  26. 33 0
      FactoryCraft/Inventoty.cpp
  27. 73 0
      FactoryCraft/Item.cpp
  28. 40 0
      FactoryCraft/Item.h
  29. 13 0
      FactoryCraft/ItemSlot.cpp
  30. 19 0
      FactoryCraft/ItemSlot.h
  31. 24 0
      FactoryCraft/ItemStack.cpp
  32. 18 0
      FactoryCraft/ItemStack.h
  33. 55 0
      FactoryCraft/ItemType.cpp
  34. 31 0
      FactoryCraft/ItemType.h
  35. 35 0
      FactoryCraft/Login.cpp
  36. 15 0
      FactoryCraft/Login.h
  37. 65 0
      FactoryCraft/Main.cpp
  38. 23 0
      FactoryCraft/Menu.cpp
  39. 19 0
      FactoryCraft/Menu.h
  40. 44 0
      FactoryCraft/Menü.h
  41. 103 0
      FactoryCraft/NetworkHandler.cpp
  42. 24 0
      FactoryCraft/NetworkHandler.h
  43. 20 0
      FactoryCraft/StaticInitializerOrder.h
  44. 74 0
      FactoryCraft/StaticRegistry.h
  45. 43 0
      FactoryCraft/World.cpp
  46. 18 0
      FactoryCraft/World.h
  47. 7 0
      FactoryCraft/WorldUpdate.cpp
  48. 15 0
      FactoryCraft/WorldUpdate.h

+ 266 - 0
.gitignore

@@ -0,0 +1,266 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+data/
+Framework.dll
+Network.dll
+KSGClient/Netzwerk/Keys.cpp

+ 31 - 0
FactoryCraft.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31025.194
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FactoryCraft", "FactoryCraft\FactoryCraft.vcxproj", "{896EFE7E-D75C-4F28-AD54-331521DA10DC}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Debug|x64.ActiveCfg = Debug|x64
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Debug|x64.Build.0 = Debug|x64
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Debug|x86.ActiveCfg = Debug|Win32
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Debug|x86.Build.0 = Debug|Win32
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Release|x64.ActiveCfg = Release|x64
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Release|x64.Build.0 = Release|x64
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Release|x86.ActiveCfg = Release|Win32
+		{896EFE7E-D75C-4F28-AD54-331521DA10DC}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {F08350A2-2477-4346-AE38-24440C7EE72E}
+	EndGlobalSection
+EndGlobal

+ 22 - 0
FactoryCraft/AddChunkUpdate.cpp

@@ -0,0 +1,22 @@
+#include <Punkt.h>
+
+#include "AddChunkUpdate.h"
+#include "Chunk.h"
+#include "Globals.h"
+
+AddChunkUpdateType::AddChunkUpdateType()
+    : WorldUpdateType( ID )
+{}
+
+
+void AddChunkUpdateType::applyUpdate( Framework::StreamReader *zReader )
+{
+    int dimensionID;
+    zReader->lese( (char *)&dimensionID, 4 );
+    Framework::Punkt center;
+    zReader->lese( (char *)&center.x, 4 );
+    zReader->lese( (char *)&center.y, 4 );
+    Chunk *chunk = new Chunk( center, dimensionID );
+    chunk->load( zReader );
+    currentGame->setChunk( chunk );
+}

+ 16 - 0
FactoryCraft/AddChunkUpdate.h

@@ -0,0 +1,16 @@
+#pragma once
+
+#include "WorldUpdate.h"
+
+class AddChunkUpdateType : WorldUpdateType
+{
+    REGISTRABLE( AddChunkUpdateType )
+
+protected:
+    AddChunkUpdateType();
+
+public:
+    void applyUpdate( Framework::StreamReader *zReader ) override;
+};
+
+REGISTER( AddChunkUpdateType, WorldUpdateType )

+ 24 - 0
FactoryCraft/Area.h

@@ -0,0 +1,24 @@
+#pragma once
+
+#include <Vec3.h>
+
+struct Area
+{
+    int startX;
+    int startY;
+    int endX;
+    int endY;
+    int dimensionId;
+};
+
+enum Direction
+{
+    NO_DIRECTION = 0,
+    NORTH = 1,
+    EAST = 2,
+    SOUTH = 4,
+    WEST = 8,
+    TOP = 16,
+    BOTTOM = 32
+};
+typedef int Directions;

+ 28 - 0
FactoryCraft/Block.h

@@ -0,0 +1,28 @@
+#pragma once
+
+#include <Model3D.h>
+
+#include "Inventory.h"
+#include "Chunk.h"
+
+using namespace Framework;
+
+class Block : public Model3D, public Inventory
+{
+private:
+    bool visible;
+    bool transparent;
+    bool passable;
+    float hp;
+    float maxHP;
+    float hardness;
+    float speedModifier;
+    ItemType *zTool;
+
+public:
+    Block( Vec3<int> position );
+    ~Block();
+
+    friend Chunk;
+    friend BlockType;
+};

+ 37 - 0
FactoryCraft/BlockType.cpp

@@ -0,0 +1,37 @@
+#include "BlockType.h"
+#include "Block.h"
+
+using namespace Framework;
+
+BlockType::BlockType( int id )
+    : ReferenceCounter(),
+    id( id )
+{
+    StaticRegistry<BlockType>::INSTANCE.registerT( this, id );
+}
+
+void BlockType::loadSuperBlock( Block *zBlock, Framework::StreamReader *zReader )
+{
+    zBlock->loadInventory( zReader );
+    zReader->lese( (char *)&zBlock->transparent, 1 );
+    zReader->lese( (char *)&zBlock->passable, 1 );
+    zReader->lese( (char *)&zBlock->hp, 4 );
+    zReader->lese( (char *)&zBlock->maxHP, 4 );
+    zReader->lese( (char *)&zBlock->hardness, 4 );
+    zReader->lese( (char *)&zBlock->speedModifier, 4 );
+    int effectiveToolId;
+    zReader->lese( (char *)&effectiveToolId, 4 );
+    zBlock->zTool = StaticRegistry<ItemType>::INSTANCE.zElement( effectiveToolId );
+}
+
+Block *BlockType::loadBlock( Framework::Vec3<int> position, Game *zTarget, Framework::StreamReader *zReader )
+{
+    Block *result = createBlock( position, zTarget );
+    loadSuperBlock( result, zReader );
+    return result;
+}
+
+int BlockType::getId() const
+{
+    return id;
+}

+ 25 - 0
FactoryCraft/BlockType.h

@@ -0,0 +1,25 @@
+#pragma once
+
+#include <Writer.h>
+
+#include "StaticRegistry.h"
+
+class Game;
+class Block;
+
+class BlockType : public virtual Framework::ReferenceCounter
+{
+private:
+    const int id;
+
+protected:
+    BlockType( int id );
+
+    virtual void loadSuperBlock( Block *zBlock, Framework::StreamReader *zReader );
+    virtual Block *createBlock( Framework::Vec3<int> position, Game *zTarget ) = 0;
+
+public:
+    virtual Block *loadBlock( Framework::Vec3<int> position, Game *zTarget, Framework::StreamReader *zReader );
+
+    int getId() const;
+};

+ 28 - 0
FactoryCraft/Chunk.h

@@ -0,0 +1,28 @@
+#pragma once
+
+#include <Punkt.h>
+
+#include "Block.h"
+#include "Area.h"
+
+class Chunk : public virtual Framework::ReferenceCounter
+{
+private:
+    int dimensionId;
+    Framework::Punkt location;
+    Block **blocks;
+    Chunk *zNeighbours[ 4 ];
+
+public:
+    Chunk( Framework::Punkt location, int dimensionId );
+    Chunk( Framework::Punkt location, int dimensionId, Framework::StreamReader *zReader );
+    ~Chunk();
+    Block *getBlockAt( Framework::Vec3<int> cLocation ) const;
+    Block *zBlockAt( Framework::Vec3<int> cLocation ) const;
+    void putBlockAt( Framework::Vec3<int> location, Block *block );
+    void setNeighbor( Direction dir, Chunk *zChunk );
+    void load( Framework::StreamReader *zReader );
+    int getDimensionId() const;
+    Framework::Punkt getCenter() const;
+
+};

+ 10 - 0
FactoryCraft/CurrentPlayer.h

@@ -0,0 +1,10 @@
+#pragma once
+#include "Entity.h"
+#include <Kam3D.h>
+
+class CurrentPlayer : public Framework::ReferenceCounter
+{
+private:
+    Entity *entity;
+    Framework::Kam3D *kam3D;
+};

+ 21 - 0
FactoryCraft/Dimension.h

@@ -0,0 +1,21 @@
+#pragma once
+
+#include <Array.h>
+#include <Trie.h>
+
+#include "Chunk.h"
+#include "Entity.h"
+
+class Dimension : public virtual Framework::ReferenceCounter
+{
+private:
+    int dimensionId;
+    Framework::Trie<Chunk> *chunks;
+    Framework::RCArray<Entity> *entities;
+    void getAddrOf( Framework::Punkt cPos, char *addr ) const;
+    void getAddrOfWorld( Framework::Punkt wPos, char *addr ) const;
+    Chunk *zChunk( Framework::Punkt wPos ) const;
+public:
+
+    void updateVisibility();
+};

+ 36 - 0
FactoryCraft/DirectConnect.cpp

@@ -0,0 +1,36 @@
+#include "DirectConnect.h"
+#include "Initialisierung.h"
+#include "Globals.h"
+
+DirectConnect::DirectConnect( Bildschirm *zScreen )
+    : Menu( zScreen )
+{
+    elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Adresse: " ) );
+    elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Port: " ) );
+    address = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "" );
+    port = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "" );
+    port->setTastaturEreignis( _nurNummernTE );
+    elements.add( address );
+    elements.add( port );
+    Knopf *login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Beitreten" );
+    login->setMausEreignis( [this, login]( void *p, void *o, MausEreignis me )
+    {
+        if( me.id == ME_RLinks )
+        {
+            login->removeStyle( Knopf::Style::Erlaubt );
+            address->removeStyle( TextFeld::Style::Erlaubt );
+            port->removeStyle( TextFeld::Style::Erlaubt );
+            if( network->connect( address->zText()->getText(), (short)(int)*port->zText() ) )
+            {
+                currentGame = new World();
+                hide();
+                menuRegister->get( "game" )->show();
+            }
+            address->addStyle( TextFeld::Style::Erlaubt );
+            port->addStyle( TextFeld::Style::Erlaubt );
+            login->addStyle( Knopf::Style::Erlaubt );
+        }
+        return 1;
+    } );
+    elements.add( login );
+}

+ 14 - 0
FactoryCraft/DirectConnect.h

@@ -0,0 +1,14 @@
+#pragma once
+
+#include <TextFeld.h>
+#include "Menu.h"
+
+class DirectConnect : public Menu
+{
+private:
+    TextFeld *address;
+    TextFeld *port;
+
+public:
+    DirectConnect( Bildschirm *zScreen );
+};

+ 8 - 0
FactoryCraft/Entity.h

@@ -0,0 +1,8 @@
+#pragma once
+
+#include <Model3D.h>
+
+class Entity : public Framework::Model3D
+{
+
+};

+ 76 - 0
FactoryCraft/FactoryClient.cpp

@@ -0,0 +1,76 @@
+#include "FactoryClient.h"
+
+using namespace Network;
+
+FactoryClient::FactoryClient()
+{
+    client = 0;
+    connected = 0;
+    reader = 0;
+}
+
+FactoryClient::~FactoryClient()
+{
+    if( client )
+        disconnect();
+}
+
+bool FactoryClient::connect( Text ip, short port, int accountId, Text secret )
+{
+    if( client )
+    {
+        disconnect();
+        client = new SSLKlient();
+    }
+    if( !client->verbinde( port, ip ) )
+        return false;
+    connected = 1;
+    if( !client->sende( "\1", 1 ) )
+        return false;
+    if( !client->sende( (char *)&accountId, 4 ) )
+        return false;
+    unsigned char len = (unsigned char)secret.getLength();
+    if( !client->sende( (char *)&len, 1 ) )
+        return false;
+    if( !client->sende( secret, len ) )
+        return false;
+    char result = 0;
+    if( !client->getNachricht( &result, 1 ) || result != 1 )
+        return false;
+    reader = new NetworkReader( client );
+    return true;
+}
+
+void FactoryClient::disconnect()
+{
+    if( client )
+    {
+        if( connected )
+            client->sende( "\2", 1 );
+        delete reader;
+        client->trenne();
+        client->release();
+        client = 0;
+    }
+}
+
+NetworkReader *FactoryClient::getNextMessage()
+{
+    if( !client )
+        return 0;
+    if( !client->hatNachricht( 0 ) )
+        return 0;
+    char type = 0;
+    if( !client->getNachricht( &type, 1 ) )
+        return 0;
+    if( type == 1 )
+    {
+        client->trenne();
+        client->release();
+        client = 0;
+        return 0;
+    }
+    if( !client->hatNachricht( 0 ) )
+        return 0;
+    return reader;
+}

+ 22 - 0
FactoryCraft/FactoryClient.h

@@ -0,0 +1,22 @@
+#pragma once
+
+#include <Network.h>
+#include <Klient.h>
+#include <Text.h>
+#include <Thread.h>
+
+class FactoryClient : public Framework::ReferenceCounter
+{
+private:
+    Network::SSLKlient *client;
+    bool connected;
+    void disconnect();
+    NetworkReader *reader;
+
+public:
+    FactoryClient();
+    ~FactoryClient();
+
+    bool connect( Text ip, short port, int accountId, Text secret );
+    Network::NetworkReader *getNextMessage();
+};

+ 220 - 0
FactoryCraft/FactoryCraft.vcxproj

@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{896efe7e-d75c-4f28-ad54-331521da10dc}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>FactoryCraft</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>..\..\..\..\Klient\KSGNetwork\Include;..\..\..\..\..\Allgemein\Framework;..\..\..\Include;..\..\..\..\..\Allgemein\Network\Network;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\..\Allgemein\Framework\x64\Debug;..\..\..\..\..\Allgemein\Network\x64\Debug;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\..\..\..\Allgemein\Framework;..\..\..\Include;..\..\..\KSGNetwork\Include;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\..\Allgemein\Framework\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>Build</CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>..\..\..\KSGNetwork\Include;..\..\..\..\..\Allgemein\Framework;..\..\..\Include;..\..\..\..\..\Allgemein\Network\Network;$(IncludePath)</IncludePath>
+    <LibraryPath>..\..\..\..\..\Allgemein\Framework\x64\Release;..\..\..\..\..\Allgemein\Network\x64\Release;$(LibraryPath)</LibraryPath>
+    <CustomBuildBeforeTargets>Build</CustomBuildBeforeTargets>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FANGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FANGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>Framework.lib;network.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+      <Command>copy "..\..\..\..\..\Allgemein\Framework\x64\Debug\Framework.dll" "framework.dll"
+copy "..\..\..\..\..\Allgemein\Network\x64\Debug\Network.dll" "network.dll"</Command>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FANGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+      <Command>copy "..\Release\FactoryCraft.dll" "..\..\..\Fertig\Minigames\x32\FactoryCraft\bin\game.dll"</Command>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FANGEN_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>Framework.lib;Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+    <CustomBuildStep>
+      <Outputs>kopieren...;%(Outputs)</Outputs>
+      <Command>copy "..\x64\Release\FactoryCraft.exe" "..\..\Fertig\FactoryCraft\Client"</Command>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="AddChunkUpdate.cpp" />
+    <ClCompile Include="BlockType.cpp" />
+    <ClCompile Include="DirectConnect.cpp" />
+    <ClCompile Include="FactoryClient.cpp" />
+    <ClCompile Include="Game.cpp" />
+    <ClCompile Include="Globals.cpp" />
+    <ClCompile Include="Initialisierung.cpp" />
+    <ClCompile Include="Inventoty.cpp" />
+    <ClCompile Include="Item.cpp" />
+    <ClCompile Include="ItemSlot.cpp" />
+    <ClCompile Include="ItemStack.cpp" />
+    <ClCompile Include="ItemType.cpp" />
+    <ClCompile Include="Login.cpp" />
+    <ClCompile Include="Main.cpp" />
+    <ClCompile Include="Menu.cpp" />
+    <ClCompile Include="NetworkHandler.cpp" />
+    <ClCompile Include="World.cpp" />
+    <ClCompile Include="WorldUpdate.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Area.h" />
+    <ClInclude Include="Block.h" />
+    <ClInclude Include="BlockType.h" />
+    <ClInclude Include="Chunk.h" />
+    <ClInclude Include="CurrentPlayer.h" />
+    <ClInclude Include="Dimension.h" />
+    <ClInclude Include="DirectConnect.h" />
+    <ClInclude Include="Entity.h" />
+    <ClInclude Include="FactoryClient.h" />
+    <ClInclude Include="Game.h" />
+    <ClInclude Include="Globals.h" />
+    <ClInclude Include="AddChunkUpdate.h" />
+    <ClInclude Include="Initialisierung.h" />
+    <ClInclude Include="Inventory.h" />
+    <ClInclude Include="Item.h" />
+    <ClInclude Include="ItemSlot.h" />
+    <ClInclude Include="ItemStack.h" />
+    <ClInclude Include="ItemType.h" />
+    <ClInclude Include="Login.h" />
+    <ClInclude Include="Menu.h" />
+    <ClInclude Include="NetworkHandler.h" />
+    <ClInclude Include="StaticInitializerOrder.h" />
+    <ClInclude Include="StaticRegistry.h" />
+    <ClInclude Include="WorldUpdate.h" />
+    <ClInclude Include="World.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 162 - 0
FactoryCraft/FactoryCraft.vcxproj.filters

@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+    <Filter Include="Ressourcendateien">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+    <Filter Include="static">
+      <UniqueIdentifier>{4a54dd56-42bb-4f6c-839d-8ed5709a9373}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="world">
+      <UniqueIdentifier>{0a3d8693-54b5-4227-ba18-b964b512430b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="world\update">
+      <UniqueIdentifier>{b7be90aa-b378-46eb-90ed-b31d984ff5ce}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="inventory">
+      <UniqueIdentifier>{dcbc509e-a646-43ea-9b60-9c5e96e3ea34}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="Main.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Menu.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Login.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="NetworkHandler.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="FactoryClient.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="DirectConnect.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="Game.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="World.cpp">
+      <Filter>world</Filter>
+    </ClCompile>
+    <ClCompile Include="Globals.cpp">
+      <Filter>static</Filter>
+    </ClCompile>
+    <ClCompile Include="Initialisierung.cpp">
+      <Filter>static</Filter>
+    </ClCompile>
+    <ClCompile Include="WorldUpdate.cpp">
+      <Filter>world\update</Filter>
+    </ClCompile>
+    <ClCompile Include="AddChunkUpdate.cpp">
+      <Filter>world\update</Filter>
+    </ClCompile>
+    <ClCompile Include="BlockType.cpp">
+      <Filter>world</Filter>
+    </ClCompile>
+    <ClCompile Include="Inventoty.cpp">
+      <Filter>inventory</Filter>
+    </ClCompile>
+    <ClCompile Include="Item.cpp">
+      <Filter>inventory</Filter>
+    </ClCompile>
+    <ClCompile Include="ItemSlot.cpp">
+      <Filter>inventory</Filter>
+    </ClCompile>
+    <ClCompile Include="ItemStack.cpp">
+      <Filter>inventory</Filter>
+    </ClCompile>
+    <ClCompile Include="ItemType.cpp">
+      <Filter>inventory</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Menu.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Login.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="NetworkHandler.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="FactoryClient.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="DirectConnect.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Game.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Entity.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="CurrentPlayer.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="Area.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="Block.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="Chunk.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="Dimension.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="World.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="WorldUpdate.h">
+      <Filter>world\update</Filter>
+    </ClInclude>
+    <ClInclude Include="AddChunkUpdate.h">
+      <Filter>world\update</Filter>
+    </ClInclude>
+    <ClInclude Include="Globals.h">
+      <Filter>static</Filter>
+    </ClInclude>
+    <ClInclude Include="Initialisierung.h">
+      <Filter>static</Filter>
+    </ClInclude>
+    <ClInclude Include="StaticRegistry.h">
+      <Filter>static</Filter>
+    </ClInclude>
+    <ClInclude Include="StaticInitializerOrder.h">
+      <Filter>static</Filter>
+    </ClInclude>
+    <ClInclude Include="BlockType.h">
+      <Filter>world</Filter>
+    </ClInclude>
+    <ClInclude Include="Inventory.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
+    <ClInclude Include="ItemSlot.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
+    <ClInclude Include="ItemStack.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
+    <ClInclude Include="Item.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
+    <ClInclude Include="ItemType.h">
+      <Filter>inventory</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 27 - 0
FactoryCraft/Game.cpp

@@ -0,0 +1,27 @@
+#include "Game.h"
+#include "Initialisierung.h"
+#include "Globals.h"
+
+Game::Game( Bildschirm *zScreen )
+    : Menu( zScreen )
+{
+    logout = initKnopf( 10, 10, 200, 20, Knopf::Style::Normal, "Verlassen" );
+    elements.add( logout );
+    logout->setMausEreignis( [this]( void *p, void *o, MausEreignis me )
+    {
+        if( me.id == ME_RLinks )
+        {
+            logout->removeStyle( Knopf::Style::Erlaubt );
+            if( network->leaveGame() )
+            {
+                currentGame->release();
+                currentGame = 0;
+                hide();
+                menuRegister->get( "directConnect" )->show();
+            }
+            logout->addStyle( Knopf::Style::Erlaubt );
+        }
+        return 1;
+    } );
+    elements.add( logout );
+}

+ 13 - 0
FactoryCraft/Game.h

@@ -0,0 +1,13 @@
+#pragma once
+
+#include "Menu.h"
+
+class Game : public Menu
+{
+private:
+    Knopf *logout;
+
+public:
+    // Konstruktor
+    Game( Bildschirm *zScreen );
+};

+ 41 - 0
FactoryCraft/Globals.cpp

@@ -0,0 +1,41 @@
+#define variable
+#include <Text.h>
+#include "Globals.h"
+#include "Login.h"
+#include "DirectConnect.h"
+#include "Game.h"
+
+
+void initVariables()
+{
+    dlls = new DLLRegister();
+    menuRegister = new HashMap<Framework::Text, Framework::RCPointer<Menu>>( 10, []( Text txt )
+    {
+        return txt.hashCode();
+    } );
+    fontRegister = new HashMap<Framework::Text, Framework::RCPointer<Schrift>>( 10, []( Text txt )
+    {
+        return txt.hashCode();
+    } );
+    network = new NetworkHandler();
+    currentGame = 0;
+}
+
+void initMenus()
+{
+    menuRegister->put( "login", RCPointer<Menu>::of( new LoginMenu( uiFactory.initParam.bildschirm ) ) );
+    menuRegister->put( "directConnect", RCPointer<Menu>::of( new DirectConnect( uiFactory.initParam.bildschirm ) ) );
+    menuRegister->put( "game", RCPointer<Menu>::of( new Game( uiFactory.initParam.bildschirm ) ) );
+
+    menuRegister->get( "login" )->show();
+}
+
+void releaseVariables()
+{
+    if( currentGame )
+        currentGame->release();
+    menuRegister->release();
+    fontRegister->release();
+    network->release();
+    dlls->release();
+}

+ 27 - 0
FactoryCraft/Globals.h

@@ -0,0 +1,27 @@
+#pragma once
+#include <Array.h>
+#include <HashMap.h>
+#include <RCPointer.h>
+#include <UIInitialization.h>
+#include <Schrift.h>
+#include <DLLRegister.h>
+
+#include "Menu.h"
+#include "NetworkHandler.h"
+#include "World.h"
+
+#ifndef variable
+#define variable extern
+#endif
+
+variable Framework::HashMap<Framework::Text, Framework::RCPointer<Menu>> *menuRegister;
+variable UIInit uiFactory;
+variable Framework::HashMap<Framework::Text, Framework::RCPointer<Schrift>> *fontRegister;
+variable NetworkHandler *network;
+variable DLLRegister *dlls;
+variable World *currentGame;
+
+
+void initVariables();
+void initMenus();
+void releaseVariables();

+ 155 - 0
FactoryCraft/Initialisierung.cpp

@@ -0,0 +1,155 @@
+#include "Initialisierung.h"
+#include <ToolTip.h>
+#include <Bildschirm.h>
+#include <MausEreignis.h>
+#include <DateiSystem.h>
+#include <Fenster.h>
+#include <Fortschritt.h>
+#include <Liste.h>
+#include "Globals.h"
+
+Knopf *initKnopf( int x, int y, int br, int hö, __int64 style, char *titel )
+{
+    Knopf *ret = uiFactory.createKnopf( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    ret->setText( titel );
+    return ret;
+}
+
+KontrollKnopf *initKontrollKnopf( int x, int y, int br, int hö, __int64 style, char *txt )
+{
+    KontrollKnopf *ret = uiFactory.createKontrollKnopf( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setText( txt );
+    ret->setSText( txt );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    return ret;
+}
+
+Fenster *initFenster( int x, int y, int br, int hö, __int64 style, char *titel )
+{
+    Fenster *ret = uiFactory.createFenster( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    if( ret->hatStyle( Fenster::Style::Titel ) )
+    {
+        ret->setTitel( titel );
+    }
+    return ret;
+}
+
+TextFeld *initTextFeld( int x, int y, int br, int hö, __int64 style, char *txt )
+{
+    TextFeld *ret = uiFactory.createTextFeld( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setText( txt );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    return ret;
+}
+
+BildZ *initBildZ( int x, int y, int br, int hö, __int64 style, Bild *b )
+{
+    BildZ *ret = uiFactory.createBildZ( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    if( b )
+        ret->setBildZ( b );
+    return ret;
+}
+
+AuswahlBox *initAuswahlBox( int x, int y, int br, int hö, __int64 style, std::initializer_list< char * > values )
+{
+    AuswahlBox *ret = uiFactory.createAuswahlBox( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    for( auto i = values.begin(); i != values.end(); i++ )
+        ret->addEintrag( *i );
+    return ret;
+}
+
+ObjTabelle *initObjTabelle( int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe )
+{
+    ObjTabelle *ret = uiFactory.createObjTabelle( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    for( auto i = spalten.begin(); i != spalten.end(); i++ )
+    {
+        ret->addSpalte( i->name );
+        ret->setSpaltenBreite( i->name, i->breite );
+        if( ( style | ObjTabelle::Style::SpaltenBreiteMin ) == style )
+            ret->setMinSpaltenBreite( i->name, i->minBreite );
+        if( ( style | ObjTabelle::Style::SpaltenBreiteMax ) == style )
+            ret->setMaxSpaltenBreite( i->name, i->maxBreite );
+        if( überschriftHöhe )
+        {
+            if( ret->getZeilenNummer( "Überschrift" ) < 0 )
+            {
+                ret->addZeile( 0, "Überschrift" );
+                ret->setZeilenHeight( 0, 20 );
+            }
+            ret->setZeichnungZ( i->name, "Überschrift", initTextFeld( 0, 0, i->breite, 20, TextFeld::Style::Text | TextFeld::Style::Center, i->name ) );
+        }
+    }
+    return ret;
+}
+
+LDiag *initLinienDiagramm( int x, int y, int br, int hö, __int64 style, DiagDaten *data )
+{
+    LDiag *ret = uiFactory.createLDiag( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    if( data )
+        ret->setDiagDatenZ( data );
+    return ret;
+}
+
+FBalken *initFBalken( int x, int y, int br, int hö, __int64 style )
+{
+    FBalken *ret = uiFactory.createFBalken( uiFactory.initParam );
+    ret->addStyle( style );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    return ret;
+}
+
+AuswahlListe *initAuswahlListe( int x, int y, int br, int hö, __int64 style, std::initializer_list< char * > values )
+{
+    AuswahlListe *ret = uiFactory.createAuswahlListe( uiFactory.initParam );
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    ret->addStyle( style );
+    for( auto i = values.begin(); i != values.end(); i++ )
+        ret->addEintrag( *i );
+    ret->update();
+    return ret;
+}
+
+ZeichnungHintergrund *initZeichnungHintergrund( int x, int y, int br, int hö, __int64 style, int farbe )
+{
+    ZeichnungHintergrund *ret = new ZeichnungHintergrund();
+    ret->setStyle( style );
+    ret->setHintergrundFarbe( farbe );
+    if( ret->hatStyle( ZeichnungHintergrund::Style::Rahmen ) )
+    {
+        ret->setRahmenBreite( 1 );
+        ret->setRahmenFarbe( 0xFF00FF00 );
+    }
+    ret->setPosition( x, y );
+    ret->setSize( br, hö );
+    return ret;
+}
+
+void initToolTip( Zeichnung *obj, const char *txt )
+{
+    obj->setToolTipText( txt, uiFactory.initParam.bildschirm, uiFactory.initParam.schrift );
+    obj->zToolTip()->addStyle( TextFeld::Style::Mehrzeilig );
+}

+ 28 - 0
FactoryCraft/Initialisierung.h

@@ -0,0 +1,28 @@
+#ifndef Initialisierung_H
+#define Initialisierung_H
+
+#include <Knopf.h>
+#include <Bild.h>
+#include <AuswahlBox.h>
+#include <Tabelle.h>
+#include <Diagramm.h>
+#include <initializer_list>
+
+using namespace Framework;
+
+struct OBJTabelleSpalteIni
+{
+    char *name;
+    int breite;
+    int minBreite;
+    int maxBreite;
+};
+
+Knopf *initKnopf( int x, int y, int br, int hö, __int64 style, char *titel );
+KontrollKnopf *initKontrollKnopf( int x, int y, int br, int hö, __int64 style, char *txt );
+TextFeld *initTextFeld( int x, int y, int br, int hö, __int64 style, char *txt );
+AuswahlBox *initAuswahlBox( int x, int y, int br, int hö, __int64 style, std::initializer_list< char * > values );
+ObjTabelle *initObjTabelle( int x, int y, int br, int hö, __int64 style, std::initializer_list< OBJTabelleSpalteIni > spalten, int überschriftHöhe );
+LDiag *initLinienDiagramm( int x, int y, int br, int hö, __int64 style, DiagDaten *data );
+
+#endif

+ 26 - 0
FactoryCraft/Inventory.h

@@ -0,0 +1,26 @@
+#pragma once
+
+#include <Vec3.h>
+#include <ReferenceCounter.h>
+#include <HashMap.h>
+
+#include "ItemSlot.h"
+#include "Area.h"
+
+class ItemFilter;
+class Inventory;
+
+class Inventory : public virtual Framework::ReferenceCounter
+{
+private:
+    Framework::RCArray<ItemSlot> *pullSlotsOrder;
+    Framework::RCArray<ItemSlot> *pushSlotsOrder;
+
+protected:
+    Framework::Vec3<float> location;
+    virtual void loadInventory( Framework::StreamReader *zReader );
+
+public:
+    Inventory( const Framework::Vec3<float> location );
+    virtual ~Inventory();
+};

+ 33 - 0
FactoryCraft/Inventoty.cpp

@@ -0,0 +1,33 @@
+#include "Inventory.h"
+#include "Area.h"
+
+using namespace Framework;
+
+
+Inventory::Inventory( const Framework::Vec3<float> location )
+{
+    pullSlotsOrder = new Framework::RCArray<ItemSlot>();
+    pushSlotsOrder = new Framework::RCArray<ItemSlot>();
+}
+
+Inventory::~Inventory()
+{
+    pullSlotsOrder->release();
+    pushSlotsOrder->release();
+}
+
+void Inventory::loadInventory( Framework::StreamReader *zReader )
+{
+    for( auto iterator = pushSlotsOrder->getIterator(); iterator; iterator++ )
+    {
+        int size = 0;
+        zReader->lese( (char *)&size, 4 );
+        if( size != 0 )
+        {
+            int id = 0;
+            zReader->lese( (char *)&id, 4 );
+            Item *item = StaticRegistry<ItemType>::INSTANCE.zElement( id )->loadItem( zReader );
+            iterator->addItems( new ItemStack( item, size ), NO_DIRECTION );
+        }
+    }
+}

+ 73 - 0
FactoryCraft/Item.cpp

@@ -0,0 +1,73 @@
+#include "Item.h"
+
+
+Item::Item( const ItemType *zType, const char *name )
+    : ReferenceCounter(),
+    zType( zType ),
+    damage( 0 ),
+    maxDamage( 0 ),
+    durability( 0 ),
+    maxDurability( 0 ),
+    eatable( 0 ),
+    placeable( 0 ),
+    equippable( 0 ),
+    solid( 1 ),
+    usable( 0 ),
+    maxStackSize( 50 ),
+    name( name )
+{}
+
+const ItemType *Item::zItemType() const
+{
+    return zType;
+}
+
+float Item::getDamage() const
+{
+    return damage;
+}
+
+float Item::getDurability() const
+{
+    return durability;
+}
+
+bool Item::isUsable() const
+{
+    return usable;
+}
+
+bool Item::isEatable() const
+{
+    return eatable;
+}
+
+bool Item::isPlaceable() const
+{
+    return placeable;
+}
+
+bool Item::isEquippable() const
+{
+    return equippable;
+}
+
+bool Item::isSolid() const
+{
+    return solid;
+}
+
+float Item::getMaxDurability() const
+{
+    return maxDurability;
+}
+
+int Item::getMaxStackSize() const
+{
+    return maxStackSize;
+}
+
+float Item::getMaxDamage() const
+{
+    return maxDamage;
+}

+ 40 - 0
FactoryCraft/Item.h

@@ -0,0 +1,40 @@
+#pragma once
+
+#include "ItemType.h"
+#include "Reader.h"
+
+class ItemType;
+
+class Item : public virtual Framework::ReferenceCounter
+{
+protected:
+    const ItemType *zType;
+    float damage;
+    float maxDamage;
+    float durability;
+    float maxDurability;
+    bool eatable;
+    bool placeable;
+    bool equippable;
+    bool solid;
+    bool usable;
+    int maxStackSize;
+    Framework::Text name;
+    Item( const ItemType *zType, const char *name );
+
+public:
+
+    const ItemType *zItemType() const;
+    float getDamage() const;
+    float getDurability() const;
+    bool isUsable() const;
+    bool isEatable() const;
+    bool isPlaceable() const;
+    bool isEquippable() const;
+    bool isSolid() const;
+    float getMaxDurability() const;
+    int getMaxStackSize() const;
+    float getMaxDamage() const;
+
+    friend ItemType;
+};

+ 13 - 0
FactoryCraft/ItemSlot.cpp

@@ -0,0 +1,13 @@
+#include "ItemSlot.h"
+
+
+ItemSlot::ItemSlot( int maxSize, int pullPriority, int pushPriority, int allowedPullSide, int allowedPushSides, bool allowHigherStackSize )
+    : ReferenceCounter(),
+    items( 0 ),
+    maxSize( maxSize ),
+    allowedPullSide( allowedPullSide ),
+    allowedPushSides( allowedPushSides ),
+    pullPriority( pullPriority ),
+    pushPriority( pushPriority ),
+    allowHigherStackSize( allowHigherStackSize )
+{}

+ 19 - 0
FactoryCraft/ItemSlot.h

@@ -0,0 +1,19 @@
+#pragma once
+
+#include "ItemStack.h"
+#include "Area.h"
+
+class ItemSlot : public virtual Framework::ReferenceCounter
+{
+private:
+    ItemStack *items;
+    int maxSize;
+    Directions allowedPullSide;
+    Directions allowedPushSides;
+    int pullPriority;
+    int pushPriority;
+    bool allowHigherStackSize;
+
+public:
+    ItemSlot( int maxSize, int pullPriority, int pushPriority, int allowedPullSide, int allowedPushSides, bool allowHigherStackSize );
+};

+ 24 - 0
FactoryCraft/ItemStack.cpp

@@ -0,0 +1,24 @@
+#include "ItemStack.h"
+#include "Item.h"
+
+
+ItemStack::ItemStack( Item *item, int currentSize, int maxSize )
+    : ReferenceCounter(),
+    item( item ),
+    size( currentSize ),
+    maxSize( maxSize )
+{}
+
+ItemStack::ItemStack( Item *item, int currentSize )
+    : ItemStack( item, currentSize, item->getMaxStackSize() )
+{}
+
+int ItemStack::getSize() const
+{
+    return size;
+}
+
+int ItemStack::getMaxSize() const
+{
+    return maxSize;
+}

+ 18 - 0
FactoryCraft/ItemStack.h

@@ -0,0 +1,18 @@
+#pragma once
+
+#include "Item.h"
+
+class ItemStack : public virtual Framework::ReferenceCounter
+{
+private:
+    Item *item;
+    int size;
+    int maxSize;
+
+public:
+    ItemStack( Item *item, int currentSize, int maxSize );
+    ItemStack( Item *item, int currentSize );
+
+    int getSize() const;
+    int getMaxSize() const;
+};

+ 55 - 0
FactoryCraft/ItemType.cpp

@@ -0,0 +1,55 @@
+
+#include <InMemoryBuffer.h>
+
+#include "ItemType.h"
+#include "ItemStack.h"
+
+ItemType::ItemType( int id )
+    : ReferenceCounter(),
+    id( id )
+{
+    StaticRegistry<ItemType>::INSTANCE.registerT( this, id );
+}
+
+ItemType::~ItemType()
+{}
+
+void ItemType::loadSuperItem( Item *zItem, Framework::StreamReader *zReader ) const
+{
+    zReader->lese( (char *)&zItem->damage, 4 );
+    zReader->lese( (char *)&zItem->maxDamage, 4 );
+    zReader->lese( (char *)&zItem->durability, 4 );
+    zReader->lese( (char *)&zItem->maxDurability, 4 );
+    unsigned char flags = 0;
+    zReader->lese( (char *)&flags, 1 );
+    zItem->eatable = ( flags | 1 ) == flags;
+    zItem->placeable = ( flags | 2 ) == flags;
+    zItem->equippable = ( flags | 4 ) == flags;
+    zItem->solid = ( flags | 8 ) == flags;
+    zItem->usable = ( flags | 16 ) == flags;
+    zReader->lese( (char *)&zItem->maxStackSize, 1 );
+    unsigned char len = 0;
+    zReader->lese( (char *)&len, 1 );
+    zItem->name.fillText( ' ', len );
+    zReader->lese( zItem->name, len );
+}
+
+int ItemType::getId() const
+{
+    return id;
+}
+
+ItemStack *ItemType::createItemStack( int size ) const
+{
+    Item *item = createItem();
+    if( !item )
+        return 0;
+    return new ItemStack( item, MIN( size, item->getMaxStackSize() ) );
+}
+
+Item *ItemType::loadItem( Framework::StreamReader *zReader ) const
+{
+    Item *item = createItem();
+    loadSuperItem( item, zReader );
+    return item;
+}

+ 31 - 0
FactoryCraft/ItemType.h

@@ -0,0 +1,31 @@
+#pragma once
+
+#include <Text.h>
+#include <JSON.h>
+#include <Trie.h>
+#include <Writer.h>
+
+#include "StaticRegistry.h"
+
+class Item;
+class ItemStack;
+class ItemSkill;
+class ItemSkillLevelUpRule;
+
+class ItemType : public virtual Framework::ReferenceCounter
+{
+protected:
+    const int id;
+
+    ItemType( int id );
+
+    virtual void loadSuperItem( Item *zItem, Framework::StreamReader *zReader ) const;
+
+public:
+    ~ItemType();
+
+    int getId() const;
+    virtual Item *createItem() const = 0;
+    virtual ItemStack *createItemStack( int size ) const;
+    virtual Item *loadItem( Framework::StreamReader *zReader ) const;
+};

+ 35 - 0
FactoryCraft/Login.cpp

@@ -0,0 +1,35 @@
+#include "Login.h"
+#include "Initialisierung.h"
+#include "Globals.h"
+
+LoginMenu::LoginMenu( Bildschirm *zScreen )
+    : Menu( zScreen )
+{
+    elements.add( initTextFeld( 10, 10, 90, 20, TextFeld::Style::Text, "Name: " ) );
+    elements.add( initTextFeld( 10, 35, 90, 20, TextFeld::Style::Text, "Passwort: " ) );
+    name = initTextFeld( 100, 10, 200, 20, TextFeld::Style::TextFeld, "" );
+    password = initTextFeld( 100, 35, 200, 20, TextFeld::Style::TextFeld, "" );
+    password->setSchowChar( '*' );
+    elements.add( name );
+    elements.add( password );
+    Knopf *login = initKnopf( 200, 60, 100, 20, Knopf::Style::Normal, "Login" );
+    login->setMausEreignis( [this, login]( void *p, void *o, MausEreignis me )
+    {
+        if( me.id == ME_RLinks )
+        {
+            login->removeStyle( Knopf::Style::Erlaubt );
+            name->removeStyle( TextFeld::Style::Erlaubt );
+            password->removeStyle( TextFeld::Style::Erlaubt );
+            if( network->login( name->zText()->getText(), password->zText()->getText() ) )
+            {
+                hide();
+                menuRegister->get( "directConnect" )->show();
+            }
+            name->addStyle( TextFeld::Style::Erlaubt );
+            password->addStyle( TextFeld::Style::Erlaubt );
+            login->addStyle( Knopf::Style::Erlaubt );
+        }
+        return 1;
+    } );
+    elements.add( login );
+}

+ 15 - 0
FactoryCraft/Login.h

@@ -0,0 +1,15 @@
+#pragma once
+
+#include <TextFeld.h>
+
+#include "Menu.h"
+
+class LoginMenu : public Menu
+{
+private:
+    TextFeld *name;
+    TextFeld *password;
+
+public:
+    LoginMenu( Bildschirm *zScreen );
+};

+ 65 - 0
FactoryCraft/Main.cpp

@@ -0,0 +1,65 @@
+#include <main.h>
+#include <Network.h>
+#include <HttpRequest.h>
+#include <JSON.h>
+#include <Fenster.h>
+#include <Bildschirm.h>
+#include <GraphicsApi.h>
+#include <RenderThread.h>
+#include <Datei.h>
+#include <Schrift.h>
+#include <DateiSystem.h>
+#include "Globals.h"
+
+
+int KSGStart Framework::Start( Framework::Startparam p )
+{
+    Network::Start( 10 );
+    initVariables();
+
+    Datei d;
+    d.setDatei( "data/schriften" );
+    auto list = d.getDateiListe();
+    for( auto fontFile = list->getIterator(); fontFile; fontFile++ )
+    {
+        LTDSDatei dat;
+        dat.setPfad( new Text( Text( "data/schriften/" ).operator+( fontFile->getText() ) ) );
+        dat.leseDaten();
+        Text *name = fontFile->getTeilText( 0, fontFile->getLength() - 5 );
+        fontRegister->put( *name, RCPointer<Schrift>::of( dat.ladeSchrift() ) );
+        name->release();
+    }
+    list->release();
+
+    WFenster window;
+    WNDCLASS wc = Framework::F_Normal( p.hinst );
+    wc.lpszClassName = "Factory Craft";
+    window.erstellen( WS_POPUPWINDOW, wc );
+    Monitor m = Framework::getMonitor( 0 );
+    window.setBounds( Punkt( m.x, m.y ), Punkt( m.breite, m.height ) );
+    window.setAnzeigeModus( SW_SHOWNORMAL );
+    window.setVSchließAktion( [&window]( void *p, void *f )
+    {
+        StopNachrichtenSchleife( window.getFensterHandle() );
+    } );
+    window.setMausAktion( _ret1ME );
+    window.setTastaturAktion( _ret1TE );
+    Bildschirm3D screen( dynamic_cast<WFenster *>( window.getThis() ), GraphicApiType::DIRECTX12 );
+    window.setBildschirm( dynamic_cast<Bildschirm *>( screen.getThis() ) );
+    screen.update();
+    screen.setdeckFarbe( 0 );
+
+    uiFactory = Framework::defaultUI( fontRegister->get( "normal" ), &screen );
+    initMenus();
+
+    RenderTh rTh;
+    rTh.setBildschirm( dynamic_cast<Bildschirm *>( screen.getThis() ) );
+
+    rTh.beginn();
+    StartNachrichtenSchleife();
+    rTh.beenden();
+
+    releaseVariables();
+    Network::Exit();
+    return 0;
+}

+ 23 - 0
FactoryCraft/Menu.cpp

@@ -0,0 +1,23 @@
+#include "Menu.h"
+
+
+Menu::Menu( Bildschirm *zScreen )
+    : ReferenceCounter(),
+    zScreen( zScreen )
+{}
+
+void Menu::show()
+{
+    for( auto i = elements.getIterator(); i; i++ )
+    {
+        zScreen->addMember( dynamic_cast<Zeichnung *>( i->getThis() ) );
+    }
+}
+
+void Menu::hide()
+{
+    for( auto i = elements.getIterator(); i; i++ )
+    {
+        zScreen->removeMember( dynamic_cast<Zeichnung *>( i->getThis() ) );
+    }
+}

+ 19 - 0
FactoryCraft/Menu.h

@@ -0,0 +1,19 @@
+#pragma once
+#include <Array.h>
+#include <Zeichnung.h>
+#include <Bildschirm.h>
+
+using namespace Framework;
+
+class Menu : public ReferenceCounter
+{
+protected:
+    RCArray<Zeichnung> elements;
+    Bildschirm *zScreen;
+
+public:
+    Menu( Bildschirm *zScreen );
+
+    void show();
+    void hide();
+};

+ 44 - 0
FactoryCraft/Menü.h

@@ -0,0 +1,44 @@
+#ifndef Menü_H
+#define Menü_H
+
+#include <Knopf.h>
+#include <Tabelle.h>
+#include <Diagramm.h>
+#include <AuswahlBox.h>
+#include <KSGNetwork.h>
+#include <Rahmen.h>
+
+using namespace Framework;
+
+class Menü
+{
+private:
+	Knopf *spielen;
+	Knopf *optionen;
+	Knopf *statistik;
+	Knopf *beenden;
+	Bild *hintergrund;
+	LRahmen *ram;
+	bool beendet;
+	int status;
+	int ref;
+
+public:
+	// Konstruktor
+	Menü( Schrift *zSchrift, Bildschirm *zScreen, KSGClient::MinigameServerClient *klient );
+	// Destruktor
+	~Menü();
+	// nicht constant#
+	void reset();
+	void doMausEreignis( MausEreignis &me );
+	void doTastaturEreignis( TastaturEreignis &te );
+	bool tick( double z );
+	void render( Bild &zRObj );
+	// constant
+	bool istBeendet() const;
+	// Reference Counting
+	Menü *getThis();
+	Menü *release();
+};
+
+#endif

+ 103 - 0
FactoryCraft/NetworkHandler.cpp

@@ -0,0 +1,103 @@
+#include <InitDatei.h>
+
+#include "NetworkHandler.h"
+#include "Globals.h"
+
+NetworkHandler::NetworkHandler()
+    : ReferenceCounter()
+{
+    HINSTANCE dll = dlls->ladeDLL( "KSGClient", "data/bin/KSGNetwork.dll" );
+    if( !dll )
+        throw "DLL not found: 'data/bin/KSGNetwork.dll'";
+    KSGClient::KSGNetworkCreateMain getMainClient = (KSGClient::KSGNetworkCreateMain)GetProcAddress( dll, KSGNETWORK_CREATE_MAIN );
+    if( !getMainClient )
+        throw "Entry point '" KSGNETWORK_CREATE_MAIN "' not found in DLL 'data/bin/KSGNetwork.dll'";
+    msc = getMainClient();
+    if( !msc )
+        throw "Could not create Main Server Client from DLL 'data/bin/KSGNetwork.dll'";
+    InitDatei *iDat = new InitDatei( "data/optionen.ini" );
+    iDat->laden();
+    if( !iDat->zWert( "ServerIP" ) )
+        iDat->addWert( "ServerIP", "127.0.0.1" );
+    if( !iDat->zWert( "ServerPort" ) )
+        iDat->addWert( "ServerPort", "4225" );
+    iDat->speichern();
+    Text *ipT = iDat->zWert( "ServerIP" );
+    unsigned short port = (unsigned short)TextZuInt( iDat->zWert( "ServerPort" )->getText(), 10 );
+    esc = 0;
+    if( msc->registerSSL( ipT->getText(), port ) )
+    {
+        esc = msc->createErhaltungServerClient();
+        esc->verbinde();
+    }
+    iDat->release();
+    fc = 0;
+    lsc = 0;
+    gsc = 0;
+}
+
+NetworkHandler::~NetworkHandler()
+{
+    if( gsc )
+    {
+        gsc->release();
+        gsc = 0;
+    }
+    if( fc )
+        fc->release();
+    if( esc )
+    {
+        esc->abmelden();
+        esc->release();
+    }
+    if( lsc )
+    {
+        lsc->logout();
+        lsc->release();
+    }
+    if( msc )
+    {
+        msc->unregister();
+        msc->release();
+    }
+}
+
+bool NetworkHandler::login( Framework::Text name, Framework::Text password )
+{
+    if( !lsc )
+        lsc = msc->createLoginServerClient();
+    else
+    {
+        if( gsc )
+        {
+            gsc->release();
+            gsc = 0;
+        }
+        lsc->logout();
+    }
+    return lsc->login( name, password );
+}
+
+bool NetworkHandler::connect( Text ip, short port )
+{
+    if( !gsc )
+        gsc = msc->createMinigameServerClient();
+    Text *secret = gsc->getSecret();
+    bool ok = fc->connect( ip, port, lsc->getAccountId(), *secret );
+    secret->release();
+    return ok;
+}
+
+FactoryClient *NetworkHandler::zFactoryClient() const
+{
+    return fc;
+}
+
+bool NetworkHandler::leaveGame()
+{
+    if( fc )
+    {
+        fc->release();
+        fc = 0;
+    }
+}

+ 24 - 0
FactoryCraft/NetworkHandler.h

@@ -0,0 +1,24 @@
+#pragma once
+
+#include <ReferenceCounter.h>
+#include "KSGNetwork.h"
+#include "FactoryClient.h"
+
+class NetworkHandler : public virtual Framework::ReferenceCounter
+{
+private:
+    KSGClient::MainServerClient *msc;
+    KSGClient::LoginServerClient *lsc;
+    KSGClient::MinigameServerClient *gsc;
+    KSGClient::ErhaltungServerClient *esc;
+    FactoryClient *fc;
+
+public:
+    NetworkHandler();
+    ~NetworkHandler();
+
+    bool login( Framework::Text name, Framework::Text password );
+    bool connect( Text ip, short port );
+    FactoryClient *zFactoryClient() const;
+    bool leaveGame();
+};

+ 20 - 0
FactoryCraft/StaticInitializerOrder.h

@@ -0,0 +1,20 @@
+#pragma once
+#include "StaticRegistry.h"
+//#include "BlockType.h"
+//#include "ItemType.h"
+
+int count_DimensionGenerator = 0;
+int count_ItemType = 0;
+int count_BlockType = 0;
+int count_WorldUpdateType = 0;
+int count_EntityType = 0;
+
+#undef REGISTER
+#define REGISTER(c, typ)               \
+const int c::ID = count_##typ++;       \
+const c *c::INSTANCE = new c(); 
+
+//#include "BasicBlocks.h"
+//#include "OverworldDimension.h"
+#include "AddChunkUpdate.h"
+//#include "Player.h"

+ 74 - 0
FactoryCraft/StaticRegistry.h

@@ -0,0 +1,74 @@
+#pragma once
+
+#define REGISTRABLE( c )          \
+public:                           \
+    static const c *INSTANCE;     \
+    static const int ID;          \
+                                  \
+private:
+
+#define REGISTER(c, typ)
+
+
+template<typename T>
+class StaticRegistry
+{
+public:
+    static StaticRegistry<T> INSTANCE;
+
+private:
+    T **registry;
+    int count;
+
+    StaticRegistry()
+    {
+        count = 100;
+        registry = new T * [ count ];
+        memset( registry, 0, sizeof( T * ) * count );
+    }
+
+    ~StaticRegistry()
+    {
+        for( int index = 0; index < count; index++ )
+        {
+            if( registry[ index ] )
+            {
+                registry[ index ]->release();
+                registry[ index ] = 0;
+            }
+        }
+        delete[]registry;
+    }
+
+    void registerT( T *type, int id )
+    {
+        if( id >= count )
+        {
+            T **temp = new T * [ id + 1 ];
+            memcpy( temp, registry, sizeof( T * ) * count );
+            memset( temp + count, 0, sizeof( T * ) * ( id + 1 - count ) );
+            delete[]registry;
+            registry = temp;
+            count = id + 1;
+        }
+        registry[ id ] = type;
+    }
+
+public:
+    T *zElement( int id )
+    {
+        if( id < 0 || id >= count )
+            return 0;
+        return registry[ id ];
+    }
+
+    int getCount() const
+    {
+        return count;
+    }
+
+    friend T;
+};
+
+template <typename T>
+StaticRegistry<T> StaticRegistry<T>::INSTANCE;

+ 43 - 0
FactoryCraft/World.cpp

@@ -0,0 +1,43 @@
+#include <Network.h>
+#include <Welt3D.h>
+#include "World.h"
+#include "Globals.h"
+#include "WorldUpdate.h"
+
+using namespace Network;
+using namespace Framework;
+
+World::World()
+{
+    renderedWorld = new Welt3D();
+    dimensions = new RCArray<Dimension>();
+    currentPlayer = new CurrentPlayer();
+}
+
+World::~World()
+{
+    dimensions->release();
+    currentPlayer->release();
+    renderedWorld->release();
+}
+
+void World::update()
+{
+    NetworkReader *serverMessageReader = 0;
+    const char type = 0;
+    while( serverMessageReader = network->zFactoryClient()->getNextMessage() )
+    {
+        serverMessageReader->lese( (char *)&type, 1 );
+        if( type == 2 ) // WORLD UPDATE
+        {
+            int id = 0;
+            serverMessageReader->lese( (char *)&id, 4 );
+            StaticRegistry<WorldUpdateType>::INSTANCE.zElement( id )->applyUpdate( serverMessageReader );
+        }
+    }
+}
+
+void World::setChunk( Chunk *chunk )
+{
+
+}

+ 18 - 0
FactoryCraft/World.h

@@ -0,0 +1,18 @@
+#pragma once
+
+#include "Dimension.h"
+#include "CurrentPlayer.h"
+
+class World : public Framework::ReferenceCounter
+{
+private:
+    Framework::RCArray<Dimension> *dimensions;
+    CurrentPlayer *currentPlayer;
+    Welt3D *renderedWorld;
+
+public:
+    World();
+    ~World();
+    void update();
+    void setChunk( Chunk *chunk );
+};

+ 7 - 0
FactoryCraft/WorldUpdate.cpp

@@ -0,0 +1,7 @@
+#include "WorldUpdate.h"
+
+WorldUpdateType::WorldUpdateType( int id )
+    : ReferenceCounter()
+{
+    StaticRegistry<WorldUpdateType>::INSTANCE.registerT( this, id );
+}

+ 15 - 0
FactoryCraft/WorldUpdate.h

@@ -0,0 +1,15 @@
+#pragma once
+
+#include <ReferenceCounter.h>
+#include <Reader.h>
+
+#include "StaticRegistry.h"
+
+class WorldUpdateType : public Framework::ReferenceCounter
+{
+protected:
+    WorldUpdateType( int id );
+
+public:
+    virtual void applyUpdate( Framework::StreamReader *zReader ) = 0;
+};