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

       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"

botpanel.cpp File Reference

The bottom panel. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <sstream>
#include "stratagus.h"
#include "unit.h"
#include "unittype.h"
#include "upgrade.h"
#include "interface.h"
#include "ui.h"
#include "player.h"
#include "spells.h"
#include "sound.h"
#include "map.h"
#include "commands.h"
#include "video.h"
#include "font.h"
#include "guichan/key.h"
#include "guichan/sdl/sdlinput.h"

Go to the source code of this file.

Functions

void InitButtons (void)
 < Generate all buttons
int AddButton (int pos, int level, const std::string &icon_ident, ButtonCmd action, const std::string &value, const ButtonCheckFunc func, const std::string &allow, const std::string &hint, const std::string &umask)
void CleanButtons (void)
 Make a new button.
static int GetButtonStatus (const ButtonAction *button)
static void DrawPopup ()
void UpdateStatusLineForButton (const ButtonAction *button)
 Draw the Pie Menu.
static bool IsButtonAllowed (const CUnit *unit, const ButtonAction *buttonaction)
static ButtonActionUpdateButtonPanelMultipleUnits (void)
static ButtonActionUpdateButtonPanelSingleUnit (const CUnit *unit)

Variables

int CurrentButtonLevel
 < for unit buttons sub-menus etc.
std::vector< ButtonAction * > UnitButtonTable
 Pointer to current buttons.
ButtonActionCurrentButtons
 Current Selected Buttons.


Detailed Description

The bottom panel.

Definition in file botpanel.cpp.


Function Documentation

int AddButton ( int  pos,
int  level,
const std::string &  icon_ident,
ButtonCmd  action,
const std::string &  value,
const ButtonCheckFunc  func,
const std::string &  allow,
const std::string &  hint,
const std::string &  umask 
)

void CleanButtons ( void   ) 

Make a new button.

Cleanup buttons.

Definition at line 163 of file botpanel.cpp.

References Assert, CurrentButtonLevel, int(), and UnitButtonTable.

Referenced by CleanModules().

static void DrawPopup (  )  [static]

static int GetButtonStatus ( const ButtonAction button  )  [static]

Return Status of button.

Parameters:
button button to check status
Returns:
status of button

Icon(Active | Selected | Clicked | AutoCast | Disabled).

Todo:
FIXME : add IconDisabled when needed.
Todo:
FIXME : Should show the rally action for training unit ? (NewOrder)

Definition at line 188 of file botpanel.cpp.

References ButtonAction::Action, Assert, AutoCastSpell(), AutoRepair(), ButtonAreaButton, ButtonAreaUnderCursor, ButtonAttack, ButtonAttackGround, ButtonHarvest, ButtonMove, ButtonPatrol, ButtonRepair, ButtonSpellCast, ButtonStandGround, ButtonStop, ButtonUnderCursor, IconActive, IconAutoCast, IconClicked, IconSelected, LeftButton, MouseButtons, NumSelected, ButtonAction::Pos, Selected, UnitActionAttack, UnitActionAttackGround, UnitActionBuild, UnitActionFollow, UnitActionMove, UnitActionNone, UnitActionPatrol, UnitActionRepair, UnitActionResource, UnitActionStandGround, UnitActionStill, and ButtonAction::Value.

Referenced by CButtonPanel::Draw().

void InitButtons ( void   ) 

< Generate all buttons

Initialize the buttons.

Definition at line 82 of file botpanel.cpp.

References int(), and UnitButtonTable.

Referenced by CreateGame(), and InitModules().

static bool IsButtonAllowed ( const CUnit unit,
const ButtonAction buttonaction 
) [static]

static ButtonAction* UpdateButtonPanelMultipleUnits ( void   )  [static]

Update bottom panel for multiple units.

Returns:
array of UI.ButtonPanel.NumButtons buttons to show.
Todo:
FIXME : make UpdateButtonPanelMultipleUnits more configurable.
Todo:
show all possible buttons or just same button...

Definition at line 584 of file botpanel.cpp.

References Assert, CUserInterface::ButtonPanel, CButtonPanel::Buttons, CurrentButtonLevel, int(), IsButtonAllowed(), NumSelected, ButtonAction::Pos, Selected, UI, and UnitButtonTable.

Referenced by CButtonPanel::Update().

static ButtonAction* UpdateButtonPanelSingleUnit ( const CUnit unit  )  [static]

Update bottom panel for single unit. or unit group with the same type.

Parameters:
unit unit which has actions shown with buttons.
Returns:
array of UI.ButtonPanel.NumButtons buttons to show.
Todo:
FIXME : Remove Hack for cancel button.

Definition at line 638 of file botpanel.cpp.

References Assert, CUserInterface::ButtonPanel, CButtonPanel::Buttons, CurrentButtonLevel, CUnitType::Ident, int(), IsButtonAllowed(), ButtonAction::Level, CUnit::Orders, ButtonAction::Pos, CUnit::Type, UI, UnitActionBuilt, UnitButtonTable, and ButtonAction::UnitMask.

Referenced by CButtonPanel::Update().

void UpdateStatusLineForButton ( const ButtonAction button  ) 

Draw the Pie Menu.

Update the status line with hints from the button

Parameters:
button Button

Definition at line 477 of file botpanel.cpp.

References ButtonAction::Action, Assert, ButtonBuild, ButtonSpellCast, ButtonTrain, ClearCosts(), ButtonAction::Hint, CStatusLine::Set(), SetCosts(), SpellTypeTable, CUserInterface::StatusLine, UI, UnitTypes, and ButtonAction::Value.

Referenced by CButtonPanel::Draw(), and DrawPieMenu().


Variable Documentation

Current Selected Buttons.

Definition at line 73 of file botpanel.cpp.

Referenced by DrawPieMenu(), HandleMouseOn(), and HandlePieMenuMouseSelection().

std::vector<ButtonAction *> UnitButtonTable

Pointer to current buttons.

Definition at line 72 of file botpanel.cpp.

Referenced by AddButton(), CleanButtons(), InitAiHelper(), InitButtons(), UpdateButtonPanelMultipleUnits(), and UpdateButtonPanelSingleUnit().


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