____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

button_checks.cpp File Reference

The button checks. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "unittype.h"
#include "upgrade.h"
#include "interface.h"
#include "network.h"
#include "player.h"

Go to the source code of this file.

Functions

bool ButtonCheckTrue (const CUnit *unit, const ButtonAction *button)
 < Check is always true
bool ButtonCheckFalse (const CUnit *unit, const ButtonAction *button)
 Check if allowed units exists.
bool ButtonCheckUnitsOr (const CUnit *unit, const ButtonAction *button)
 Check if allowed units exists.
bool ButtonCheckUnitsAnd (const CUnit *unit, const ButtonAction *button)
 Check if have network play.
bool ButtonCheckNetwork (const CUnit *unit, const ButtonAction *button)
 Check if don't have network play.
bool ButtonCheckNoNetwork (const CUnit *unit, const ButtonAction *button)
 Check if unit isn't working (train).
bool ButtonCheckNoWork (const CUnit *unit, const ButtonAction *button)
 Check if all requirements for an attack to are meet.
bool ButtonCheckAttack (const CUnit *unit, const ButtonAction *button)


Detailed Description

The button checks.

Definition in file button_checks.cpp.


Function Documentation

bool ButtonCheckAttack ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for an attack are met.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 180 of file button_checks.cpp.

References CUnitType::CanAttack, and CUnit::Type.

Referenced by CclDefineButton(), and IsButtonAllowed().

bool ButtonCheckFalse ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

Check for button enabled, always false. This needed to overwrite the internal tests.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 73 of file button_checks.cpp.

Referenced by CclDefineButton().

bool ButtonCheckNetwork ( const CUnit unit,
const ButtonAction button 
)

Check if don't have network play.

Check if network play is enabled.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.
Note:
: this check could also be moved into intialisation.

Definition at line 138 of file button_checks.cpp.

References IsNetworkGame.

Referenced by CclDefineButton().

bool ButtonCheckNoNetwork ( const CUnit unit,
const ButtonAction button 
)

Check if unit isn't working (train).

Check if network play is disabled.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if disabled.
Note:
: this check could also be moved into intialisation.

Definition at line 153 of file button_checks.cpp.

References IsNetworkGame.

Referenced by CclDefineButton().

bool ButtonCheckNoWork ( const CUnit unit,
const ButtonAction button 
)

Check if all requirements for an attack to are meet.

Check for button enabled, if the unit isn't working. Working is training.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 167 of file button_checks.cpp.

References CUnit::Orders, and UnitActionTrain.

Referenced by CclDefineButton().

bool ButtonCheckTrue ( const CUnit unit,
const ButtonAction button 
)

< Check is always true

ButtonCheck for button enabled, always true. This needed to overwrite the internal tests.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 59 of file button_checks.cpp.

Referenced by CclDefineButton().

bool ButtonCheckUnitsAnd ( const CUnit unit,
const ButtonAction button 
)

Check if have network play.

Check for button enabled, if all units are available.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 111 of file button_checks.cpp.

References ButtonAction::AllowStr, CPlayer::HaveUnitTypeByIdent(), new_strdup(), and CUnit::Player.

Referenced by CclDefineButton().

bool ButtonCheckUnitsOr ( const CUnit unit,
const ButtonAction button 
)

Check if allowed units exists.

Check for button enabled, if any unit is available.

Parameters:
unit Pointer to unit for button.
button Pointer to button to check/enable.
Returns:
True if enabled.

Definition at line 86 of file button_checks.cpp.

References ButtonAction::AllowStr, CPlayer::HaveUnitTypeByIdent(), new_strdup(), and CUnit::Player.

Referenced by CclDefineButton().


Generated on Sat Feb 21 00:28:16 2009 for Bos Wars by  doxygen 1.5.6