I made a small patch to get the last used or default way tool, however for some reason it is failing with waytype = 6, (I'm not sure if I caused it).
Usage:
way_desc_x.get_last_used_way(wt_nr)
0001-ADD-get_last_used_way.patch
In in r11881, slightly modified.
Quote from: prissi on Yesterday at 03:03:25 AMIn in r11881, slightly modified.
slightly do you say?, you changed almost everything hahaha. ;D ,I'm very happy with the result, you did a good refactoring there. 8)
"get_default_desc" I don't think that's a good name, since this is specific to waytipes, perhaps something like "get_default_way_desc".
/**
* Returns the last used (default) way descriptor for a given waytype.
* This is the way that would be selected when pressing the shortcut key (e.g. 's' for roads).
* @param wt waytype (1=road_wt, 2=track_wt, 3=tram_wt, etc.)
* @returns way_desc_x object or null if none available
*/
STATIC register_method(vm, &tool_build_way_t::get_default_desc, "get_default_desc", false, true);You need to move this to line 673, as the function is currently not accessible with "way_desc_x.get_default_desc".
Ups, yes, done in r11883
There is one small detail: when the tool is called from the keyboard shortcut, it is not marked as selected in the menu icons.
Edit.
It happens the first time, when a road has not yet been built; it seems that in cases where the road is determined with timeline, the menu is not being instructed to select the tool icon.
Screenshot_2026-02-14_13-08-06.png