]> git.cworth.org Git - empires-server/commit
Move some checks from TicTacToe.add_move to Game.add_move
authorCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 20:56:45 +0000 (13:56 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 5 Jun 2020 21:00:55 +0000 (14:00 -0700)
commit041cdbd90052345df5a05779ada61aec53e403d4
tree55e571190fdcb4debaec756203b4e17141f4fc65
parentfbb338a161c79e0f889a30d8f08058c16583944b
Move some checks from TicTacToe.add_move to Game.add_move

Specifically, the checks for whether the player who submitted a move
belongs on a team and belongs to the team that has the next move.

These checks belong in the generic Game class so that future games
won't have to maintain their own copies of these implementations.

Previously, we were using the presence of the "add_move" property on a
game class to determine whether to add the "/move" route. Now that we
are adding add_move to the base class, we have to check specifically
whether the child class has its own add_move (with
hasOwnProperty('add_move')) to know whether the "/move" route should
be added.
game.js
lmno.js
tictactoe.js