Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Privacy
Imprint
Contact
Login methods
Sign in
Toggle navigation
Menu
Open sidebar
Bahn-Simulator
libtrainsim-go
Commits
5db49d87
Commit
5db49d87
authored
Jun 06, 2021
by
noasakurajin
Browse files
adding check functions for TrainProperties
parent
0e0a2022
Changes
1
Hide whitespace changes
Inline
Side-by-side
train_properties.go
View file @
5db49d87
...
...
@@ -8,7 +8,7 @@ type VersionStruct struct {
Patch
int64
}
func
(
b
*
VersionStruct
)
t
oString
()
string
{
func
(
b
*
VersionStruct
)
T
oString
()
string
{
var
retVal
string
retVal
+=
strconv
.
FormatInt
(
b
.
Major
,
10
)
+
"."
...
...
@@ -45,3 +45,24 @@ func (b *TrainProperties040) Cast() TrainProperties{
retVal
.
VelocityUnit
=
b
.
VelocityUnit
return
retVal
}
func
(
b
*
TrainProperties
)
IsValid
()
bool
{
tmp
:=
b
.
TrainProperties040
return
tmp
.
IsValid
()
}
func
(
b
*
TrainProperties040
)
IsValid
()
bool
{
if
b
.
Name
==
""
||
b
.
Mass
==
0
{
return
false
}
if
b
.
MaxVelocity
==
0
||
b
.
MaxAcceleration
==
0
{
return
false
}
if
!
(
b
.
VelocityUnit
==
"ms"
||
b
.
VelocityUnit
==
"kmh"
||
b
.
VelocityUnit
==
""
){
return
false
}
return
true
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment