// Emacs style mode select   -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: b8a69a47b5d5bba5a47f4fcb9434a2d1d1261738 $
//
// Copyright (C) 2006-2020 by The Odamex Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//   Implements warmup stubs for the client.
//
//-----------------------------------------------------------------------------

#include "g_warmup.h"

Warmup warmup;

// Status getter
Warmup::status_t Warmup::get_status()
{
	return this->status;
}

// Always allow score changes on the client
bool Warmup::checkscorechange()
{
	// We should be able to refresh the scores if we're not on a warmup game.
	if (this->status == Warmup::DISABLED)
		return true;

	// Disallow score changes if the warmup status is not in a match.
	if (this->status != Warmup::INGAME)
		return false;

	return true;
}

// Don't allow players to fire their weapon if the server is in the middle
// of a countdown.
bool Warmup::checkfireweapon()
{
	// If we're not online, allow player to fire.
	if (!multiplayer)
		return true;

	if (this->status == Warmup::COUNTDOWN || this->status == Warmup::FORCE_COUNTDOWN)
		return false;
	return true;
}

// Set the warmup status.  This is a clientside function, governed by
// the server.
void Warmup::set_client_status(Warmup::status_t new_status)
{
	this->status = new_status;
}
