From 24b03403f79558b9026c15095c57216ebaeb4c34 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sun, 2 Dec 2018 17:34:01 +0900 Subject: [PATCH] minor edits --- src/net/torvald/terrarum/Terrarum.kt | 22 ++++-- .../modulebasegame/gameworld/WorldTime.kt | 72 ++++++++++--------- .../luaapi/WorldInformationProvider.kt | 2 +- 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/src/net/torvald/terrarum/Terrarum.kt b/src/net/torvald/terrarum/Terrarum.kt index 98408b449..10edea8d0 100644 --- a/src/net/torvald/terrarum/Terrarum.kt +++ b/src/net/torvald/terrarum/Terrarum.kt @@ -31,6 +31,7 @@ import org.lwjgl.BufferUtils import org.lwjgl.input.Controllers import java.io.File import java.io.IOException +import net.torvald.getcpuname.GetCpuName @@ -206,6 +207,8 @@ object Terrarum : Screen { val systemArch = System.getProperty("os.arch") + val processor = GetCpuName.getModelName() + val processorVendor = GetCpuName.getCPUID() val is32BitJVM = !System.getProperty("sun.arch.data.model").contains("64") @@ -250,12 +253,17 @@ object Terrarum : Screen { - printdbg(this, "os.arch = $systemArch") // debug info + println("os.arch = $systemArch") // debug info if (is32BitJVM) { printdbgerr(this, "32 Bit JVM detected") } + + println("processor = $processor") + println("vendor = $processorVendor") + + joypadLabelStart = when (getConfigString("joypadlabelstyle")) { "nwii" -> 0xE04B.toChar() // + mark "logitech" -> 0xE05A.toChar() // number 10 @@ -317,9 +325,9 @@ object Terrarum : Screen { testTexture = Texture(Gdx.files.internal("./assets/test_texture.tga")) - printdbg(this, "GL_VERSION = $GL_VERSION") - printdbg(this, "GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE") - printdbg(this, "GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info + println("GL_VERSION = $GL_VERSION") + println("GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE") + println("GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info if (GL_VERSION < MINIMAL_GL_VERSION || GL_MAX_TEXTURE_SIZE < MINIMAL_GL_MAX_TEXTURE_SIZE) { @@ -530,9 +538,9 @@ object Terrarum : Screen { defaultSaveDir = defaultDir + "/Saves" configDir = defaultDir + "/config.json" - printdbg(this, "os.name = $OSName (with identifier $OperationSystem)") - printdbg(this, "os.version = $OSVersion") - printdbg(this, "default directory: $defaultDir") + println("os.name = $OSName (with identifier $OperationSystem)") + println("os.version = $OSVersion") + println("default directory: $defaultDir") } private fun createDirs() { diff --git a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldTime.kt b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldTime.kt index 0fca02fc4..bfae52f48 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameworld/WorldTime.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameworld/WorldTime.kt @@ -4,48 +4,48 @@ package net.torvald.terrarum.modulebasegame.gameworld typealias time_t = Long /** - * The World Calendar implementation of Dwarven Calendar, except: - * - the year begins with Mondag instead of Sundag (which is ISO standard) - * - the first month is Opal instead of Granite (to reduce confusion) - * - * * Please also see: * https://en.wikipedia.org/wiki/World_Calendar - * http://dwarffortresswiki.org/index.php/DF2014:Calendar * - * And there is no AM/PM concept, 24-hour clock is forced; no leap years. + * There is no AM/PM concept, 24-hour clock is forced; no leap years. * An ingame day should last 22 real-life minutes. * - * // TODO 4-month year? like Stardew Valley + * ## The Yearly Calendar * - * The Yearly Calendar + * A calendar tailored to this very game. A year is consisted of 4 seasons (month), + * and each season last fixed length of 30 days, leap years does not occur. * - * A calendar tailored to this very game. A year is consisted of 4 seasons (month), - * and each season last fixed length of 30 days, leap years does not occur. + * ========================= + * |Mo|Ty|Mi|To|Fr|La|Su|Ve| + * |--|--|--|--|--|--|--|--| + * | 1| 2| 3| 4| 5| 6| 7| | <- Spring + * | 8| 9|10|11|12|13|14| | + * |15|16|17|18|19|20|21| | + * |22|23|24|25|26|27|28| | + * |29|30| 1| 2| 3| 4| 5| | <- Summer + * | 6| 7| 8| 9|10|11|12| | + * |13|14|15|16|17|18|19| | + * |20|21|22|23|24|25|26| | + * |27|28|29|30| 1| 2| 3| | <- Autumn + * | 4| 5| 6| 7| 8| 9|10| | + * |11|12|13|14|15|16|17| | + * |18|19|20|21|22|23|24| | + * |25|26|27|28|29|30| 1| | <- Winter + * | 2| 3| 4| 5| 6| 7| 8| | + * | 9|10|11|12|13|14|15| | + * |16|17|18|19|20|21|22| | + * |23|24|25|26|27|28|29|30| + * ========================= * - * ========================= - * |Mo|Ty|Mi|To|Fr|La|Su|Ve| - * |--|--|--|--|--|--|--|--| - * | 1| 2| 3| 4| 5| 6| 7| | - * | 8| 9|10|11|12|13|14| | - * |15|16|17|18|19|20|21| | - * |22|23|24|25|26|27|28| | - * |29|30| 1| 2| 3| 4| 5| | - * | 6| 7| 8| 9|10|11|12| | - * |13|14|15|16|17|18|19| | - * |20|21|22|23|24|25|26| | - * |27|28|29|30| 1| 2| 3| | - * | 4| 5| 6| 7| 8| 9|10| | - * |11|12|13|14|15|16|17| | - * |18|19|20|21|22|23|24| | - * |25|26|27|28|29|30| 1| | - * | 2| 3| 4| 5| 6| 7| 8| | - * | 9|10|11|12|13|14|15| | - * |16|17|18|19|20|21|22| | - * |23|24|25|26|27|28|29|30| - * ========================= - * - * Verddag only appears on the last day of the year (30th winter) + * - A year is 120 days, 8th day of the week (Verddag, Winter 30th) does occur as in The World calendar. + * - Starting day of the week is monday (Mondag). + * - Spring 1st is the New Year holiday, Winter 30th is the New Year's Eve holiday. + * - Human-readable date format is always Year-MonthName-Date, no matter where you (the real-life you) come from. + * For number-only format, months are enumerated from 1. + * (Spring-1, Summer-2, Autumn-3, Winter-4) E.g. 0125-Wint-07, or 0125-04-07. For more details, please refer to the + * internal functions `getFormattedTime()`, `getShortTime()`, and `getFilenameTime()` + * - Preferred computerised date format is YearMonthDate. E.g. 01250407 + * - Rest of the format (e.g. time intervals) follows ISO 8601 standard. * * (Check please:) * - Equinox/Solstice always occur on 21st day of the month @@ -201,11 +201,13 @@ class WorldTime(initTime: Long = 0L) { /** Format: "%A, %Y %B %d %X" */ fun getFormattedTime() = "${getDayNameShort()}, " + "$years " + - "${getMonthNameShort()} " + + "${getMonthNameFull()} " + "$days " + "${String.format("%02d", hours)}:" + "${String.format("%02d", minutes)}:" + "${String.format("%02d", seconds)}" + fun getShortTime() = "${years.toString().padStart(4, '0')}-${getMonthNameShort()}-${days.toString().padStart(2, '0')}" + fun getFilenameTime() = "${years.toString().padStart(4, '0')}${months.toString().padStart(2, '0')}${days.toString().padStart(2, '0')}" fun getDayNameFull() = DAY_NAMES[dayOfWeek] fun getDayNameShort() = DAY_NAMES_SHORT[dayOfWeek] diff --git a/src/net/torvald/terrarum/modulecomputers/virtualcomputer/luaapi/WorldInformationProvider.kt b/src/net/torvald/terrarum/modulecomputers/virtualcomputer/luaapi/WorldInformationProvider.kt index 0cbeedd87..85e303320 100644 --- a/src/net/torvald/terrarum/modulecomputers/virtualcomputer/luaapi/WorldInformationProvider.kt +++ b/src/net/torvald/terrarum/modulecomputers/virtualcomputer/luaapi/WorldInformationProvider.kt @@ -60,7 +60,7 @@ class WorldInformationProvider(globals: Globals) { "%x" -> "${String.format("%02d", time.years)}-${String.format("%02d", time.months)}-${String.format("%02d", time.days)}" "%X" -> "${String.format("%02d", time.hours)}:${String.format("%02d", time.minutes)}:${String.format("%02d", time.seconds)}" "%Y" -> time.years.toString() - "%y" -> time.years.mod(100).toString() + "%y" -> time.years.rem(100).toString() "%%" -> "%" else -> throw IllegalArgumentException("Unknown format string: $this") }