Fix 2v1 battles' ship memorials (2)
authorTheSaminator <thesaminator@users.noreply.github.com>
Wed, 13 Jul 2022 15:10:14 +0000 (11:10 -0400)
committerTheSaminator <thesaminator@users.noreply.github.com>
Wed, 13 Jul 2022 15:10:14 +0000 (11:10 -0400)
src/jvmMain/kotlin/net/starshipfights/data/admiralty/battle_records.kt
src/jvmMain/kotlin/net/starshipfights/game/server_game.kt
src/jvmMain/kotlin/net/starshipfights/info/views_user.kt

index 6b4671993d0575786ba9f37515aae3179e2b86bb..fa9d73912623494e7a42c39befe4b7f789af66ca 100644 (file)
@@ -33,7 +33,7 @@ data class BattleRecord(
        
        val winner: GlobalSide?,
        val winMessage: String,
-       val was2v2: Boolean = false,
+       val was2v1: Boolean = false,
 ) : DataDocument<BattleRecord> {
        fun getSide(admiral: Id<Admiral>) = when (admiral) {
                hostAdmiral -> GlobalSide.HOST
@@ -49,7 +49,7 @@ data class BattleRecord(
        
        fun wasWinner(side: GlobalSide) = if (winner == null)
                null
-       else if (was2v2)
+       else if (was2v1)
                winner == GlobalSide.HOST
        else
                winner == side
index 695a4e67dd1e301cb098c0bba1a7036a419dd462..7141cc9f29b77c6f9675789570ec9cc5e1186846 100644 (file)
@@ -450,7 +450,8 @@ private suspend fun on2v1GameEnd(gameState: GameState, gameEnd: GameEvent.GameEn
                guestEndingMessage = victoryTitle(GlobalShipController(GlobalSide.HOST, GlobalShipController.Player2Disambiguation), gameEnd.winner, gameEnd.subplotOutcomes),
                
                winner = gameEnd.winner,
-               winMessage = gameEnd.message
+               winMessage = gameEnd.message,
+               was2v1 = true,
        )
        
        val destructions = shipWrecks.filterValues { !it.isEscape }
index 2253f9625b808c70249ead8f810656e51d1ff0e8..7482da2df9163156f05754a3ae2a81ee98402c28 100644 (file)
@@ -505,7 +505,7 @@ suspend fun ApplicationCall.admiralPage(): HTML.() -> Unit {
                                                        val opponent = recordOpponents[ship.destroyedIn]
                                                        if (opponent == null)
                                                                i { +"(Deleted Admiral)" }
-                                                       else if (records.singleOrNull { it.id == ship.destroyedIn }?.was2v2 == true)
+                                                       else if (records.singleOrNull { it.id == ship.destroyedIn }?.was2v1 == true)
                                                                i { +"(Non-Player Admiral)" }
                                                        else
                                                                a(href = "/admiral/${opponent.id}") {