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

#include <paths.h>

Public Member Functions

 Paths (const Terrain &terrain)
std::vector< Place > Find (Place from, Place to)
bool Clear (Place from, Place to) const
bool Open (Place place) const
 Whether the square the place is in is one a player can walk on.
int searched () const
 How many squares the last search looked at.

Static Public Attributes

static constexpr float kSquare = 1.0f
 In metres along each side.
static constexpr int kMostSearched = 40000
 A little under a sixth of the island's squares.

Detailed Description

The ways across a land: which of its metre squares a player can walk on, and the shortest way from one place to another over them, which A* finds. A world finds a way each time a player asks to walk somewhere, between ticks, so a search looks at kMostSearched squares at most, and then goes as near as it got.

Definition at line 17 of file paths.h.

Constructor & Destructor Documentation

◆ Paths()

nanommo::Paths::Paths ( const Terrain & terrain)
explicit

Definition at line 30 of file paths.cc.

Member Function Documentation

◆ Clear()

bool nanommo::Paths::Clear ( Place from,
Place to ) const

Whether a straight walk from one place to the other stays on squares a player can walk on.

Definition at line 75 of file paths.cc.

◆ Find()

std::vector< Place > nanommo::Paths::Find ( Place from,
Place to )

The way from one place to the other: the places to walk to straight, one after the other, the last of them to, or the place nearest it that the search reached. Empty when there's no way to go: to isn't somewhere a player can stand, or from is off the land.

Definition at line 100 of file paths.cc.

◆ Open()

bool nanommo::Paths::Open ( Place place) const

Whether the square the place is in is one a player can walk on.

Definition at line 70 of file paths.cc.

◆ searched()

int nanommo::Paths::searched ( ) const
inline

How many squares the last search looked at.

Definition at line 41 of file paths.h.

Member Data Documentation

◆ kMostSearched

int nanommo::Paths::kMostSearched = 40000
staticconstexpr

A little under a sixth of the island's squares.

Definition at line 23 of file paths.h.

◆ kSquare

float nanommo::Paths::kSquare = 1.0f
staticconstexpr

In metres along each side.

Definition at line 20 of file paths.h.


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