|
Zappy Server
C++ game server: world, rules, scheduler, network
|
Generates all 24 server-to-GUI wire strings. More...
Functions | |
| std::string | msz (int x, int y) |
Map size. Wire: msz X Y\n | |
| 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 | tna (const std::string &teamName) |
Team name (one per team). Wire: tna NAME\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 | ppo (int id, int x, int y, Orientation o) |
Player position. Wire: ppo #N X Y O\n | |
| std::string | plv (int id, int level) |
Player level. Wire: plv #N L\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 | pex (int id) |
Player expelled (got ejected). Wire: pex #N\n | |
| std::string | pbc (int id, const std::string &msg) |
Player broadcast. Wire: pbc #N MESSAGE\n | |
| std::string | pic (int x, int y, int level, const std::vector< int > &ids) |
| std::string | pie (int x, int y, bool success) |
| std::string | pfk (int id) |
Player lays an egg (fork). Wire: pfk #N\n | |
| std::string | pdr (int id, int resourceIndex) |
Player drops resource resourceIndex (0..6). Wire: pdr #N i\n | |
| std::string | pgt (int id, int resourceIndex) |
Player takes resource resourceIndex (0..6). Wire: pgt #N i\n | |
| 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 | sse (int eggId, const std::string &teamName, int x, int y) |
| std::string | ebo (int eggId) |
Egg hatched, player connects from it. Wire: ebo #E\n | |
| std::string | edi (int eggId) |
Egg died. Wire: edi #E\n | |
| std::string | sgt (int freq) |
Reply to "sgt": current time unit frequency. Wire: sgt F\n | |
| std::string | sst (int freq) |
Reply to "sst": frequency was changed to F. Wire: sst F\n | |
| std::string | stu (int seconds, long long ticks) |
| std::string | gwt (const std::string &team, int seconds, long long ticks) |
| std::string | seg (const std::string &team) |
End of game, team won. Wire: seg NAME\n | |
| std::string | smg (const std::string &msg) |
Server message to all GUIs. Wire: smg MESSAGE\n | |
| std::string | suc () |
Unknown command from GUI (sent on unparseable line). Wire: suc\n | |
| std::string | sbp () |
Bad command parameter from GUI. Wire: sbp\n | |
Generates all 24 server-to-GUI wire strings.
Inverse of the GUI's ProtocolParser. All functions are pure – they just return a formatted string with a trailing newline. Broadcasting to sockets is GuiNotifier's job. Function names match the protocol commands 1:1.
#N player or egg id, always prefixed with '#' (e.g. "#3").O orientation as an int 1..4 (N=1, E=2, S=3, W=4).q... a resource block: 7 space-separated quantities in fixed order food linemate deraumere sibur mendiane phiras thystame.| std::string Serializer::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
Definition at line 13 of file Serializer.cpp.
Referenced by CommandDispatcher::_handleBct(), CommandDispatcher::_handleMct(), HandshakeHandler::_promoteToGui(), GuiNotifier::onResourceDropped(), GuiNotifier::onResourceTaken(), and GuiNotifier::onTileChanged().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::ebo | ( | int | eggId | ) |
Egg hatched, player connects from it. Wire: ebo #E\n
Definition at line 82 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onEggHatched().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::edi | ( | int | eggId | ) |
Egg died. Wire: edi #E\n
Definition at line 83 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onEggDied().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::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)
Definition at line 72 of file Serializer.cpp.
Referenced by HandshakeHandler::_promoteToGui(), and GuiNotifier::onEggLaid().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::gwt | ( | const std::string & | team, |
| int | seconds, | ||
| long long | ticks | ||
| ) |
CUSTOM (non-standard): authoritative time team took to win, sent once right after seg. Wire: gwt NAME SECONDS TICKS\n.
Definition at line 92 of file Serializer.cpp.
References n().
Referenced by Server::_handleGameOver().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::msz | ( | int | x, |
| int | y | ||
| ) |
Map size. Wire: msz X Y\n
Definition at line 11 of file Serializer.cpp.
References n().
Referenced by CommandDispatcher::_handleMsz(), and HandshakeHandler::_promoteToGui().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pbc | ( | int | id, |
| const std::string & | msg | ||
| ) |
Player broadcast. Wire: pbc #N MESSAGE\n
Definition at line 41 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onBroadcast().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pdi | ( | int | id | ) |
Player death. Wire: pdi #N\n
Definition at line 70 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onPlayerRemoved().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pdr | ( | int | id, |
| int | resourceIndex | ||
| ) |
Player drops resource resourceIndex (0..6). Wire: pdr #N i\n
Definition at line 60 of file Serializer.cpp.
Referenced by GuiNotifier::onResourceDropped().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pex | ( | int | id | ) |
Player expelled (got ejected). Wire: pex #N\n
Definition at line 39 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onPlayerEjected().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pfk | ( | int | id | ) |
Player lays an egg (fork). Wire: pfk #N\n
Definition at line 58 of file Serializer.cpp.
References id().
Referenced by GuiNotifier::onEggLaid().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pgt | ( | int | id, |
| int | resourceIndex | ||
| ) |
Player takes resource resourceIndex (0..6). Wire: pgt #N i\n
Definition at line 65 of file Serializer.cpp.
Referenced by GuiNotifier::onResourceTaken().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pic | ( | int | x, |
| int | y, | ||
| int | level, | ||
| const std::vector< int > & | ids | ||
| ) |
Incantation start. ids = all participating player IDs. Wire: pic X Y L #N1 #N2 ...\n
Definition at line 46 of file Serializer.cpp.
References n().
Referenced by GuiNotifier::onIncantationStart().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::pie | ( | int | x, |
| int | y, | ||
| bool | success | ||
| ) |
Incantation end. success maps to 1 (success) or 0 (failure). Wire: pie X Y R\n
Definition at line 53 of file Serializer.cpp.
References n().
Referenced by GuiNotifier::onIncantationEnd().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::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
Definition at line 34 of file Serializer.cpp.
References id(), n(), and res().
Referenced by CommandDispatcher::_handlePin(), and GuiNotifier::onPlayerInventoryChanged().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::plv | ( | int | id, |
| int | level | ||
| ) |
Player level. Wire: plv #N L\n
Definition at line 32 of file Serializer.cpp.
Referenced by CommandDispatcher::_handlePlv(), and GuiNotifier::onPlayerLevelUp().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::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)
Definition at line 20 of file Serializer.cpp.
Referenced by HandshakeHandler::_promoteToGui(), and GuiNotifier::onPlayerAdded().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::ppo | ( | int | id, |
| int | x, | ||
| int | y, | ||
| Orientation | o | ||
| ) |
Player position. Wire: ppo #N X Y O\n
Definition at line 27 of file Serializer.cpp.
Referenced by CommandDispatcher::_handlePpo(), and GuiNotifier::onPlayerMoved().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::sbp | ( | ) |
Bad command parameter from GUI. Wire: sbp\n
Definition at line 101 of file Serializer.cpp.
| std::string Serializer::seg | ( | const std::string & | team | ) |
End of game, team won. Wire: seg NAME\n
Definition at line 97 of file Serializer.cpp.
Referenced by GuiNotifier::onGameEnd().
Here is the caller graph for this function:| std::string Serializer::sgt | ( | int | freq | ) |
Reply to "sgt": current time unit frequency. Wire: sgt F\n
Definition at line 85 of file Serializer.cpp.
References n().
Referenced by CommandDispatcher::_handleSgt(), and HandshakeHandler::_promoteToGui().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::smg | ( | const std::string & | msg | ) |
Server message to all GUIs. Wire: smg MESSAGE\n
Definition at line 98 of file Serializer.cpp.
| std::string Serializer::sse | ( | int | eggId, |
| const std::string & | teamName, | ||
| int | x, | ||
| int | y | ||
| ) |
CUSTOM (non-standard): announces an initial team egg spawned at game start. Wire: sse #E NAME X Y\n
Definition at line 77 of file Serializer.cpp.
Referenced by HandshakeHandler::_promoteToGui(), and GuiNotifier::onInitialEggSpawned().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::sst | ( | int | freq | ) |
Reply to "sst": frequency was changed to F. Wire: sst F\n
Definition at line 86 of file Serializer.cpp.
References n().
Referenced by CommandDispatcher::_handleSst().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::stu | ( | int | seconds, |
| long long | ticks | ||
| ) |
CUSTOM (non-standard): elapsed game time. Wire: stu SECONDS TICKS\n SECONDS is wall uptime (freq-independent), TICKS is freq-integrated game time.
Definition at line 87 of file Serializer.cpp.
References n().
Referenced by CommandDispatcher::_handleStu().
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Serializer::suc | ( | ) |
Unknown command from GUI (sent on unparseable line). Wire: suc\n
Definition at line 100 of file Serializer.cpp.
| std::string Serializer::tna | ( | const std::string & | teamName | ) |
Team name (one per team). Wire: tna NAME\n
Definition at line 18 of file Serializer.cpp.
Referenced by CommandDispatcher::_handleTna(), and HandshakeHandler::_promoteToGui().
Here is the caller graph for this function: