$treeview $search $mathjax
Stratagus  2.2.6
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
           Stratagus - A free fantasy real time strategy game engine

src/ui/botpanel.cpp File Reference

#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 "depend.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"

botpanel.cpp - The bottom panel.

int CurrentButtonLevel
 for unit buttons sub-menus etc.
std::vector< ButtonAction * > UnitButtonTable
 All buttons for units.
ButtonActionProxy CurrentButtons
 Pointer to current buttons.
void InitButtons ()
 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 &descr, const std::string &sound, const std::string &cursor, const std::string &umask)
 Make a new button.
void CleanButtons ()
 Free memory for buttons.
static int GetButtonStatus (const ButtonAction *button, int UnderCursor)
static int GetPopupCostsWidth (const CFont *font, const int *Costs)
static int DrawPopupCosts (int x, int y, const CLabel &label, const int *Costs)
void DrawPopupUnitInfo (const CUnitType *type, int player_index, CFont *font, Uint32 backgroundColor, int buttonX, int buttonY)
static void DrawPopup (const ButtonAction *button, const CUIButton *uibutton)
void UpdateStatusLineForButton (const ButtonAction *button)
 Update the status line with hints from the button.
static bool IsButtonAllowed (const CUnit &unit, const ButtonAction *buttonaction)
static ButtonActionUpdateButtonPanelMultipleUnits ()
static ButtonActionUpdateButtonPanelSingleUnit (const CUnit &unit)

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 &  descr,
const std::string &  sound,
const std::string &  cursor,
const std::string &  umask 
)

Make a new button.

FIXME: docu

void CleanButtons (  ) 

Free memory for buttons.

Cleanup buttons.

static void DrawPopup ( const ButtonAction button,
const CUIButton uibutton 
) [static]

Draw popup

static int DrawPopupCosts ( int  x,
int  y,
const CLabel label,
const int *  Costs 
) [static]

void DrawPopupUnitInfo ( const CUnitType type,
int  player_index,
CFont font,
Uint32  backgroundColor,
int  buttonX,
int  buttonY 
)

static int GetButtonStatus ( const ButtonAction button,
int  UnderCursor 
) [static]

Return Status of button.

Parameters:
button button to check status
UnderCursor Current Button Under Cursor
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)

static int GetPopupCostsWidth ( const CFont font,
const int *  Costs 
) [static]

void InitButtons (  ) 

Generate all buttons.

Initialize the buttons.

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

Check if the button is allowed for the unit.

Parameters:
unit unit which checks for allow.
buttonaction button to check if it is allowed.
Returns:
1 if button is allowed, 0 else.
Todo:
FIXME: better check. (dependancy, resource, ...)
Todo:
FIXME: make difference with impossible and not yet researched.

static ButtonAction* UpdateButtonPanelMultipleUnits (  )  [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...

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.

void UpdateStatusLineForButton ( const ButtonAction button  ) 

Update the status line with hints from the button.

Update the status line with hints from the button

Parameters:
button Button


Variable Documentation

for unit buttons sub-menus etc.

vladi: used for unit buttons sub-menus etc

Pointer to current buttons.

std::vector<ButtonAction *> UnitButtonTable

All buttons for units.

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.