fixing the critical bug in active/dormant thingies, actor ID is now positive integer (I had to), class Actor is now shipped with ID generator, optimisation in add/removeActor

Former-commit-id: f743ecb27ba1cea05215889d7e1a77e10171cb8c
Former-commit-id: 4b88f9711c34542a8a504682cffe79a2f8a43ed8
This commit is contained in:
Song Minjae
2016-04-25 01:58:17 +09:00
parent c4b64140be
commit 1dc3e6df3e
10 changed files with 145 additions and 98 deletions

View File

@@ -15,7 +15,7 @@ import java.util.regex.Pattern
*/
object CommandInterpreter {
private val commandsNoAuth = arrayOf("auth", "qqq", "zoom", "setlocale", "getlocale", "help")
private val commandsNoAuth = arrayOf("auth", "qqq", "zoom", "setlocale", "getlocale", "help", "version")
private val ccW = GameFontBase.colToCode["w"]
private val ccG = GameFontBase.colToCode["g"]

View File

@@ -52,7 +52,7 @@ class GetAV : ConsoleCommand {
}
else {
// args[1] is actor ID
val actor = Terrarum.game.getActor(args[1].toInt())
val actor = Terrarum.game.getActorByID(args[1].toInt())
val av = actor.actorValue
val keyset = av.keySet
@@ -74,14 +74,14 @@ class GetAV : ConsoleCommand {
val id = args[1].toInt()
val av = args[2]
echo.execute("$ccW$id.$ccM$av $ccW= $ccG" +
Terrarum.game.getActor(id).actorValue[av] +
Terrarum.game.getActorByID(id).actorValue[av] +
" $ccO" +
Terrarum.game.getActor(id).actorValue[av]!!.javaClass.simpleName
Terrarum.game.getActorByID(id).actorValue[av]!!.javaClass.simpleName
)
println("id.av = " +
Terrarum.game.getActor(id).actorValue[av] +
Terrarum.game.getActorByID(id).actorValue[av] +
" " +
Terrarum.game.getActor(id).actorValue[av]!!.javaClass.simpleName
Terrarum.game.getActorByID(id).actorValue[av]!!.javaClass.simpleName
)
}
}

View File

@@ -24,7 +24,7 @@ class GetFactioning : ConsoleCommand {
val echo = Echo()
fun printOutFactioning(id: Int) {
val a = Terrarum.game.getActor(id)
val a = Terrarum.game.getActorByID(id)
if (a is Factionable) {
echo.execute("$ccW== Faction assignment for $ccY${if (id == Player.PLAYER_REF_ID) "player" else id.toString()} $ccW==")
println("[GetFactioning] == Faction assignment for '${if (id == Player.PLAYER_REF_ID) "player" else id.toString()}' ==")

View File

@@ -77,7 +77,7 @@ internal class SetAV : ConsoleCommand {
try {
val id = args[1].toInt()
val `val` = parseAVInput(args[3])
val actor = Terrarum.game.getActor(id)
val actor = Terrarum.game.getActorByID(id)
// check if av is number
if (args[2].isNum()) {

View File

@@ -1,13 +1,13 @@
package net.torvald.terrarum.console
import net.torvald.terrarum.VERSION_STRING
import net.torvald.terrarum.Terrarum
/**
* Created by minjaesong on 16-04-23.
*/
class Version : ConsoleCommand {
override fun execute(args: Array<String>) {
Echo().execute(VERSION_STRING)
Echo().execute("${Terrarum.NAME} ${Terrarum.VERSION_STRING}")
}
override fun printUsage() {