3static std::string
id(
int n) {
return "#" + std::to_string(
n); }
4static std::string
n(
int v) {
return std::to_string(v); }
15 return "bct " +
n(x) +
" " +
n(y) +
" " +
res(r) +
"\n";
18std::string
Serializer::tna(
const std::string& teamName) {
return "tna " + teamName +
"\n"; }
21 const std::string& team)
23 return "pnw " +
id(pid) +
" " +
n(x) +
" " +
n(y) +
" " +
n(
static_cast<int>(o)) +
" " +
24 n(level) +
" " + team +
"\n";
29 return "ppo " +
id(pid) +
" " +
n(x) +
" " +
n(y) +
" " +
n(
static_cast<int>(o)) +
"\n";
32std::string
Serializer::plv(
int pid,
int level) {
return "plv " +
id(pid) +
" " +
n(level) +
"\n"; }
36 return "pin " +
id(pid) +
" " +
n(x) +
" " +
n(y) +
" " +
res(r) +
"\n";
43 return "pbc " +
id(pid) +
" " + msg +
"\n";
48 std::string s =
"pic " +
n(x) +
" " +
n(y) +
" " +
n(level);
49 for (
int pid : ids) s +=
" " +
id(pid);
55 return "pie " +
n(x) +
" " +
n(y) +
" " + (success ?
"1" :
"0") +
"\n";
62 return "pdr " +
id(pid) +
" " +
n(resourceIndex) +
"\n";
67 return "pgt " +
id(pid) +
" " +
n(resourceIndex) +
"\n";
74 return "enw " +
id(eggId) +
" " +
id(playerId) +
" " +
n(x) +
" " +
n(y) +
"\n";
79 return "sse " +
id(eggId) +
" " + teamName +
" " +
n(x) +
" " +
n(y) +
"\n";
89 return "stu " +
n(seconds) +
" " + std::to_string(ticks) +
"\n";
94 return "gwt " + team +
" " +
n(seconds) +
" " + std::to_string(ticks) +
"\n";
97std::string
Serializer::seg(
const std::string& team) {
return "seg " + team +
"\n"; }
98std::string
Serializer::smg(
const std::string& msg) {
return "smg " + msg +
"\n"; }
static std::string id(int n)
static std::string res(const Resources &r)
static std::string n(int v)
Represents the resources available in the game, including food and various minerals.
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)