Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
Serializer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
8
26namespace Serializer {
28 std::string msz(int x, int y);
30 std::string bct(int x, int y, const Resources& r);
32 std::string tna(const std::string& teamName);
33
35 std::string pnw(int id, int x, int y, Orientation o, int level, const std::string& team);
37 std::string ppo(int id, int x, int y, Orientation o);
39 std::string plv(int id, int level);
41 std::string pin(int id, int x, int y, const Resources& r);
43 std::string pex(int id);
45 std::string pbc(int id, const std::string& msg);
48 std::string pic(int x, int y, int level, const std::vector<int>& ids);
51 std::string pie(int x, int y, bool success);
53 std::string pfk(int id);
55 std::string pdr(int id, int resourceIndex);
57 std::string pgt(int id, int resourceIndex);
59 std::string pdi(int id);
60
62 std::string enw(int eggId, int playerId, int x, int y);
65 std::string sse(int eggId, const std::string& teamName, int x, int y);
67 std::string ebo(int eggId);
69 std::string edi(int eggId);
70
72 std::string sgt(int freq);
74 std::string sst(int freq);
77 std::string stu(int seconds, long long ticks);
80 std::string gwt(const std::string& team, int seconds, long long ticks);
81
83 std::string seg(const std::string& team);
85 std::string smg(const std::string& msg);
87 std::string suc();
89 std::string sbp();
90} // namespace Serializer
Orientation
Represents the resources available in the game, including food and various minerals.
Definition Resources.hpp:17
Generates all 24 server-to-GUI wire strings.
std::string sbp()
Bad command parameter from GUI. Wire: sbp\n
std::string pdr(int id, int resourceIndex)
Player drops resource resourceIndex (0..6). Wire: pdr #N i\n
std::string pin(int id, int x, int y, const Resources &r)
Player inventory. Wire: pin #N X Y q q q q q q q\n
std::string msz(int x, int y)
Map size. Wire: msz X Y\n
std::string sst(int freq)
Reply to "sst": frequency was changed to F. Wire: sst F\n
std::string seg(const std::string &team)
End of game, team won. Wire: seg NAME\n
std::string tna(const std::string &teamName)
Team name (one per team). Wire: tna NAME\n
std::string sgt(int freq)
Reply to "sgt": current time unit frequency. Wire: sgt F\n
std::string pex(int id)
Player expelled (got ejected). Wire: pex #N\n
std::string suc()
Unknown command from GUI (sent on unparseable line). Wire: suc\n
std::string edi(int eggId)
Egg died. Wire: edi #E\n
std::string ebo(int eggId)
Egg hatched, player connects from it. Wire: ebo #E\n
std::string gwt(const std::string &team, int seconds, long long ticks)
std::string bct(int x, int y, const Resources &r)
Tile content (resources on it). Wire: bct X Y q q q q q q q\n
std::string sse(int eggId, const std::string &teamName, int x, int y)
std::string stu(int seconds, long long ticks)
std::string pgt(int id, int resourceIndex)
Player takes resource resourceIndex (0..6). Wire: pgt #N i\n
std::string pfk(int id)
Player lays an egg (fork). Wire: pfk #N\n
std::string pie(int x, int y, bool success)
std::string pbc(int id, const std::string &msg)
Player broadcast. Wire: pbc #N MESSAGE\n
std::string ppo(int id, int x, int y, Orientation o)
Player position. Wire: ppo #N X Y O\n
std::string smg(const std::string &msg)
Server message to all GUIs. Wire: smg MESSAGE\n
std::string pnw(int id, int x, int y, Orientation o, int level, const std::string &team)
New player connected. Wire: pnw #N X Y O L NAME\n (L = level)
std::string pdi(int id)
Player death. Wire: pdi #N\n
std::string enw(int eggId, int playerId, int x, int y)
Egg laid by a player. Wire: enw #E #N X Y\n (E = egg, N = parent)
std::string plv(int id, int level)
Player level. Wire: plv #N L\n
std::string pic(int x, int y, int level, const std::vector< int > &ids)