|
Zappy Server
C++ game server: world, rules, scheduler, network
|
Bridges the Observer hooks to the Logger. More...
#include <LogObserver.hpp>
Inheritance diagram for LogObserver:
Collaboration diagram for LogObserver:Public Member Functions | |
| LogObserver (Logger &logger) | |
| void | onClientConnected (int connectionId) override |
A new client socket was accepted (assigned connectionId). | |
| void | onClientDisconnected (int connectionId) override |
| A client socket closed or errored. | |
| void | onLineReceived (int connectionId, const std::string &line) override |
| One complete ' '-terminated line arrived from the client. | |
| void | onLineSent (int connectionId, const std::string &line) override |
| One line was queued to be sent to the client. | |
| void | onPlayerAdded (int playerId, int x, int y, Orientation orientation, int level, const std::string &teamName) override |
| Player spawned (egg hatched or initial connection). -> pnw. | |
| void | onPlayerMoved (int playerId, int nx, int ny, Orientation newOrientation) override |
| Player changed tile and/or facing. -> ppo. | |
| void | onPlayerInventoryChanged (int playerId, int x, int y, Resources inventory) override |
| Player's carried resources changed. -> pin. | |
| void | onPlayerRemoved (int playerId) override |
| Player left (death or disconnect). -> pdi. | |
| void | onPlayerEjected (int playerId) override |
| Player got pushed off its tile by an eject. -> pex. | |
| void | onBroadcast (int playerId, const std::string &message) override |
| Player shouted a broadcast message. -> pbc. | |
| void | onResourceTaken (int playerId, ResourceType resourceType, int tileX, int tileY, Resources resources) override |
| Player picked a resource up off the tile. -> pgt (+ bct/pin) | |
| void | onResourceDropped (int playerId, ResourceType resourceType, int tileX, int tileY, Resources resources) override |
| Player dropped a resource onto the tile. -> pdr (+ bct/pin) | |
| void | onEggLaid (int eggId, int playerId, int x, int y) override |
| A player laid an egg via Fork. -> enw. | |
| void | onInitialEggSpawned (int eggId, const std::string &teamName, int x, int y) override |
| An initial team egg placed at game start (custom). -> sse. | |
| void | onEggHatched (int eggId) override |
| An egg hatched into a connectable slot. -> ebo. | |
| void | onEggDied (int eggId) override |
| An egg was destroyed (e.g. crushed by an eject). -> edi. | |
| void | onIncantationStart (int x, int y, int level, const std::vector< int > &participantIds) override |
Incantation began on a tile. participantIds = players involved. -> pic. | |
| void | onIncantationEnd (int x, int y, bool success) override |
Incantation finished, success = leveled up or not. -> pie. | |
| void | onPlayerLevelUp (int playerId, int newLevel) override |
| Player reached a new level. -> plv. | |
| void | onGameEnd (const std::string &winningTeam) override |
| A team won (6 players at max level). -> seg. | |
| void | onTileChanged (int x, int y, Resources resources) override |
| A tile's resource contents changed (e.g. respawn). -> bct. | |
Public Member Functions inherited from IWorldObserver | |
| virtual | ~IWorldObserver ()=default |
Public Member Functions inherited from INetworkObserver | |
| virtual | ~INetworkObserver ()=default |
Private Attributes | |
| Logger & | _logger |
Bridges the Observer hooks to the Logger.
Registered on both World (IWorldObserver) and ClientManager (INetworkObserver), so every world mutation and every raw protocol line is logged automatically, without scattering log calls across the game logic.
Raw I/O is logged at Debug; world events at Info.
Definition at line 19 of file LogObserver.hpp.
|
explicit |
Definition at line 27 of file LogObserver.cpp.
|
overridevirtual |
Player shouted a broadcast message. -> pbc.
Implements IWorldObserver.
Definition at line 80 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
overridevirtual |
A new client socket was accepted (assigned connectionId).
Implements INetworkObserver.
Definition at line 29 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
A client socket closed or errored.
Implements INetworkObserver.
Definition at line 34 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
An egg was destroyed (e.g. crushed by an eject). -> edi.
Implements IWorldObserver.
Definition at line 120 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
An egg hatched into a connectable slot. -> ebo.
Implements IWorldObserver.
Definition at line 115 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
A player laid an egg via Fork. -> enw.
Implements IWorldObserver.
Definition at line 103 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
A team won (6 players at max level). -> seg.
Implements IWorldObserver.
Definition at line 145 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Incantation finished, success = leveled up or not. -> pie.
Implements IWorldObserver.
Definition at line 133 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Incantation began on a tile. participantIds = players involved. -> pic.
Implements IWorldObserver.
Definition at line 125 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
An initial team egg placed at game start (custom). -> sse.
Implements IWorldObserver.
Definition at line 109 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
One complete '
'-terminated line arrived from the client.
Implements INetworkObserver.
Definition at line 39 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
overridevirtual |
One line was queued to be sent to the client.
Implements INetworkObserver.
Definition at line 44 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
overridevirtual |
Player spawned (egg hatched or initial connection). -> pnw.
Implements IWorldObserver.
Definition at line 49 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Player got pushed off its tile by an eject. -> pex.
Implements IWorldObserver.
Definition at line 75 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Player's carried resources changed. -> pin.
Implements IWorldObserver.
Definition at line 63 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
overridevirtual |
Player reached a new level. -> plv.
Implements IWorldObserver.
Definition at line 139 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Player changed tile and/or facing. -> ppo.
Implements IWorldObserver.
Definition at line 57 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
overridevirtual |
Player left (death or disconnect). -> pdi.
Implements IWorldObserver.
Definition at line 70 of file LogObserver.cpp.
References _logger, and Logger::info().
Here is the call graph for this function:
|
overridevirtual |
Player dropped a resource onto the tile. -> pdr (+ bct/pin)
Implements IWorldObserver.
Definition at line 94 of file LogObserver.cpp.
References _logger, Logger::debug(), and Resources::get_name().
Here is the call graph for this function:
|
overridevirtual |
Player picked a resource up off the tile. -> pgt (+ bct/pin)
Implements IWorldObserver.
Definition at line 85 of file LogObserver.cpp.
References _logger, Logger::debug(), and Resources::get_name().
Here is the call graph for this function:
|
overridevirtual |
A tile's resource contents changed (e.g. respawn). -> bct.
Implements IWorldObserver.
Definition at line 150 of file LogObserver.cpp.
References _logger, and Logger::debug().
Here is the call graph for this function:
|
private |
Definition at line 53 of file LogObserver.hpp.
Referenced by onBroadcast(), onClientConnected(), onClientDisconnected(), onEggDied(), onEggHatched(), onEggLaid(), onGameEnd(), onIncantationEnd(), onIncantationStart(), onInitialEggSpawned(), onLineReceived(), onLineSent(), onPlayerAdded(), onPlayerEjected(), onPlayerInventoryChanged(), onPlayerLevelUp(), onPlayerMoved(), onPlayerRemoved(), onResourceDropped(), onResourceTaken(), and onTileChanged().