News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

passenger and mail classes

Started by Ves, August 24, 2017, 12:02:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wlindley

Have successfully compiled the very latest program and Britain Ex pakset in this branch.  Everything seems to be functional, although the convoy manifest list is always empty, regardless of whether it's passengers, mail, or goods being carried.  I have carefully copied all the *.tab and *.txt into the directory where I run the game, but cannot find what might be missing.  Any suggestions?


Ves

Glad that you have tried it! That manifest is still work in progress. I have to find a way to sort the passengers by accommodation, which appears to be more difficult than it might seem. The "show class" button will disappear and be replaced by sort options for classes.
So for the moment, no good is shown because of that.

jamespetts

Thank you for your feedback.

I should note that I am hoping to have this integrated with the master branch quite soon, preferably by December, so that more rigorous testing can start (including starting online servers) and so that the amount of work involved in maintaining two separate actively developed branches comes to an end. This does not mean that all work needs to have been completed on this by December, but we should aim at least to have it playable by then. As far as the GUI is concerned, do you think that you would be able to make what we have workable and fix obvious bugs (such as the failure to display passengers and goods, as here) by early December, even if all the desired UI features cannot be completed by then and even if this means temporarily removing some of the more advanced UI features that are not essential for the passenger and mail classes features to work?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

The thing being, that version was the version which had the bug of not showing correct amount of good in the accommodations, which we talked about earlier. What I try to achieve now is in fact to get these basic stuff to show up as desired.

jamespetts

If you are getting stuck with the task of fixing this bug, might I try to assist? Have you made any more progress since your last update of code to Github from which I could start in attempting at least a basic solution to this for the time being?

Thank you for your work on this so far.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I have not had much time lately, I don't recall currently what you have got and what you haven't. I'm not home tonight so I can't check, but I should be able tomorrow to check and update my github.

jamespetts

Splendid, that is very helpful, thank you.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

#77
I have merged your latest code with my gui-classes and uploaded it to github. I dont recall what you had incorporated and what not from beforehand.

AND, please save the base-translation file. I do still fill it out with new entries! :)

edit:

I have now spent a few hours today trying to figure some of these things out, and somethings have been solved and others have arized.
For instance, I can sort passengers (only passengers, it seems) by classes in the convoys now, but I cannot with mail.
I do, however, realize that I have made a big error in simconvoy that I need to fix, but I am too tired to do that now Im afraid :P

It is on Github now!

jamespetts

#78
I think that I have fixed what appeared to be the principal bugs, although it is not as clear as it might have been what the intention was in many cases. Ves - can you let me know what parts that you think are and are not working as at my latest fixes in case I have missed anything important?

Edit: Having noticed your edit, after my original post, I see that our possible solutions may have collided. I will have a look at what you have managed and see what we come up with.

Incidentally, can you upload a saved game in which the specific problems that you report can be reproduced reliably?

Edit 2: I am afraid that there are some major merge conflicts between our respective fixes, and I am not entirely sure what you had intended. Can you check whether things are working better in my version or your version so that we can consider how to deal with these difficult merge conflicts?

Edit 3: Incidentally, we also need to show the class proportions, etc. for depots and stations.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Oh no, too bad with conflicts! :p
I'm away for the day, but maybe I can look into it tonight. We really should coordinate so we don't do duplicate work! :)

jamespetts

Splendid, please do. I did the work that I did because I thought that you had got stuck with some of these things and wanted a little assistance, so I tried to fix some of the bugs; my apologies if this was not clear. Thank you again for your assistance with this.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

No worries, I appreciate all the help I can get! :)

Ves

Writing in a new message, so as to minimize confusion this time ;)

I have now merged it with my work, but I do not know if I have merged it correctly. The display looks odd with quite some bugs somewhere, and I can see some parts of code you have added which looks like they are supposed to be used by simconvoy.

Trying "passenger-and-mail-classes" in the state you left it, it looks luckily much better, as my code is not interrupting it. However some issues:
* The max capacity of the classes are wrong, they show the total amount of passengers in the convoy, not the total for the classes.
* The passengers is now always sorted by class.

Some questions:

you have modified the void freight_list_sorter_t::sort_freight(vector_tpl ...... ) and added uint8 g_class to the end. I can see that it is used a few times in the code, but I had imagined that it would also be used in conjuction with simconvoi_t?
I dont understand why you have modified the sort section with parameters like (g_class == all_classes || wlist[ i ].get_class() == g_class) when sorting by anything else than by class/wealth?

Lastly, should I start digging in the code, or would you like to?  ;D

jamespetts

I am currently away from home, so cannot easily answer in detail. However, can I clarify whether the issues that you report are before or after your merging work?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I think our two versions do not work well together at all, so I might have to start on a new branch to continue working :P

The issues I describe comes from the unmodified "passenger-and-mail-classes" branch, so that will say without any merging.

Ves

Also, another odd bug I have come acros now is that mail appear to exist also in 5 classes.
Using the savegame linked below , you will notice that we suddently now have "m_class[ 4 ]" class mail. This you can also see with the version compiled directly from passenger-and-mail-classes branch.
savegame:
http://simutrans-germany.com/files/upload/classes_GUI_vehicle_tests_6.sve

Also, could you help me understand the changes you have made?

edit:
Added savegame!

jamespetts

Splendid, thank you for the report. I think that I have fixed the mail issue, which was a problem in the passenger generation code whereby mail and passengers were not properly distinguished in terms of which class that they would be assigned on generation. The old mail with an excessive class will linger until it is delivered, but no new mail with the wrong class will now be generated.

To answer your questions above, the issue with the capacity of classes being shown in the sort by class detail/via displays as the total class seems to be caused by the use of current.menge as the third argument in add_ware_heading() on line 450 of freight_list_sorter.cc, and that simply gives the whole capacity irrespective of class. This is an illustration of why it is difficult for two people to work on the exact same piece of code: it is not clear what was intended here. How did you intend to calculate and store the figure for the per class capacities in order to pass to the add_ware_heading() method? If you want the capacity just for the class to be displayed here, that is what you will need to do.

Adding the parameter g_class to freight_list_sorter (which is currently unused) was intended to allow it to operate exclusively on one class and ignore others, but it became apparent that this was not an effective means of dealing with at least the immediate issues. As the intention behind the code was not entirely clear, I left it in in case this becomes useful. If you find that this has no use in any permutation, feel free to remove it.

To answer your final question, it might be better for you to look into the code, as I really have a very large amount of work to try to get the pakset ready for these new features.

Thank you very much indeed for your ongoing work on this - it is much appreciated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Hehe, it seems that you ran into the very same issue as I did then with the amount of passengers in each class.

But thanks for the explanations! I will continue working to find some solutions! :)

Ves

So, finally!

First of all, it seems as some terminology had been mixed up. Your implementation of g_class in the freight_list_sorter appears to try to sort by the classes of the good them selfs, that would say the wealth of the passengers/mails. That, however, is already possible since the ware.get_class() is accesable and sortable.
The difficult issue where however to be able to sort by class, or accommodation to help distinguish it from wealth.
I have therefore renamed it in the freight_list_sorter to accommodation, and I have had to make some modifications so as to not mix ware.g_class() with accommodation, as they have nothing really to do with each other in this sense.

So now it should (hopefully) work like this:

For both convoy info and halt info:
* Sort by wealth detail/via will sort the passengers and mails to their own wealth, irrespectively of accommodations or anything else.
* Sort by any non-class/wealth sort modes will clump passengers and mails together like they used to do
In convoy info:
* Sort by wealth will first show a line with the total amount of passengers/mails onboard, and underneith the pass/mail sorted by wealth.
* Sort by accommodation will sort the passengers and mails in their specific accommodations they are traveling in.

How it is done:
I have simply moved the sorting of accommodations outside the freight_list_sorter into simconvoi.cc, since we have no way of telling in which accommodation a good is located when it first has arrived to freight_list_sorter. Two new sort options has been created, and simconvoi sorts to different lists of goods dependent on which sort option is created. Well inside the freight_list_sorter, the good are sorted similar as to by_destination_detail and by_via.

To accomplish a correct maximum amount of pass/mail per class, I have created further to the sort_freight:
void freight_list_sorter_t::sort_freight(vector_tpl<ware_t> const& warray, cbuffer_t& buf, sort_mode_t sort_mode, const slist_tpl<ware_t>* full_list, const char* what_doing, const uint8 accommodation, const uint32 accommodation_capacity )

The accommodation_capacity is used to take a single capacity. The function is called once for every class in a convoy when it sorts by accommodation, and one last time for the rest of the good.

Known issues:
* When the vehicle-/halt info window is opened, the sorting is all mixed up. To resolve, just sort to something else and return
* On some sort options, when the convoy is empty, the formatting of the screen looks different

Code can be found here (new branch): https://github.com/VictorErik/Simutrans-Experimental-Ves/tree/new-gui-classes

Please try it out and let me know if you find any issues!  :)

jamespetts

This works a lot better - thank you for your work on this. I have incorporated this into my passeger-and-mail-classes branch, and also pushed some improvements to make it more likely that passengers of a higher class will choose to travel in higher class accommodation (this is now randomised and the range of random numbers can be set in simuconf.tab).

One thing that I do notice, however, is that the "sort passengers and frieght by" text is missing from the stop information window (although it is present on the convoy information window). Also, there is some inconsistency in the capitalisation of "Wealth" compared with "destination", "via", etc..

This does seem to work well apart from that, however.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I dont think that there ever has been a text "sort passengers and freight by"? Im playing a game from the master branch and there is no such label in the halt info. Instead it says "Goods and passengers waiting:"

The capitalisations of wealth, is due to there being no translations at all for the other sort options, or at least not for all of them. I can change the ones I created to lower case.

Im happy that you find it working! :)

What are left for me to do now with the passenger and mail classes feature?

jamespetts

The reason that I asked about the sort passengers and freight by text is that the dropdown menu does not make much sense without that as a context (players have no way of knowing what "destination", "via", "class", etc. mean without context). I cannot remember whether there used to be context - perhaps this issue was less obvious when it was a button rather than a dropdown menu. Would you be able to add that text so that it makes sense?

As to the things left to do, there are the known issues identified above, the text and capitalisation issues discussed in the immediately preceding paragraph, and a finalisation (if anything is yet to be done) of the .dat file for the translation texts so that I can upload this. One small thing is that I should like to rename "class manager" to "change prices" (at least, the button for it) to make it clearer to players what the feature does (it is not immediately obvious how one would manage a class or why one would want to do so).

In terms of the passenger and mail classes branch itself, I still have quite a lot of pakset work to do, although I am making reasonable progress with this.

Thank you very much for your work on the GUI for this - it has enabled this feature to be much closer to completion much sooner than it would otherwise have been, and probably with a better designed GUI, too.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

So, the first fix is online on my branch and it deals with not showing the capacity when the convoys are empty.
I think this works in all circumstances, but maybe you could give it a go too to check if it works consistently!

jamespetts

I have not had a chance to test fully, but this does seem an improvement so far - thank you for your work on this.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I made some small fixes which adresses some of the issues as well as some other issues I found.

One issue though that might need to be adressed:
If you sort by class and change a class, all pass or mail in those accommodations dissappear from the window.
I dont really know how to tackle that, the best thing would be if this was not a GUI-principle but rather a game-design principle that a class could not be changed until it reach a stop, so everybody can "buy new tickets" based on the new accommodations or something similar.

Fixes are online here: https://github.com/VictorErik/Simutrans-Experimental-Ves/tree/new-gui-classes

Ves

I have made a small fix on my branch which renames the sort-label  to show "Sort passengers/freight by" similarly as to in the vehicles.

Now the backside of waiting with all translations shows its face, because I *think* I have got them all already, but I am not sure. If anyone finds any untranslated text, which btw should be easy to spot, since they have underscores "_" instead of normal spaces, please come forward. Single words have no underscore but might look funny because of no capitalisation and therefore untranslated.

But I do think that you can wrap the datfile up now and upload it to simutranslator.

jamespetts

Thank you for that - now incorporated. However, I do not see any amendments to the .dat file for translations in your most recent commit - can you confirm that you have committed this?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I have not committed any new texts, as I did not find any text that wasnt already translated. I did a big translation pass a while ago updating the dat-file and the translation file at the same time.

jamespetts

#98
Splendid, thank you for clarifying.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Hmm.. there appears to be some strange issues with the class manager. I tried to optimize it a bit by not using fixed amount of pointers, but rather a dynamic one. Or if I messed up the explanations, I have replaced stuff like this:

uint32 pass_capacity_at_accommodation[ 255 ] = { 0 };

with this:

uint32 *pass_capacity_at_accommodation = 0;

Also I have putted these kinds of stuff in the header file so I can reuse the values and dont have to compute them every time.

Problems that arise:
* Window flashes when opening -> Must have something to do with I am calculating the window size and stuf inside it on a fly when the window opens. Minor issue, if considered issue at all.
* Randomly when opened, some phantom classes have sneaked inside with some astronomous values -> Must have something to do with what I wrote in the beginning of post.
* When opening multiple times, the game crashes.... :redx: -> Turfit talked earlier about deleting stuf after one have used it, but I dont know. When trying in debug mode, it doesnt crash!

Do you have any suggestions or advices to the two lower points?
I have uploaded the newest vesrion to the github branch

jamespetts

I cannot reproduce this with a debug version. It would take a considerable amount of time to look into this sort of error. May I suggest simply reverting the optimisation? Since this is GUI code, it is very unlikely that the old code would ever make any noticeable difference to performance (unless you noticed a difference?), as it would only be called once each time that a player opened the relevant window, rather than many times over constantly. Because the old code used all locally allocated variables, there would be no issue with memory leaks, although this code looks as though it allocates new memory every time that the class manager window is opened, but never uses the memory allocated by a previous opening of the class manager window, nor deletes that memory, creating a leak.

Incidentally, running Dr. Memory on the latest debug executable produces the following which might help you to diagnose the problem:


Dr. Memory version 1.11.0 build 2 built on Aug 29 2016 02:42:07
Dr. Memory results for pid 11672: "Simutrans-Extended-debug.exe"
Application cmdline: "C:\Users\James\Documents\Development\Simutrans\simutrans-extended-sources\simutrans\Simutrans-Extended-debug.exe"
Recorded 115 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin\suppress-default.txt

Error #1: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x3bedbf5c-0x3bedbf60 4 byte(s)
# 0 vehicle_class_manager_t::layout                                [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:218]
# 1 scr_size::operator scr_coord                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\display\scr_coord.h:114]
# 2 gui_scrollpane_t::set_size                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_scrollpane.cc:87]
# 3 gui_frame_t::resize                                            [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:173]
# 4 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:149]
# 5 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
# 6 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
# 7 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
# 8 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
# 9 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
#10 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
#11 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
#12 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
#13 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
#14 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
#15 sysmain                                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#16 WinMain                                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:00:51.496 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x3bedbf58-0x3bedbf5c
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:62]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%ecx,%edx,4)

Error #2: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x3befecd4-0x3befecd8 4 byte(s)
# 0 vehicle_class_manager_t::layout                                [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:222]
# 1 scr_size::operator scr_coord                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\display\scr_coord.h:114]
# 2 gui_scrollpane_t::set_size                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_scrollpane.cc:87]
# 3 gui_frame_t::resize                                            [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:173]
# 4 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:149]
# 5 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
# 6 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
# 7 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
# 8 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
# 9 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
#10 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
#11 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
#12 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
#13 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
#14 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
#15 sysmain                                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#16 WinMain                                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:00:51.502 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x3befecd0-0x3befecd4
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:71]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%eax,%ecx,4)

Error #3: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x3beed614-0x3beed618 4 byte(s)
# 0 vehicle_class_manager_t::draw               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:424]
# 1 win_draw_window_title                       [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:344]
# 2 display_win                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:924]
# 3 display_all_win                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:957]
# 4 win_display_flush                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1547]
# 5 intr_refresh_display                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:79]
# 6 karte_t::sync_step                          [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:4658]
# 7 karte_t::interactive                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10270]
# 8 simu_main                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
# 9 sysmain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#10 WinMain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:00:51.574 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x3beed610-0x3beed614
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:61]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%eax,%ecx,4)

Error #4: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x3bef8fec-0x3bef8ff0 4 byte(s)
# 0 vehicle_class_manager_t::draw               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:428]
# 1 win_draw_window_title                       [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:344]
# 2 display_win                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:924]
# 3 display_all_win                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:957]
# 4 win_display_flush                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1547]
# 5 intr_refresh_display                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:79]
# 6 karte_t::sync_step                          [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:4658]
# 7 karte_t::interactive                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10270]
# 8 simu_main                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
# 9 sysmain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#10 WinMain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:00:51.579 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x3bef8fe8-0x3bef8fec
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:70]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%edx,%eax,4)

Error #5: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x2269c824-0x2269c828 4 byte(s)
# 0 vehicle_class_manager_t::draw               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:424]
# 1 win_draw_window_title                       [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:344]
# 2 display_win                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:924]
# 3 display_all_win                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:957]
# 4 win_display_flush                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1547]
# 5 intr_refresh_display                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:79]
# 6 karte_t::sync_step                          [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:4658]
# 7 interrupt_check                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:111]
# 8 karte_t::step                               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:5392]
# 9 karte_t::interactive                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10368]
#10 simu_main                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
#11 sysmain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#12 WinMain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:01:21.361 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x2269c820-0x2269c824
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:61]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%eax,%ecx,4)

Error #6: UNADDRESSABLE ACCESS beyond heap bounds: writing 0x0eea7fdc-0x0eea7fe0 4 byte(s)
# 0 vehicle_class_manager_t::draw               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:428]
# 1 win_draw_window_title                       [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:344]
# 2 display_win                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:924]
# 3 display_all_win                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:957]
# 4 win_display_flush                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1547]
# 5 intr_refresh_display                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:79]
# 6 karte_t::sync_step                          [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:4658]
# 7 interrupt_check                             [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simintr.cc:111]
# 8 karte_t::step                               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:5392]
# 9 karte_t::interactive                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10368]
#10 simu_main                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
#11 sysmain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys.cc:825]
#12 WinMain                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simsys_w.cc:1022]
Note: @0:01:21.367 in thread 18224
Note: refers to 0 byte(s) beyond last valid byte in prior malloc
Note: prev lower malloc:  0x0eea7fd8-0x0eea7fdc
Note: allocated here:
Note: # 0 replace_operator_new_nothrow                                   [d:\drmemory_package\common\alloc_replace.c:2913]
Note: # 1 vehicle_class_manager_t::vehicle_class_manager_t               [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\vehicle_class_manager.cc:70]
Note: # 2 convoi_detail_t::action_triggered                              [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\convoi_detail_t.cc:317]
Note: # 3 gui_action_creator_t::call_listeners                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_action_creator.h:36]
Note: # 4 button_t::infowin_event                                        [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_button.cc:234]
Note: # 5 gui_container_t::infowin_event                                 [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\components\gui_container.cc:198]
Note: # 6 gui_frame_t::infowin_event                                     [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\gui_frame.cc:149]
Note: # 7 check_pos_win                                                  [c:\users\james\documents\development\simutrans\simutrans-extended-sources\gui\simwin.cc:1425]
Note: # 8 interaction_t::process_event                                   [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:366]
Note: # 9 interaction_t::check_events                                    [c:\users\james\documents\development\simutrans\simutrans-extended-sources\siminteraction.cc:439]
Note: #10 karte_t::interactive                                           [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simworld.cc:10231]
Note: #11 simu_main                                                      [c:\users\james\documents\development\simutrans\simutrans-extended-sources\simmain.cc:1362]
Note: instruction: mov    $0x00000000 -> (%edx,%eax,4)


I have truncated this, as posting it in full exceeds the post's length limit. These unaddressable accesses are probably what are causing crashes in the release versions.

Incidentally, I have uploaded the translation texts to Simutranslator.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Thanks for the output. I see there is something at line 70(?) in the class manager.
Ok, so then I will revert it back to use the static memory. I'm not home now, but tonight I should be able to.

Out of curiosity, how do you delete alternatively reuse the stuff in the window?

jamespetts

If you want to delete a piece of memory allocated to the heap, just use the "delete" keyword (making absolutely sure that you do not try to access the memory again after it has been deleted, or else the game will crash). If you want to re-use the memory, you will have to (1) store the pointers to the memory somewhere between uses of the window; and (2) know before trying to use the stored pointers whether or not the memory to which they point has been initialised. In this sort of case, it would be easier just to delete them, as this is not a performance critical part of the code.

For more information on using the new/delete operators in C++, see this tutorial.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Thanks, I understood that I had to use the delete command. What I do find difficult however is to place it correctly in the code.
What I want it for is for the comboboxes. Turfit mentioned that it would probably be wise to not have 255*2 comboboxes prepared, if only a few had a chance of being used.

In what function should I place the delete commands you think? What part of the code handles when the window is closed?

jamespetts

Quote from: Ves on November 26, 2017, 07:58:42 PM
Thanks, I understood that I had to use the delete command. What I do find difficult however is to place it correctly in the code.
What I want it for is for the comboboxes. Turfit mentioned that it would probably be wise to not have 255*2 comboboxes prepared, if only a few had a chance of being used.

In what function should I place the delete commands you think? What part of the code handles when the window is closed?

The trouble is that to answer that question, I should have to review that part of the code in very great detail, and quite possibly undertake extensive testing.

Did you notice any problems with the old code? Did TurfIt explain why having 255 comboboxes in memory while this window is open would cause problems?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.