New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing destination when stopped or waiting #7772
Comments
I would find this useful. YMMV. |
It seems like the OnHover-method in the veghicle_gui.cpp can only be executed by hovering over the vehicle in the viewport and not by hovering over any other widgets. The problem is caused by the DispatchHoverEvent method in the window.cpp; In case a tooltip is defined the OnHover-method is not executed. Possible fix: Remove the return statement from the tooltip handling;
|
So I tried commenting out the return statement and compiling the code again. Unforunately, nothing really changed. I then activated "enable-debug" from "configure" and recompiled the project and stepped through the code. Being previously not familiar with the code, I stepped into the OnHover() function, which we can arrive at now, since the return statement in the tooltip handler is commented out, and it took me to the following empty virtual function.
I grepped for "OnHover" in the OpenTTD project and found no additional references, calls, definitions, etc. I was hoping the debugger got it wrong and I would find a reimplementation of the OnHover function in some subclass. I didn't. So, this might be a naive question on my part (I haven't delved into the code for more than a couple of days), but what is the purpose of an empty virtual function with no reimplementation in any other class. |
Because of the possibility of use! Or perhaps it was used in the past and has since been removed |
Ok. So if I understand it correctly, I can reimplement this OnHover function in "some class" in such a way, that upon hovering the mouse in the vehicle window on the widget showing "Stopped"/"Stopping",etc, it would show the destination. I am not sure, where exactly would be appropriate to place that function, but I look into it. |
Yes, just like the other |
@junaidnaseer you can implement OnHover for each window (here the vehicle_window); There you have to switch-case base on the widget type (see OnClick Method). In my experiments i was not able to identify how to implement the proposed behavior without further reworking of the widgets. |
Ok, guys thanks for the tips. I am looking into the OnClick method in the vehicle_gui.cpp file and see how I can implement something ... as a first step anything that shows any change from the current behavior. If that works, my second step would be to try to implement the above mentioned feature, if possible. |
@junaidnaseer What do you mean with "anything that shows any change from the current behavior"? I would rather recommand to first get the changing of the text working, i.e., change the text in the START_STOP based OnHover and revert the changes after stop hovering. To build the right message-string for the bar should be done afterwards. |
By "anything that shows any change from the current behavior", I meant I would try to write a reimplementation of the OnHover function, in way that I can see some other text in the widget, where it is written "Stopped"/"Waiting ...". Ok, so I reimplemented the OnHover function and I can see through the debugger that upon hovering over the widget containing the text "Stopped"/"Waiting", I do enter my OnHover function. I have hit a couple of roadblocks here.
But I am not sure where exactly to pass this str string further to update the widget text. In the DrawWidget function, I see a function DrawString. I am not sure, but maybe I have to use the DrawWidget or the DrawString function somehow. |
Try |
I believe that it would be useful to replace the "destination"s Stopping, Stopped and Waiting... with the current-destination text when the mouse-pointer is moved over the current-status bar:
The text was updated successfully, but these errors were encountered: