00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <iostream>
00015 #include <fstream>
00016 #include <string>
00017 #include <vector>
00018 #include "netmanagerserver.h"
00019 #include "util.h"
00020 #include "tool.h"
00021 #include "tile.h"
00022 #include "splayer.h"
00023 using namespace std;
00024
00025 #ifndef __PERISERVER_H
00026 #define __PERISERVER_H
00027
00031 class SWorld {
00032 public:
00033
00037 SWorld();
00038
00042 ~SWorld();
00043
00047 bool parseMap(string & map);
00048
00052 void run();
00053
00054 private:
00055 vector<SPlayer> players;
00056 unsigned height;
00057 unsigned width;
00058 vector<Tile> map;
00059
00060
00061 int temperature;
00062 NetManagerServer net;
00063 string mapName;
00064
00065
00069 void upDatePlayerPos(unsigned ID, int pX, int pY, int d);
00070
00074 void addPlayer(unsigned index, string name, Race r, char color);
00075
00079 void addPlayer(const SPlayer& p);
00080
00084 void deletePlayer(unsigned i);
00085
00089 Tile& getTile(unsigned i, unsigned j);
00090
00094 void getNewClients();
00095
00099 void processMessage(string msg, int playerIndex);
00100
00108 void processMessagea(string c);
00109
00117 void processMessageb(string c);
00118
00126 void processMessagec(string c);
00127
00137 void processMessagef(string c);
00138
00149 void processMessageg(string c);
00150
00160 void processMessagei(string c, unsigned client);
00161
00169 void processMessagem(string c);
00170
00177 void processMessagen(string c);
00178
00185 void processMessageq(string c);
00186
00193 void processMessaget(string c, int playerIndex);
00194
00200 void processMessager(string c);
00201
00207 void processMessages(string c);
00208
00209
00215 void processMessagex(string c);
00216
00226 string buildMessageA(unsigned p, int x, int y, int d);
00227
00228 string buildMessageB(unsigned p, Resource r, char c, int a);
00229 string buildMessageC(unsigned p, ToolType t);
00230 string buildMessageD(ToolType t, int x, int y);
00231 string buildMessageE(Resource r, int x, int y);
00232 string buildMessageU();
00233 };
00234
00235 #endif