Steam Fort 0.5
Functions | Variables

src/mobile.cpp File Reference

#include "libtcod.hpp"
#include "mobile.hpp"
#include "utils.hpp"
#include "main.hpp"
#include <iostream>
#include "gui/gui.hpp"
#include "ui.hpp"
#include <stdio.h>
#include "message.hpp"
#include <map>
#include "adventure.hpp"
#include "game.hpp"

Functions

void buildMobileUI ()
 Build crew user interface.
void advanceClb (Widget *w, void *data)
 Update user stats.
void equip2Clb (Widget *w, void *data)
 Wear selected item.
void equipClb (Widget *w, void *data)
 Show available equipment for selected location.
void renameClb (Widget *wid, char *val, void *data)
 Rename selected mob.
void addinvClb (Widget *w, void *data)
 Add item to inventory.
void removeinvClb (Widget *w, void *data)
 Remove item from inventory.
void drawItems (int index)
 Draw all items which can be put to inventory.
void inventoryClb (Widget *w, void *data)
 Manage player inventory.
int showMobInfo (int index)
 Show informations about selected mobile.
void mobClb (Widget *w, void *data)
 Show information about selected mobile.
void setVisibleCrew (bool visible)
 Show/hide information about fort crew.
int find_proto_mob (std::string name, int type)
 Find proto mobile by name or type.
int find_mob (string name, int x, int y)
 Find mobile by name or position.
TCODList< int > find_all_proto_mobs (int type, int notlocation, int maxlevel)
 Find all prototypes with selected type.
int find_near_mob (std::string name, int x, int y, int radius, TCODList< int > *types, int fovradius, bool visible)
 Find nearest mobile from selected position.
TCODList< int > find_all_mobs (int type)
 Find all mobiles with selected type.

Variables

Container * mobsmenu = new Container(0, 0, SCREENWIDTH, SCREENHEIGHT)
Container * mobmenu = new Container(30, 10, 80, 70)
ToolBar * tmpbar = new ToolBar(65, 16, "Available items")
Container * mobinv = new Container(0, 0, SCREENWIDTH, SCREENHEIGHT)
ToolBar * inv = new ToolBar(2, 2, "Inventory")
ToolBar * available = new ToolBar(60, 2, "Available items")

Function Documentation

void addinvClb ( Widget *  w,
void *  data 
)

Add item to inventory.

Parameters:
wUnused.
dataName of item to add to inventory.
void advanceClb ( Widget *  w,
void *  data 
)

Update user stats.

Parameters:
wUnused
dataValue from button from UI.
void buildMobileUI ( )

Build crew user interface.

void drawItems ( int  index)

Draw all items which can be put to inventory.

Parameters:
indexIndex of mob.
void equip2Clb ( Widget *  w,
void *  data 
)

Wear selected item.

Parameters:
wUnused.
dataLocation and name of item to wear.
void equipClb ( Widget *  w,
void *  data 
)

Show available equipment for selected location.

Parameters:
wUnused.
dataName of location to show.
TCODList<int> find_all_mobs ( int  type)

Find all mobiles with selected type.

Parameters:
typeType of mobiles to find.
Returns:
List of indexes of mobiles.
TCODList<int> find_all_proto_mobs ( int  type,
int  notlocation,
int  maxlevel 
)

Find all prototypes with selected type.

Parameters:
typeMobile type to find.
notlocationFrom which location mobiles should be avoid.
maxlevelMax level of mobs to find.
Returns:
List of indexes of mobiles.
int find_mob ( string  name,
int  x,
int  y 
)

Find mobile by name or position.

Parameters:
nameName of mobile to find. Default is empty.
xX-axis position of mob. Default is -1.
yY-axis position of mob. Default is -1.
Returns:
Index of mobile in fortmobiles vector. If not found, return -1.
int find_near_mob ( std::string  name,
int  x,
int  y,
int  radius,
TCODList< int > *  types,
int  fovradius,
bool  visible 
)

Find nearest mobile from selected position.

Parameters:
nameName of mob to find.
xX-axis of start search position.
yY-axis of start search position.
radiusSize of radius to search.
typesTypes of mob to find. Default empty.
fovradiusSize of radius of field of view.
visibleSearch only for visible mobs. Default is true.
Returns:
Index of mobile in fortmobs vector. If mobile not found, return -1.
int find_proto_mob ( std::string  name,
int  type 
)

Find proto mobile by name or type.

Parameters:
nameName of object to find
typeType of object to find
Returns:
Object index in protoobjs
void inventoryClb ( Widget *  w,
void *  data 
)

Manage player inventory.

Parameters:
wUnused.
dataIndex of player.
void mobClb ( Widget *  w,
void *  data 
)

Show information about selected mobile.

Parameters:
wUnused.
dataSelected mob name.
void removeinvClb ( Widget *  w,
void *  data 
)

Remove item from inventory.

Parameters:
wUnused
dataIndex of item to remove
void renameClb ( Widget *  wid,
char *  val,
void *  data 
)

Rename selected mob.

Parameters:
widUnused.
valNew name of mob.
dataIndex of mob.
void setVisibleCrew ( bool  visible)

Show/hide information about fort crew.

Parameters:
visibleIf true, show fort crew, otherwise hide menu.
int showMobInfo ( int  index)

Show informations about selected mobile.

Parameters:
indexIndex of selected mobile.
Returns:
Index of selected mobile.

Variable Documentation

ToolBar* available = new ToolBar(60, 2, "Available items")
ToolBar* inv = new ToolBar(2, 2, "Inventory")
Container* mobinv = new Container(0, 0, SCREENWIDTH, SCREENHEIGHT)
Container* mobmenu = new Container(30, 10, 80, 70)
Container* mobsmenu = new Container(0, 0, SCREENWIDTH, SCREENHEIGHT)
ToolBar* tmpbar = new ToolBar(65, 16, "Available items")
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines