I made a patch that visualizes the masked direction of way. This patch is made as a support patch of OTRP, but it works independently with OTRP.
The patch file is simutrans nightly r8275 based, and the patch can be easily integrated to the nightly trunk.
The patch is uploaded here. (https://drive.google.com/open?id=0B_rSte9xAhLDNVpQSU9LRmZtUFU) Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/ribi_arrow (https://github.com/teamhimeh/simutrans/tree/ribi_arrow)
The aim of this patch is visualizing direction of way as clear and simple as possible. To do this, I made tool_show_ribi, a simple tool that shows masked ribi of way. This tool puts arrows when it is called.
The arrow is a pak and the object class of the pak is misc. Its name is Ribi_Arrow. This object is required since this is a misc object. @Takamaro (https://twitter.com/cacapo2501) made a sample arrow addon and you can download it from here. (https://drive.google.com/open?id=0B_rSte9xAhLDanhta1ZsSVcwdzg) Also, we have to edit menuconf.tab to use this function. Add
simple_tool[36]=,:
# colon key is assigned to this function.
This patch is so useful when we build oneway roads. We can check very easily whether direction is set correctly.
(http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-07-28_%E5%8D%88%E5%BE%8C3.26.40.png)
I made OTRP binary with ribi arrow patch. The binary is r8275 based. Be sure that this requires misc.RibiArrow.pak!
win:https://drive.google.com/open?id=0B_rSte9xAhLDNXJvOXpBSkNMb1E (https://drive.google.com/open?id=0B_rSte9xAhLDNXJvOXpBSkNMb1E)
mac:https://drive.google.com/open?id=0B_rSte9xAhLDMzc4eGo4YmlTTUk (https://drive.google.com/open?id=0B_rSte9xAhLDMzc4eGo4YmlTTUk)
I like the idea a lot. ;D
This is fantastic! No kidding. :D
The sample addon for pak64 was not compiled correctly, so I fixed it 8)
You can download it from the same link.
Good idea! This could also help to trouble-shoot route-finding problems to find non-connected pieces of ways.
Could you also modify this to change ribis of overhead lines? i.e., when key ':' is pressed it cycles through the different modes.
Do you mean wayobj_t::dir? OK, I'll do that, but what is this parameter used for? It seems that this parameter, wayobj_t::dir, has no effect on routing.
yes, true. Forget about this request :)
What about a mode where general ribis on waytiles is shown, especially concerning the long time asked solution to the two unintentional endtiles making roads and rails unconnected, creating "no route" messages?
Quote from: Ves on July 29, 2017, 04:32:08 PM
What about a mode where general ribis on waytiles is shown, especially concerning the long time asked solution to the two unintentional endtiles making roads and rails unconnected, creating "no route" messages?
I create a code in "script" to solve this problem in the tutorial, but it is very long and does not work when there are interceptions.
(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1428&y=366&a=true&file=scrip_bord.png&t=WVeQguZ8IlGNHQV&scalingup=0)
I would be very happy with a simpler solution. 8)
Code:
function get_fullway(coora, coorb, dir, obj, tun=false)
{
local tilea = tile_x(coora.x,coora.y,coora.z)
local tileb = tile_x(coorb.x,coorb.y,coorb.z)
local way = tilea.find_object(mo_way)
if (!way)
return coora
if (obj){
if (obj == mo_wayobj){
if(!way.is_electrified()){
way.mark()
if (!tun)
label_x.create(coora, player_x(1), translate("Connect here!."))
return coora
}
else{
tilea.remove_object(player_x(1), mo_label)
way.unmark()
}
}
}
local r_dir = way_x(coora.x, coora.y, coora.z).get_dirs()
if (dir == 0) dir = c_dir(coora, coorb, r_dir)
local c_way = coora
local c_z = false
local ribi = 0
local vl = array(10)
vl[3]=3
vl[5]=5
vl[2]=2
vl[6]=6
if (dir==1){
if (r_dir==2 || r_dir==10)
dir=6
else if (r_dir==4 || r_dir==5)
dir=2
else if (r_dir==3){
tilea.find_object(mo_way).unmark()
dir=2
coora.y--
}
else if (r_dir==6){
tilea.find_object(mo_way).unmark()
dir=3
coora.y++
}
}
else if (dir==2){
if (r_dir==1)
coora.y--
}
else if (dir==3){
if (r_dir==4)
coora.y++
}
else if (dir==4){
if (r_dir==1 || r_dir==5)
dir=3
else if (r_dir==8 || r_dir==10)
dir=5
else if (r_dir==3){
tilea.find_object(mo_way).unmark()
dir=5
coora.x++
}
else if (r_dir==9){
tilea.find_object(mo_way).unmark()
dir=6
coora.x--
}
}
else if (dir==5){
if (r_dir==2)
coora.x++
}
else if (dir==6){
if (r_dir==8)
coora.x--
}
while(true){
local til = tile_x(coora.x,coora.y,coora.z)
local tunnel = til.find_object(mo_tunnel)
local bridge = til.find_object(mo_bridge)
local slope = til.get_slope()
local type = false
local t_type = false
local way = false
local ribi = false
if (!tunnel && !bridge){
coora.z = square_x(coora.x,coora.y).get_ground_tile().z
}
if (tun){
type = mo_tunnel
local height_min = -3
local height_max = my_tile(coord(coora.x, coora.y)).z
for(;height_max>=height_min;height_max--){
local tile = tile_x(coora.x, coora.y, height_max)
if (tile.is_tunnel()){
coora.z = height_max
break
}
}
}
local t = tile_x(coora.x, coora.y, coora.z)
if (t.find_object(mo_way))
type = mo_way
if (t.find_object(mo_tunnel))
type = mo_tunnel
if (t.find_object(mo_crossing))
type = mo_crossing
if (tun || obj)
type = mo_way
if (!type)
return coora
way = t.find_object(type)
ribi = t.find_object(mo_way).get_dirs()
if (obj){
if (obj == mo_wayobj){
if(!way.is_electrified()){
way.mark()
if (!tun)
label_x.create(coora, player_x(1), translate("Connect here!."))
return coora
}
else{
t.remove_object(player_x(1), mo_label)
way.unmark()
}
}
}
if(coora.x==coorb.x && coora.y==coorb.y && coora.z==coorb.z){
if (t_type)
way.unmark()
return 0
}
if ((ribi==1)||(ribi==2)||(ribi==4)||(ribi==8)){
local waymark = tile_x(glmark.x, glmark.y, glmark.z).find_object(type)
if (waymark){
waymark.unmark()
}
glmark = coord3d(coora.x, coora.y, coora.z)
way.mark()
return coora
}
else
way.unmark()
if (dir==2){
if (t.is_bridge()){
coora.y -= way_is_bridge(coora, 5)
continue
}
if (ribi==5){
coora.y--
continue
}
else if (ribi==6){
dir = vl[5]
coora.x++
continue
}
else if (ribi==12){
dir = vl[6]
coora.x--
continue
}
else if (ribi==14){
dir = vl[5]
coora.x++
continue
}
else if ((ribi==7 || ribi==11 || ribi==13 || ribi==15)){
coora.y--
continue
}
}
else if (dir==3){
if (t.is_bridge()){
coora.y += way_is_bridge(coora, 5)
continue
}
if (ribi==5){
coora.y++
continue
}
else if (ribi==3){
dir = vl[5]
coora.x++
continue
}
else if (ribi==9){
dir = vl[6]
coora.x--
continue
}
else if (ribi==11){
dir = vl[5]
coora.x++
continue
}
else if ((ribi==7 || ribi==13 || ribi==14 || ribi==15)){
coora.y++
continue
}
}
else if (dir==5){
if (t.is_bridge()){
coora.x += way_is_bridge(coora, 10)
continue
}
if (ribi==10){
coora.x++
continue
}
else if (ribi==12){
dir = vl[3]
coora.y++
continue
}
else if (ribi==9){
dir = vl[2]
coora.y--
continue
}
else if (ribi==13){
dir = vl[2]
coora.y--
continue
}
else if ((ribi==7 || ribi==11 || ribi==14 || ribi==15)){
coora.x++
continue
}
}
else if (dir==6){
if (t.is_bridge()){
coora.x -= way_is_bridge(coora, 10)
continue
}
if (ribi==10){
coora.x--
continue
}
else if (ribi==3){
dir = vl[2]
coora.y--
continue
}
else if (ribi==6){
dir = vl[3]
coora.y++
continue
}
else if (ribi==7){
dir = vl[3]
coora.y++
continue
}
else if ((ribi==11 || ribi==14 || ribi==15)){
coora.x--
continue
}
}
return coora
}
}
Quote from: THLeaderH on July 28, 2017, 06:40:44 AM
This patch is so useful when we build oneway roads. We can check very easily whether direction is set correctly.
I'd say it's a necessity for oneway roads!
Can the illusion that Simutrans has diagonals be maintained? i.e. Needs diagonal arrows.
The neighbouring tile checks required to do that should also make it simple to implement displaying a 'x' or something to highlight unconnected neighboring ways.
In the attached, the yellow arrow pointing the wrong way to the oneway road shouldn't be there; Depends on the order the roads are built - I guess ribis aren't always being set correctly.
Incoporated some time ago as part for showing reservations.
Quote from: TurfIt on August 01, 2017, 03:22:40 AMCan the illusion that Simutrans has diagonals be maintained? i.e. Needs diagonal arrows.
This patch has five major drawbacks:
(1) it cannot display diagonal arrows,
(2) the arrows become dark at night, making them very difficult to see.
(3) it cannot be used unless the pakset has arrow object
(4) The shape of the arrow may be difficult to see when zoomed out (IMO, Color-coding by direction to compensate for this is not a good solution.)
(5) The arrow will be displayed in front of the vehicle
Reservations are displayed in the order
Vehicle > Reservation > Way.
However, ribi_arrow is displayed in the priority order of
Arrow > Vehicle > Way.
(regarding (5), you may have implemented it in a different way than the original. I haven't checked the code.)
For the above reasons, extended has implemented a different method.
(https://i.imgur.com/2mkgEe0.png)
Asking for diagonal arrows for showing ribis blocked by signs that don't support diagonal graphics seems very odd to me.
Quote from: Leartin on May 25, 2024, 08:55:44 AMAsking for diagonal arrows for showing ribis blocked by signs that don't support diagonal graphics seems very odd to me.
IMO, the best solution (going forward) is to allow the addition of diagonal sign images...
Otherwise, based on your logic, I find it odd that non-diagonal signs can be placed on diagonal roads.
Quote from: Ranran on May 25, 2024, 09:05:02 AMIMO, the best solution (going forward) is to allow the addition of diagonal sign images...
Absolutely, glad you agree!
Quote from: Ranran on May 25, 2024, 09:05:02 AMOtherwise, based on your logic, I find it odd that non-diagonal signs can be placed on diagonal roads.
Functionality comes first, visuals later. Sometimes never. It's better to have a new functionality with lacking visuals, rather then not having it at all. If we freshly got the functionality to place signs on diagonal roads, I wouldn't find that odd at all, though I'd still ask for diagonal signs.
However, I'd only ask for diagonal signs if diagonal roads (not curves) already exist, else I'd find it odd, same as I find it odd to ask for diagonal arrows when diagonal signs don't exist.
Quote from: Ranran on May 25, 2024, 09:05:02 AMIMO, the best solution (going forward) is to allow the addition of diagonal sign images...
Yes i need this too.
I am working on new sign images, and make also some for diagonal.
I'm not quite done with it yet