News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[Fix] Reversing stop detection did not work

Started by jamespetts, May 21, 2017, 03:15:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I think that I have fixed a bug in which the detection of reversing stops did not work. Unfortunately, I think that this fix will apply only to new schedules, as, to save computational effort, whether a stop is a reversing stop is saved with each schedule entry after it is first set.

A number of reported bugs seem to have been related to this issue, so I should be grateful if people could re-check whether this can still be reproduced.
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.

Vladki

I cannot compile at all:


vladki@hex:~/simutrans-extended$ make
===> CXX simworld.cc
g++ -std=gnu++11 -O -DNDEBUG -DMULTI_THREAD -DREVISION="8d65ac5" -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -DUSE_C -fno-delete-null-pointer-checks -fno-strict-aliasing -DDISABLE_RANDOMNESS -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DCOLOUR_DEPTH=16 -c -MMD -o build/default/simworld.o simworld.cc
In file included from boden/grund.h:19:0,
                 from simplan.h:12,
                 from simworld.h:34,
                 from path_explorer.h:14,
                 from simworld.cc:23:
boden/wege/weg.h:60:41: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
  static const uint32 get_all_ways_count();
                                         ^
In file included from simworld.cc:30:0:
simfab.h:131:32: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
  const sint32 get_in_transit() const { return statistics[0][FAB_GOODS_TRANSIT]; }
                                ^
In file included from simworld.cc:40:0:
simmenu.h:331:31: warning: unused parameter 'y_diff' [-Wunused-parameter]
  virtual void rotate90(sint16 y_diff) { return; }
                               ^
simworld.cc: In member function 'void karte_t::destroy()':
simworld.cc:701:7: warning: unused variable 'empty_depot_list' [-Wunused-variable]
  bool empty_depot_list = depot_t::get_depot_list().empty();
       ^
simworld.cc: In member function 'void karte_t::distribute_cities(const settings_t*, sint16, sint16)':
simworld.cc:963:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(city_population.get_count() < city_population_target_count) {
                                    ^
simworld.cc:972:65: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   } while ( city_population.get_count() <  number_of_big_cities && (population <= max_small_city_size  || population > max_city_size) ||
                                                                 ^
simworld.cc:1001:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pos->get_count() < new_city_count) {
                        ^
simworld.cc:1021:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(  unsigned i=0;  i<new_city_count;  i++  ) {
                          ^
simworld.cc:1069:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(  current_bev < citizens  ) {
                         ^
simworld.cc:1075:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(  current_bev > citizens/2  &&  not_updated  ) {
                       ^
simworld.cc:1020:11: warning: unused variable 'tbegin' [-Wunused-variable]
    uint32 tbegin = dr_time();
           ^
simworld.cc: In function 'void* step_convoys_threaded(void*)':
simworld.cc:1800:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if ((convoys_next_step.get_count() == parallel_operations - 2) || (i == world->convoi_array.get_count() - 1))
                                       ^
simworld.cc: In function 'void* path_explorer_threaded(void*)':
simworld.cc:1852:11: warning: unused variable 'world' [-Wunused-variable]
  karte_t* world = (karte_t*)args;
           ^
simworld.cc: In member function 'void karte_t::stop_path_explorer()':
simworld.cc:1895:25: error: could not convert 'path_explorer_mutex' from 'pthread_mutex_t' to 'bool'
  if (path_explorer_mutex)
                         ^
simworld.cc: In function 'void* unreserve_route_threaded(void*)':
simworld.cc:1950:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (thread_number == karte_t::world->get_parallel_operations() - 1)
                     ^
simworld.cc: In member function 'void karte_t::init_threads()':
simworld.cc:2000:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (uint32 i = 0; i < parallel_operations; i++)
                       ^
simworld.cc: In member function 'const char* karte_t::can_lower_to(const player_t*, sint16, sint16, sint8, sint8, sint8, sint8, bool) const':
simworld.cc:3532:11: warning: unused variable 'gr' [-Wunused-variable]
  grund_t *gr = lookup_kartenboden_nocheck(x,y);
           ^
simworld.cc:3533:14: warning: unused variable 'water_hgt' [-Wunused-variable]
  const sint8 water_hgt = get_water_hgt_nocheck(x,y);
              ^
simworld.cc: In member function 'void karte_t::rotate90()':
simworld.cc:4225:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (uint32 i = 0; i < get_parallel_operations(); i++)
                       ^
simworld.cc: In member function 'void karte_t::step()':
simworld.cc:5434:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (uint32 i = 0; i < get_parallel_operations(); i++)
                       ^
simworld.cc: In member function 'void karte_t::check_transferring_cargoes()':
simworld.cc:5814:17: warning: unused variable 'ready_hours' [-Wunused-variable]
    const uint32 ready_hours = ready_minutes / 60;
                 ^
simworld.cc: In member function 'uint32 karte_t::generate_passengers_or_mail(const goods_desc_t*)':
simworld.cc:6132:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int n = 0; n < destination_count && route_status != public_transport && route_status != private_car && route_status != on_foot; n++)
                    ^
simworld.cc:6152:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if(n < destination_count - 1)
           ^
simworld.cc:6178:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(n < destination_count - 1)
          ^
simworld.cc:6452:141: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if((route_status == no_route || route_status == too_slow || route_status == overcrowded || route_status == destination_unavailable) && n < destination_count - 1)
                                                                                                                                             ^
simworld.cc: In member function 'void karte_t::save(loadsave_t*, bool)':
simworld.cc:7902:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
    char *motd = "";
                 ^
simworld.cc: At global scope:
simworld.cc:9123:63: warning: unused parameter 'player' [-Wunused-parameter]
halthandle_t karte_t::get_halt_koord_index(koord k, player_t *player, bool create_halt)
                                                               ^
simworld.cc: In member function 'void karte_t::process_network_commands(sint32*)':
simworld.cc:9843:16: warning: unused variable 'offset2' [-Wunused-variable]
      const int offset2 = offset + nwt->last_checklist.print(buf + offset, "initiator");
                ^
simworld.cc: In member function 'void karte_t::do_network_world_command(network_world_command_t*)':
simworld.cc:9902:13: warning: unused variable 'offset2' [-Wunused-variable]
   const int offset2 = offset + LCHKLST(server_sync_step).print(buf + offset, "client");
             ^
simworld.cc:9918:15: warning: unused variable 'offset2' [-Wunused-variable]
     const int offset2 = offset + LCHKLST(nwt->last_sync_step).print(buf + offset, "executor");
               ^
simworld.cc: At global scope:
simworld.cc:10463:59: warning: unused parameter 'gr' [-Wunused-parameter]
player_t *karte_t::get_public_player(grund_t const *const gr) const
                                                           ^
simworld.cc: In member function 'void karte_t::update_weight_of_building_in_world_list(gebaeude_t*)':
simworld.cc:10534:33: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(!gb || gb->get_is_factory() && gb->get_fabrik() == NULL)
                                 ^
simworld.cc: In member function 'sint64 karte_t::get_land_value(koord3d)':
simworld.cc:10692:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(city->get_city_population() >= settings.get_city_threshold_size())
                                  ^
simworld.cc:10696:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   else if(city->get_city_population() >= settings.get_capital_threshold_size())
                                       ^
common.mk:50: návod pro cíl ,,build/default/simworld.o" selhal
make: *** [build/default/simworld.o] Chyba 1


jamespetts

May I ask what was the last commit that you could compile?
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.

Vladki

I have compiled yesterday, and probably also today morning. So 0fb1b0220f7641e9dbf51cf3f893813052cbadf3 or 727da61d1437ec9313775ba731ee457d4039f3de.
Unfortunately If I do not "make clean" I do not have a fresh git commit info compiled into simutrans...

Anyway I have just noticed that the wrong reversing stops in the schedule may have be caused by editing the schedule - extending the line, upon which a stop that used to be reversing is no longer reversing.
If I may suggest - the reversals should be recalculated either:
a) with each edit of schedule - whole schedule should be checked
b) save/load game - whole schedule should be checked
c) checked and update on each stop (only the visited stop).

Vladki

Compilation is fixed, but the reversing stops are still incorrectly marked

jamespetts

Thank you for the report. There is no mechanism for refreshing the reversing positions automatically, as the computer has no way of knowing whether the reversing data are correct or whether they are incorrect as a result of loading a game saved with an earlier version of the executable that contained the bug. Automatically refreshing the reversing status regularly would cause the path explorer to run constantly, which would be resource inefficient. I have, however, implemented your suggestion of reverting all the schedule entries to an unknown reversing status when any change is made to the schedule, so it should be easy to test whether the original bug is fixed by modifying some schedules and seeing whether they correct themselves as to reversing status in time.
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.

Vladki

Yesterday evening I have modified some schedules (lines) and it did not recalculate the reversing points.

Moreover wrong reversing points cause funny directional reservations at longsignals. I have a save game prepared, and will make a separate bug report when I get to it.

Sent from my ONEPLUS A3003 using Tapatalk


Jando

Quote from: Vladki on May 23, 2017, 04:27:14 AM
Yesterday evening I have modified some schedules (lines) and it did not recalculate the reversing points.

Moreover wrong reversing points cause funny directional reservations at longsignals. I have a save game prepared, and will make a separate bug report when I get to it.

The odd thing is that I see the [>>] marks for passenger buses and stage coaches, I assume indicating a reversing stop, but sometimes the buses will not go into the loading countdown timer or wait for schedule but instead load and reverse instantly. On freight trains I do not see the [>>] indication but they go into loading and reversing countdown timer just fine.

jamespetts

I think that I have managed to fix these two things now (the latter actually required adding the reversing feature to road vehicles which adds a potentially interesting game-play dynamic for 'bus routes, although this will default to 0 seconds unless you download the latest pakset (nightly build out to-morrow) or change the new simuconf.tab setting manually).

Could anyone confirm whether these things are indeed now fixed?
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.

Jando


Jando

Took a medium-sized town and oversupplied it with bus lines, all running on schedules (wait for time), so far no bug found. Thank you, looks like that works!

jamespetts

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.