nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::History Class Reference

#include <history.h>

Public Member Functions

void Record (uint32_t id, std::chrono::nanoseconds time, Place place)
std::optional< Place > At (uint32_t id, std::chrono::nanoseconds time) const
void Leave (uint32_t id)
 Forgets a player who's left.

Static Public Attributes

static constexpr std::chrono::seconds kKept {1}
 A second: more than any blow goes back.

Detailed Description

Where each player has been, a place a tick, for the last second, which a World keeps. A client draws everyone else a moment in the past, so a blow it aimed at a player can be checked against where that player was then, not where they are now.

Definition at line 18 of file history.h.

Member Function Documentation

◆ At()

std::optional< Place > nanommo::History::At ( uint32_t id,
std::chrono::nanoseconds time ) const

Where the player was at the time, between their places on either side of it. Before their oldest, it's that, and after their newest, that. Or nothing, for a player it has no places of.

Definition at line 20 of file history.cc.

◆ Leave()

void nanommo::History::Leave ( uint32_t id)

Forgets a player who's left.

Definition at line 42 of file history.cc.

◆ Record()

void nanommo::History::Record ( uint32_t id,
std::chrono::nanoseconds time,
Place place )

The player is at the place at the time, on the world's clock, which only goes on. Their places from more than kKept before it go.

Definition at line 12 of file history.cc.

Member Data Documentation

◆ kKept

std::chrono::seconds nanommo::History::kKept {1}
staticconstexpr

A second: more than any blow goes back.

Definition at line 21 of file history.h.


The documentation for this class was generated from the following files: