|
|
|
|
@ -749,7 +749,7 @@ int Locomotives::Loop() {
|
|
|
|
|
// only in automate do anything alone
|
|
|
|
|
//
|
|
|
|
|
if (loco->blockassign[0] == 0) {
|
|
|
|
|
debug (0, "%s:%d Locomotive not assigned to any block. Set Mode to Man", __FILE__, __LINE__);
|
|
|
|
|
debug (0, "%s:%d Locomotive [%s] not assigned to any block. Set Mode to Man", __FILE__, __LINE__, loco->name);
|
|
|
|
|
SetModeMan(loco->name);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
@ -768,6 +768,13 @@ int Locomotives::Loop() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (loco->auto_onroute == LOCO_OR_SEARCH) {
|
|
|
|
|
//
|
|
|
|
|
// check if the loco mode is set to autostop
|
|
|
|
|
if (loco->flags & LOCO_F_AUTOSTOP) {
|
|
|
|
|
SetModeMan(loco->name);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// try to find and prepare(lock) a new way.
|
|
|
|
|
// nothing found check if we can reverse direction, this will be done only
|
|
|
|
|
@ -893,14 +900,20 @@ int Locomotives::Loop() {
|
|
|
|
|
strncpy (loco->auto_wayold, loco->auto_way, WAYDATA_LEN);
|
|
|
|
|
loco->auto_way[0] = 0;
|
|
|
|
|
loco->blocknext[0] = 0;
|
|
|
|
|
if (strncmp(loco->blockassign, loco->blockdest, REFERENCENAME_LEN) == 0) {
|
|
|
|
|
printf ("%s:%d LOCO_OR_ONTHEWAY enter assign == dest stop\n", __FILE__, __LINE__);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// if destination reached or AUTO-MAN mode: stop train.
|
|
|
|
|
if ((strncmp(loco->blockassign, loco->blockdest, REFERENCENAME_LEN) == 0)
|
|
|
|
|
|| (loco->flags & LOCO_F_AUTOSTOP)) {
|
|
|
|
|
printf ("%s:%d LOCO_OR_ONTHEWAY enter assign == dest stop train\n", __FILE__, __LINE__);
|
|
|
|
|
loco->blockdest[0] = 0;
|
|
|
|
|
loco->auto_onroute = LOCO_OR_ENTERBLOCKSTOP;
|
|
|
|
|
SetSpeed(loco->name, reverse * loco->vslow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// if not try to find next block.
|
|
|
|
|
else {
|
|
|
|
|
// try to find new way
|
|
|
|
|
printf ("%s:%d LOCO_OR_ONTHEWAY try to find new way\n", __FILE__, __LINE__);
|
|
|
|
|
if (loco->blockdest[0] == 0) {
|
|
|
|
|
if ((loco->flags & LOCO_F_RANDOM) && ((loco->flags & LOCO_F_CARGO) || !(server->blocks.GetFlags(block) & BLOCK_F_STATION)))
|
|
|
|
|
|