Codechange: Move Ticks into their own class

This commit is contained in:
Tyler Trahan
2023-08-16 09:01:24 -04:00
parent 30172fc037
commit fca2b37726
34 changed files with 132 additions and 116 deletions

View File

@@ -12,6 +12,7 @@
#include "../window_func.h"
#include "../company_base.h"
#include "../company_gui.h"
#include "../timer/timer_game_tick.h"
#include "../timer/timer_game_calendar.h"
#include "../viewport_func.h"
#include "../zoom_func.h"
@@ -221,7 +222,7 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
ConstEdge &edge = lg[ge.node][to->goods[c].node];
this->AddStats(c, lg.Monthly(edge.capacity), lg.Monthly(edge.usage),
ge.flows.GetFlowVia(to->index),
edge.TravelTime() / DAY_TICKS,
edge.TravelTime() / Ticks::DAY_TICKS,
from->owner == OWNER_NONE || to->owner == OWNER_NONE,
this->cached_links[from->index][to->index]);
}

View File

@@ -2,6 +2,7 @@
#include "../stdafx.h"
#include "../core/math_func.hpp"
#include "../timer/timer_game_tick.h"
#include "mcf.h"
#include "../safeguards.h"
@@ -290,7 +291,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
IsCargoInClass(this->job.Cargo(), CC_EXPRESS);
uint distance = DistanceMaxPlusManhattan(this->job[from].base.xy, this->job[to].base.xy) + 1;
/* Compute a default travel time from the distance and an average speed of 1 tile/day. */
uint time = (edge.base.TravelTime() != 0) ? edge.base.TravelTime() + DAY_TICKS : distance * DAY_TICKS;
uint time = (edge.base.TravelTime() != 0) ? edge.base.TravelTime() + Ticks::DAY_TICKS : distance * Ticks::DAY_TICKS;
uint distance_anno = express ? time : distance;
Tannotation *dest = static_cast<Tannotation *>(paths[to]);

View File

@@ -234,7 +234,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
if (this->is_full_loading && this->vehicle->orders != nullptr &&
st->index == vehicle->last_station_visited &&
this->vehicle->orders->GetTotalDuration() >
(Ticks)this->vehicle->current_order_time) {
(TimerGameTick::Ticks)this->vehicle->current_order_time) {
uint effective_capacity = cargo_quantity * this->vehicle->load_unload_ticks;
if (effective_capacity > (uint)this->vehicle->orders->GetTotalDuration()) {
IncreaseStats(st, c, next_station, effective_capacity /