18#ifndef HEADER_LINEAR_WORLD_HPP
19#define HEADER_LINEAR_WORLD_HPP
21#include "modes/world_with_rank.hpp"
22#include "utils/aligned_array.hpp"
44 bool m_last_lap_sfx_playing;
52 core::stringw m_fastest_lap_kart_name;
72 float m_finish_timeout;
143 virtual void init() OVERRIDE;
146 virtual
void update(
int ticks) OVERRIDE;
149 bool account_for_checklines) const;
150 void updateTrackSectors();
154 int getLapForKart(const
int kart_id) const;
155 int getTicksAtLapForKart(const
int kart_id) const;
160 std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE;
165 virtual
void reset(
bool restart=false) OVERRIDE;
166 virtual
void newLap(
unsigned int kart_index) OVERRIDE;
186 void setLastTriggeredCheckline(
unsigned int kart_index,
int index);
205 return m_fastest_lap_kart_name;
223 m_fastest_lap_kart_name = name;
238 void handleServerCheckStructureCount(
unsigned count);
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
Some additional info that needs to be kept for each kart in this kind of race.
Definition: linear_world.hpp:85
int m_lap_start_ticks
Time at start of a new lap.
Definition: linear_world.hpp:94
float m_overall_distance
How far the kart has travelled (this is (number-of-laps-1) times track-length plus distance-along-tra...
Definition: linear_world.hpp:101
float m_wrong_way_timer
Accumulates the time a kart has been driving in the wrong direction so that a message can be displaye...
Definition: linear_world.hpp:105
int m_ticks_at_last_lap
Time at finishing last lap.
Definition: linear_world.hpp:91
void reset()
Re-initialises all data.
Definition: linear_world.hpp:111
KartInfo()
Initialises all fields.
Definition: linear_world.hpp:108
int m_finished_laps
Number of finished laps.
Definition: linear_world.hpp:88
float m_estimated_finish
During last lap only: estimated finishing time!
Definition: linear_world.hpp:97
Definition: linear_world.hpp:36
virtual bool useChecklineRequirements() const OVERRIDE
Override settings from base class.
Definition: linear_world.hpp:176
virtual bool haveBonusBoxes() OVERRIDE
Returns if this race mode has bonus items.
Definition: linear_world.hpp:173
float getDistanceToCenterForKart(const int kart_id) const
Gets the distance of the kart from the center of the driveline.
Definition: linear_world.cpp:579
virtual void updateGraphics(float dt) OVERRIDE
This updates all only graphical elements.It is only called once per rendered frame,...
Definition: linear_world.cpp:304
virtual std::pair< uint32_t, uint32_t > getGameStartedProgress() const OVERRIDE
Used by server to get the current started game progress in either or both remaining time or progress ...
Definition: linear_world.cpp:1114
float m_distance_increase
The track length returned by Track::getLength() only covers the distance from start line to finish li...
Definition: linear_world.hpp:61
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE
Determines the rescue position for a kart.
Definition: linear_world.cpp:821
bool m_last_lap_sfx_played
Last lap sfx should only be played once.
Definition: linear_world.hpp:42
virtual void update(int ticks) OVERRIDE
General update function called once per frame.
Definition: linear_world.cpp:174
virtual void reset(bool restart=false) OVERRIDE
Called before a race is started (or restarted).
Definition: linear_world.cpp:107
float getOverallDistance(unsigned int kart_index) const
Returns how far the kart has driven so far (i.e.
Definition: linear_world.hpp:191
float getDistanceDownTrackForKart(const int kart_id, bool account_for_checklines) const
Returns the distance the kart has travelled along the track since crossing the start line.
Definition: linear_world.cpp:569
stringw getFastestLapKartName() const
Returns the kart name that made the fastest lap time.
Definition: linear_world.hpp:203
virtual btTransform getRescueTransform(unsigned int index) const OVERRIDE
Returns the bullet transformation for the specified rescue index.
Definition: linear_world.cpp:843
void setFastestKartName(const stringw &name)
Network use: set fastest kart name.
Definition: linear_world.hpp:221
virtual void checkForWrongDirection(unsigned int i, float dt)
Checks if a kart is going in the wrong direction.
Definition: linear_world.cpp:1046
virtual bool raceHasLaps() OVERRIDE
Returns if this race mode has laps.
Definition: linear_world.hpp:170
SFXBase * m_last_lap_sfx
Sfx for the final lap.
Definition: linear_world.hpp:39
virtual void init() OVERRIDE
call just after instanciating.
Definition: linear_world.cpp:78
int m_fastest_lap_ticks
The fastest lap time, in ticks of physics dt.
Definition: linear_world.hpp:50
bool m_check_structure_compatible
True if clients and server has the same check structure.
Definition: linear_world.hpp:47
bool m_valid_reference_time
True if the live_time_difference is invalid.
Definition: linear_world.hpp:69
void updateLiveDifference()
This calculate the time difference between the second kart in the race (there must be at least two) a...
Definition: linear_world.cpp:337
std::vector< KartInfo > m_kart_info
This vector contains an 'KartInfo' struct for every kart in the race.
Definition: linear_world.hpp:133
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE
Returns the number of rescue positions on a given track, which in linear races is just the number of ...
Definition: linear_world.cpp:815
void updateCheckLinesServer(int check_id, int kart_id)
Called in server whenever a kart cross a check line, it send server current kart lap count,...
Definition: linear_world.cpp:1221
int getFinishedLapsOfKart(unsigned int kart_index) const OVERRIDE
Returns the number of laps a kart has completed.
Definition: linear_world.hpp:180
virtual void getKartsDisplayInfo(std::vector< RaceGUIBase::KartIconDisplayInfo > *info) OVERRIDE
Called by the code that draws the list of karts on the race GUI to know what needs to be drawn in the...
Definition: linear_world.cpp:609
void updateRacePosition()
Find the position (rank) of every kart.
Definition: linear_world.cpp:864
float m_live_time_difference
This stores the live time difference between a ghost kart and a second kart racing against it (normal...
Definition: linear_world.hpp:66
void setFastestLapTicks(int ticks)
Network use: set fastest lap in ticks.
Definition: linear_world.hpp:215
virtual float estimateFinishTimeForKart(AbstractKart *kart) OVERRIDE
Estimate the arrival time of any karts that haven't arrived yet by using their average speed up to no...
Definition: linear_world.cpp:743
LinearWorld()
Constructs the linear world.
Definition: linear_world.cpp:61
int getFastestLapTicks() const
Network use: get fastest lap in ticks.
Definition: linear_world.hpp:209
virtual void newLap(unsigned int kart_index) OVERRIDE
Is called by check structures if a kart starts a new lap.
Definition: linear_world.cpp:376
float getEstimatedFinishTime(const int kart_id) const
Returns the estimated finishing time.
Definition: linear_world.cpp:595
float getFastestLap() const
Returns time for the fastest laps.
Definition: linear_world.hpp:197
virtual bool showLapsTarget() OVERRIDE
If true lap counter shows lap count in format: 4/20 or if false then in format: 4.
Definition: linear_world.hpp:240
The base class for sound effects.
Definition: sfx_base.hpp:43
float ticks2Time(int ticks)
Converts a tick value (in physics time step size) into seconds.
Definition: stk_config.hpp:313
Represents a peer. This class is used to interface the ENetPeer structure.
Definition: stk_peer.hpp:76
A WorldWithRank is a world where the karts are ranked.
Definition: world_with_rank.hpp:39