summaryrefslogtreecommitdiff
path: root/app/bin/cswitchmotor.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/bin/cswitchmotor.c')
-rw-r--r--app/bin/cswitchmotor.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/app/bin/cswitchmotor.c b/app/bin/cswitchmotor.c
index dbe006c..3d39a68 100644
--- a/app/bin/cswitchmotor.c
+++ b/app/bin/cswitchmotor.c
@@ -50,10 +50,17 @@
*/
#include <ctype.h>
-#include "track.h"
-#include "trackx.h"
+#include <string.h>
+
#include "compound.h"
+#include "cundo.h"
+#include "custom.h"
+#include "fileio.h"
#include "i18n.h"
+#include "param.h"
+#include "track.h"
+#include "trackx.h"
+#include "utility.h"
EXPORT TRKTYP_T T_SWITCHMOTOR = -1;
@@ -271,7 +278,7 @@ static DIST_T DistanceSwitchMotor (track_p t, coOrd * p )
{
switchmotorData_p xx = GetswitchmotorData(t);
if (xx->turnout == NULL) return 0;
- return GetTrkDistance(xx->turnout,*p);
+ return GetTrkDistance(xx->turnout,p);
}
static void DescribeSwitchMotor (track_p trk, char * str, CSIZE_T len )
@@ -769,11 +776,11 @@ EXPORT void CheckDeleteSwitchmotor(track_p t)
track_p sm;
switchmotorData_p xx;
- sm = FindSwitchMotor( t );
- if (sm == NULL) return;
- xx = GetswitchmotorData (sm);
- NoticeMessage(_("Deleting Switch Motor %s"),_("Ok"),NULL,xx->name);
- DeleteTrack (sm, FALSE);
+ while ((sm = FindSwitchMotor( t ))) { //Cope with multiple motors for one Turnout!
+ xx = GetswitchmotorData (sm);
+ InfoMessage(_("Deleting Switch Motor %s"),xx->name);
+ DeleteTrack (sm, FALSE);
+ };
}