35 }
catch (
const std::out_of_range&) {
45 }
catch (
const std::out_of_range&) {
55 }
catch (
const std::out_of_range&) {
70 static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(
gameElapsed()).count());
void send(int connectionId, const std::string &msg)
Queue msg to be sent to a client (flushed during poll()).
void _handleMct(int connectionId)
std::chrono::microseconds gameElapsed() const
Wall-clock time since server start (single source for stu and the win banner).
void _handleSst(int freq)
void _handlePlv(int connectionId, int playerId)
const ServerConfig & _config
void _handlePin(int connectionId, int playerId)
void _handleStu(int connectionId)
void _handleSgt(int connectionId)
void _handleMsz(int connectionId)
void _handleBct(int connectionId, int x, int y)
void _handleTna(int connectionId)
void _handlePpo(int connectionId, int playerId)
double ticks() const
Total ticks elapsed: integral of freq over time. Fractional by nature.
float setFreq(int newFreq)
Change frequency, banking ticks accrued at the old rate first.
void broadcast(const std::string &msg)
void rescale(float ratio)
Rescale all pending fire times by ratio.
Tile & at(int x, int y)
Access a tile by position. Map is toroidal, coordinates wrap.
Player & getPlayer(int id)
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 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 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 stu(int seconds, long long ticks)
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::vector< std::string > teamNames