diff --git a/server/locomotive.cc b/server/locomotive.cc
index 6d9e746..9c7a0f6 100644
--- a/server/locomotive.cc
+++ b/server/locomotive.cc
@@ -613,9 +613,20 @@ int Locomotives::Loop() {
if (loco->auto_onroute == LOCO_OR_NOTHING) {
timer_start(&loco->auto_timenext);
loco->auto_onroute = LOCO_OR_SEARCH;
+ //
+ // check if the loco mode is set to autostop
+ if (loco->flags & LOCO_F_AUTOSTOP) {
+ SetMan(loco->name);
+ }
}
else if (loco->auto_onroute == LOCO_OR_SEARCH) {
+ //
+ // check if the loco mode is set to autostop
+ if (loco->flags & LOCO_F_AUTOSTOP) {
+ SetMan(loco->name);
+ }
+
//
// try to find and prepare(lock) a new way.
// nothing found check if we can reverse direction, this will be done only
@@ -752,7 +763,7 @@ int Locomotives::Loop() {
// 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)))
+ if ((loco->flags & LOCO_F_RANDOM) && ((loco->flags & LOCO_F_CARGO) || !(server->blocks.GetFlags(block) & BLOCK_F_STATION)))
if (server->railways.FindRandomWay(loco->blockassign, loco->name, &way)) {
size_t pos;
if ((pos = way.find(",b:", 1)) != string::npos) {
diff --git a/webinterface/locomotive.js b/webinterface/locomotive.js
index 85f740e..ff72366 100644
--- a/webinterface/locomotive.js
+++ b/webinterface/locomotive.js
@@ -648,7 +648,7 @@ function lococtrl_show(name) {