mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 21:44:05 +09:00
new console command 'error' (stderr equivalent of console window)
Former-commit-id: ab54663fd64f9ae9c758f53b3f5800a5894f0db3 Former-commit-id: 7aba1585ffa45195622bb25e1c62cace474420c9
This commit is contained in:
@@ -149,5 +149,17 @@ class WorldTime {
|
||||
val MINUTE_SEC: Int = 60
|
||||
val HOUR_MIN: Int = 60
|
||||
val GAME_MIN_TO_REAL_SEC: Float = 60f
|
||||
|
||||
fun parseTime(s: String): Int =
|
||||
if (s.length >= 4) {
|
||||
s.toLowerCase().substringBefore('h').toInt() * WorldTime.HOUR_SEC +
|
||||
s.toLowerCase().substringAfter('h').toInt() * WorldTime.MINUTE_SEC
|
||||
}
|
||||
else if (s.endsWith("h", true)) {
|
||||
s.toLowerCase().substring(0, s.length - 1).toInt() * WorldTime.HOUR_SEC
|
||||
}
|
||||
else {
|
||||
s.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user