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

#include <predicted_bag.h>

Public Member Functions

 PredictedBag (const ItemTable &items)
protocol::Inventory Shown (const protocol::Inventory &server, float seconds)
void Act (const protocol::Inventory &server, const protocol::ItemAction &action)
 What the player asked for, done to the bag shown, if the rules allow it.
bool ahead () const

Static Public Attributes

static constexpr float kPatience = 1.0f
 In seconds.

Detailed Description

The bag a step ahead of the server: what the player just did with an item, done at once to a copy of the bag, by the rules the server keeps, so that an item lands the moment it's dropped, rather than a round trip later. Once the server's bag comes at a new revision, it's shown instead; if it doesn't come in time, as when the server refused, the copy goes, and the item's back where the server has it.

Definition at line 18 of file predicted_bag.h.

Constructor & Destructor Documentation

◆ PredictedBag()

nanommo::PredictedBag::PredictedBag ( const ItemTable & items)
inlineexplicit

Definition at line 23 of file predicted_bag.h.

Member Function Documentation

◆ Act()

void nanommo::PredictedBag::Act ( const protocol::Inventory & server,
const protocol::ItemAction & action )

What the player asked for, done to the bag shown, if the rules allow it.

Definition at line 21 of file predicted_bag.cc.

◆ ahead()

bool nanommo::PredictedBag::ahead ( ) const
inline

Definition at line 33 of file predicted_bag.h.

◆ Shown()

protocol::Inventory nanommo::PredictedBag::Shown ( const protocol::Inventory & server,
float seconds )

The bag to show, with the frame's seconds gone by: ours while we're ahead, or the server's.

Definition at line 8 of file predicted_bag.cc.

Member Data Documentation

◆ kPatience

float nanommo::PredictedBag::kPatience = 1.0f
staticconstexpr

In seconds.

Definition at line 21 of file predicted_bag.h.


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