123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #pragma once
- #include <Text.h>
- #include <Punkt.h>
- #include <Thread.h>
- #include "Dimension.h"
- #include "Player.h"
- #include "WorldGenerator.h"
- #include "Constants.h"
- #include "WorldUpdate.h"
- #include "WorldLoader.h"
- #include "TickOrganizer.h"
- #include "Server.h"
- #include "InMemoryBuffer.h"
- class FCKlient;
- class GameClient : public virtual Framework::ReferenceCounter
- {
- private:
- Player *zPlayer;
- FCKlient *client;
- NetworkWriter writer;
- CriticalSection cs;
- RCArray<InMemoryBuffer> requests;
- bool online;
- public:
- GameClient( Player *zPlayer, FCKlient *client );
- ~GameClient();
- void sendWorldUpdate( WorldUpdate *zUpdate );
- void reply( Game *zGame );
- void logout();
- void addMessage( StreamReader *reader );
- bool isOnline() const;
- Player *zEntity() const;
- private:
- class Message
- {
- public:
- static const unsigned char WORLD_UPDATE = 2;
- };
- };
- class Game : public virtual Framework::Thread
- {
- private:
- Framework::Text name;
- Framework::RCArray<Dimension> *dimensions;
- Framework::RCArray<WorldUpdate> *updates;
- Framework::RCArray<GameClient> *clients;
- WorldGenerator *generator;
- WorldLoader *loader;
- TickOrganizer *ticker;
- Framework::Text path;
- bool stop;
- __int64 tickId;
- CriticalSection cs;
- void thread() override;
- public:
- Game( Framework::Text name, Framework::Text worldsDir );
- ~Game();
- void requestWorldUpdate( WorldUpdate *update );
- GameClient *addPlayer( FCKlient *client, Framework::Text name );
- bool doesChunkExist( int x, int y, int dimension ) const;
- Block *zBlockAt( Framework::Vec3<int> location, int dimension ) const;
- Dimension *zDimension( int id ) const;
- Framework::Punkt getChunkCenter( int x, int y ) const;
- Framework::Text getWorldDirectory() const;
- void requestArea( Area area );
- void save() const;
- void requestStop();
- void addDimension( Dimension *d );
- };
|