Game coordinates store months' names, not their index so get the index first before comparing
This commit is contained in:
parent
313d91bcaf
commit
244215f09b
1 changed files with 5 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import Flower from Hanafuda;
|
||||
import Messaging;
|
||||
import player from Room;
|
||||
import Save;
|
||||
|
@ -62,9 +63,11 @@ function isAgainst(state, playerID) {
|
|||
}
|
||||
|
||||
function compare(gameCoordinatesA, gameCoordinatesB) {
|
||||
if(gameCoordinatesA.month < gameCoordinatesB.month) {
|
||||
var monthIndexA = Flower[gameCoordinatesA.month];
|
||||
var monthIndexB = Flower[gameCoordinatesB.month];
|
||||
if(monthNumberA < monthNumberB) {
|
||||
return -1;
|
||||
} else if(gameCoordinatesA.month > gameCoordinatesB.month) {
|
||||
} else if(monthIndexA > monthIndexB) {
|
||||
return 1;
|
||||
} else if(gameCoordinatesA.turn < gameCoordinatesB.turn) {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue