Merge branch 'master' into jgrpp
# Conflicts: # src/airport_gui.cpp # src/blitter/32bpp_anim_sse4.cpp # src/console_cmds.cpp # src/linkgraph/linkgraph_gui.cpp # src/newgrf_object.h # src/road_gui.cpp # src/widgets/road_widget.h # src/window.cpp
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "../company_gui.h"
|
||||
#include "../date_func.h"
|
||||
#include "../viewport_func.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../smallmap_gui.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../landscape.h"
|
||||
@@ -399,8 +400,9 @@ void LinkGraphOverlay::Draw(const DrawPixelInfo *dpi)
|
||||
*/
|
||||
void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const
|
||||
{
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
for (LinkList::const_iterator i(this->cached_links.begin()); i != this->cached_links.end(); ++i) {
|
||||
if (!this->IsLinkVisible(i->from_pt, i->to_pt, dpi, this->scale + 2)) continue;
|
||||
if (!this->IsLinkVisible(i->from_pt, i->to_pt, dpi, width + 2)) continue;
|
||||
if (!Station::IsValidID(i->from_id)) continue;
|
||||
if (!Station::IsValidID(i->to_id)) continue;
|
||||
this->DrawContent(i->from_pt, i->to_pt, i->prop);
|
||||
@@ -417,20 +419,21 @@ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &c
|
||||
{
|
||||
uint usage_or_plan = std::min(cargo.capacity * 2 + 1, std::max(cargo.usage, cargo.planned));
|
||||
int colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS[0]) / (cargo.capacity * 2 + 2)];
|
||||
int dash = cargo.shared ? this->scale * 4 : 0;
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
int dash = cargo.shared ? width * 4 : 0;
|
||||
|
||||
/* Move line a bit 90° against its dominant direction to prevent it from
|
||||
* being hidden below the grey line. */
|
||||
int side = _settings_game.vehicle.road_side ? 1 : -1;
|
||||
if (abs(pta.x - ptb.x) < abs(pta.y - ptb.y)) {
|
||||
int offset_x = (pta.y > ptb.y ? 1 : -1) * side * this->scale;
|
||||
GfxDrawLine(pta.x + offset_x, pta.y, ptb.x + offset_x, ptb.y, colour, this->scale, dash);
|
||||
int offset_x = (pta.y > ptb.y ? 1 : -1) * side * width;
|
||||
GfxDrawLine(pta.x + offset_x, pta.y, ptb.x + offset_x, ptb.y, colour, width, dash);
|
||||
} else {
|
||||
int offset_y = (pta.x < ptb.x ? 1 : -1) * side * this->scale;
|
||||
GfxDrawLine(pta.x, pta.y + offset_y, ptb.x, ptb.y + offset_y, colour, this->scale, dash);
|
||||
int offset_y = (pta.x < ptb.x ? 1 : -1) * side * width;
|
||||
GfxDrawLine(pta.x, pta.y + offset_y, ptb.x, ptb.y + offset_y, colour, width, dash);
|
||||
}
|
||||
|
||||
GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, _colour_gradient[COLOUR_GREY][1], this->scale);
|
||||
GfxDrawLine(pta.x, pta.y, ptb.x, ptb.y, _colour_gradient[COLOUR_GREY][1], width);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,14 +442,15 @@ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &c
|
||||
*/
|
||||
void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const
|
||||
{
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
for (StationSupplyList::const_iterator i(this->cached_stations.begin()); i != this->cached_stations.end(); ++i) {
|
||||
const Point &pt = i->pt;
|
||||
if (!this->IsPointVisible(pt, dpi, 3 * this->scale)) continue;
|
||||
if (!this->IsPointVisible(pt, dpi, 3 * width)) continue;
|
||||
|
||||
const Station *st = Station::GetIfValid(i->id);
|
||||
if (st == nullptr) continue;
|
||||
|
||||
uint r = this->scale * 2 + this->scale * 2 * std::min<uint>(200, i->quantity) / 200;
|
||||
uint r = width * 2 + width * 2 * std::min<uint>(200, i->quantity) / 200;
|
||||
|
||||
LinkGraphOverlay::DrawVertex(pt.x, pt.y, r,
|
||||
_colour_gradient[st->owner != OWNER_NONE ?
|
||||
|
Reference in New Issue
Block a user