Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -74,7 +74,7 @@ void LinkGraph::Compress()
|
||||
if (edge.capacity < (1 << 16)) {
|
||||
edge.travel_time_sum = edge.travel_time_sum * new_capacity / edge.capacity;
|
||||
} else if (edge.travel_time_sum != 0) {
|
||||
edge.travel_time_sum = std::max<uint64>(1, edge.travel_time_sum / 2);
|
||||
edge.travel_time_sum = std::max<uint64_t>(1, edge.travel_time_sum / 2);
|
||||
}
|
||||
edge.capacity = new_capacity;
|
||||
edge.usage /= 2;
|
||||
@@ -164,14 +164,14 @@ NodeID LinkGraph::AddNode(const Station *st)
|
||||
* @param usage Usage to be added.
|
||||
* @param mode Update mode to be used.
|
||||
*/
|
||||
void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(!this->HasEdgeTo(to));
|
||||
|
||||
BaseEdge &edge = *this->edges.emplace(std::upper_bound(this->edges.begin(), this->edges.end(), to), to);
|
||||
edge.capacity = capacity;
|
||||
edge.usage = usage;
|
||||
edge.travel_time_sum = static_cast<uint64>(travel_time) * capacity;
|
||||
edge.travel_time_sum = static_cast<uint64_t>(travel_time) * capacity;
|
||||
if (mode & EUM_UNRESTRICTED) edge.last_unrestricted_update = TimerGameCalendar::date;
|
||||
if (mode & EUM_RESTRICTED) edge.last_restricted_update = TimerGameCalendar::date;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32 t
|
||||
* @param usage Usage to be added.
|
||||
* @param mode Update mode to be used.
|
||||
*/
|
||||
void LinkGraph::BaseNode::UpdateEdge(NodeID to, uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseNode::UpdateEdge(NodeID to, uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(capacity > 0);
|
||||
assert(usage <= capacity);
|
||||
@@ -214,25 +214,25 @@ void LinkGraph::BaseNode::RemoveEdge(NodeID to)
|
||||
* @param travel_time Travel time to be added, in ticks.
|
||||
* @param mode Update mode to be applied.
|
||||
*/
|
||||
void LinkGraph::BaseEdge::Update(uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseEdge::Update(uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(this->capacity > 0);
|
||||
assert(capacity >= usage);
|
||||
|
||||
if (mode & EUM_INCREASE) {
|
||||
if (this->travel_time_sum == 0) {
|
||||
this->travel_time_sum = static_cast<uint64>(this->capacity + capacity) * travel_time;
|
||||
this->travel_time_sum = static_cast<uint64_t>(this->capacity + capacity) * travel_time;
|
||||
} else if (travel_time == 0) {
|
||||
this->travel_time_sum += this->travel_time_sum / this->capacity * capacity;
|
||||
} else {
|
||||
this->travel_time_sum += static_cast<uint64>(travel_time) * capacity;
|
||||
this->travel_time_sum += static_cast<uint64_t>(travel_time) * capacity;
|
||||
}
|
||||
this->capacity += capacity;
|
||||
this->usage += usage;
|
||||
} else if (mode & EUM_REFRESH) {
|
||||
if (this->travel_time_sum == 0) {
|
||||
this->capacity = std::max(this->capacity, capacity);
|
||||
this->travel_time_sum = static_cast<uint64>(travel_time) * this->capacity;
|
||||
this->travel_time_sum = static_cast<uint64_t>(travel_time) * this->capacity;
|
||||
} else if (capacity > this->capacity) {
|
||||
this->travel_time_sum = this->travel_time_sum / this->capacity * capacity;
|
||||
this->capacity = capacity;
|
||||
|
Reference in New Issue
Block a user