SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TrackSector Class Reference

This object keeps track of which sector an object is on. More...

#include <track_sector.hpp>

Inheritance diagram for TrackSector:
Inheritance graph
[legend]

Public Member Functions

 TrackSector ()
 Initialises the object, and sets the current graph node to be undefined.
 
void reset ()
 
void rescue ()
 Sets current and last valid graph node to the rescue location.
 
void update (const Vec3 &xyz, bool ignore_vertical=false)
 Updates the current graph node index, and the track coordinates for the specified point.
 
float getRelativeDistanceToCenter () const
 Returns the relative distance of the corresponding kart from the center, i.e.
 
float getDistanceFromStart (bool account_for_checklines, bool strict=false) const
 Returns how far the the object is from the start line.
 
float getDistanceToCenter () const
 Returns the distance to the centre driveline.
 
int getCurrentGraphNode () const
 Returns the current graph node.
 
bool isOnRoad () const
 Returns if this object is on the road (driveline).
 
void setLastTriggeredCheckline (int i)
 
int getLastTriggeredCheckline () const
 
int getLastValidGraphNode () const
 
void saveState (BareNetworkString *buffer) const
 Only basket ball is used for rewind for TrackSector so save the minimum.
 
void rewindTo (BareNetworkString *buffer)
 
void saveCompleteState (BareNetworkString *bns)
 Save completely for spectating in linear race.
 
void restoreCompleteState (const BareNetworkString &b)
 

Private Attributes

int m_current_graph_node
 The graph node the object is on.
 
int m_estimated_valid_graph_node
 The index of the estimated valid graph node.
 
int m_last_valid_graph_node
 The index of the last valid graph node.
 
Vec3 m_current_track_coords
 The coordinates of this object on the track, i.e.
 
Vec3 m_estimated_valid_track_coords
 
Vec3 m_latest_valid_track_coords
 
bool m_on_road
 True if the object is on the road (driveline), or not.
 
int m_last_triggered_checkline
 

Detailed Description

This object keeps track of which sector an object is on.

A sector is actually just the graph node (it's called sector to better distinguish the graph node from say xml node and scene node). An object that has a track sector can determine how far away it is from the start line, how far away it is from the center driveline. If the object is not actually on part of the quad graph, it will determine the closest sector it is to, and set a flag (!isOnRoad). This object will also keep track on the last valid sector an object was on, which is used to reset a kart in case of a rescue.

Member Function Documentation

◆ getRelativeDistanceToCenter()

float TrackSector::getRelativeDistanceToCenter ( ) const

Returns the relative distance of the corresponding kart from the center, i.e.

a value between -1 and 1 inclusive.

Returns
THe relative distance between -1.0f and +1.0f;

◆ update()

void TrackSector::update ( const Vec3 xyz,
bool  ignore_vertical = false 
)

Updates the current graph node index, and the track coordinates for the specified point.

Parameters
xyzThe new coordinates to search the graph node for.

Member Data Documentation

◆ m_current_track_coords

Vec3 TrackSector::m_current_track_coords
private

The coordinates of this object on the track, i.e.

how far from the start of the track, and how far to the left or right of the center driveline.

◆ m_estimated_valid_graph_node

int TrackSector::m_estimated_valid_graph_node
private

The index of the estimated valid graph node.

Used for distance.

◆ m_last_valid_graph_node

int TrackSector::m_last_valid_graph_node
private

The index of the last valid graph node.

Used for rescue


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