Sunday 2 April 2017

TrafficControl: Debugging Train::move Method (part 2)

After re-testing with more debug prints, I've made an observation:

INFO : TRAIN SET MODEL recognised with Model= "X41" . To be implemented!
INFO : TRAIN SET STATION recognised with Station= "Lund_C" . Check that the station exists.
INFO : TRAIN SET DESIRED SPEED recognised with DesiredSpeed= "145"
IMPORT : "Gunnesbo" found. Adding to travelplan
ERROR : Train::addTrackToTrainRoute Error: negative number specified. 0 : "Gunnesbo"<<The stationID 0 is a valid ID.
INFO : "Marie_Curie" has 100 seats. 0 are taken.
: Train is at station "Lund_C"
: TrainRoute, index: 0 :

The program shall check whether the stationID is smaller than zero (invalid value). The bug is that the program is checking whether the stationID is smaller or equal to zero. The new condition is (stationID < 0)


Another issue has been seen: The check for end of travel plans doesn't seem to work:

INFO : "Ada_Lovelace" has reached end of travelplan. tp_s : 2 pos: 1<<For this particular event, the train hasn't reached the end of the travel plan.
INFO : "Marie_Curie" has reached end of travelplan. tp_s : 2 pos: 1
INFO : "Marie_Curie" has reached end of travelplan. tp_s : 2 pos: 1

This new issue will be debugged in a later blog post.

No comments:

Post a Comment