Edit: messed up the copy-and-paste of the Lua code
I hacked together something that... sorta works, as in, it does display an appropriate icon. Unfortunately the choice of icon is either so big you're basically not going to find it convenient with any other icons, or as small as the yield icons. And this is basically half-assed, as it can't be separately toggled like improvements can be, nor does it accomodate for any modded routes, perhaps even scenarios stuff (sorry, I couldn't be arsed to do that).
XML:
<!-- YieldIconManager.xml -->
<Instance Name="Route" >
<Image ID="Route" Size="256,256" Sampler="Linear" />
</Instance>
I added a call to UpdateRoute whenever UpdateImprovement was called without analyzing the behaviour much.
Code:
--YieldIconManager.lua
include "IconHookup"
local IconHookup = IconHookup
local function UpdateRoute( anchor, plot )
--I figured there's no point in dislaying road icon over a city, remove these three lines if you think otherwise
if plot:IsCity() then
return
end
local iconRow = anchor.Row0
local icon = anchor.Route
local iconIndex = nil
if (plot:GetRevealedRouteType( GetActiveTeam() )==0) then
iconIndex = 40
elseif (plot:GetRevealedRouteType( GetActiveTeam() )==1) then
iconIndex = 41
end
if iconIndex then
if icon then
icon:SetHide( false )
else
if not iconRow then
ContextPtr:BuildInstanceForControlAtIndex( "Row0", anchor, anchor.Stack, 0 )
iconRow = anchor.Row0
end
ContextPtr:BuildInstanceForControlAtIndex( "Route", anchor, iconRow, 0 )
icon = anchor.Route
end
IconHookup( iconIndex, 256, "TERRAIN_ATLAS", icon )
elseif icon then
icon:SetHide( true )
else
return
end
iconRow:CalculateSize()
return anchor.Stack:ReprocessAnchoring()
end