Esempio n. 1
0
func (h *Handler) CommandQuitGame(g overpower.GameDat, f overpower.FactionDat, turnStr string) (errServer, errUser error) {
	turnI, err := strconv.Atoi(turnStr)
	if err != nil || turnI != g.Turn() {
		return nil, NewError("FORM SUBMISSION TURN DOES NOT MATCH GAME TURN")
	}
	f.DELETE()
	return h.M.Close(), nil
}
Esempio n. 2
0
func (h *Handler) CommandDropFaction(g overpower.GameDat, f overpower.FactionDat) (errServer, errUser error) {
	if g.Turn() > 0 {
		return nil, NewError("GAME IN PROGRESS")
	}
	if f == nil {
		return nil, NewError("USER HAS NO FACTION FOR THIS GAME")
	}
	f.DELETE()
	err := h.M.Close()
	if my, bad := Check(err, "command drop faction failure", "game", g, "faction", f); bad {
		return my, nil
	}
	return nil, nil
}