Crossfire Client, Branches  R11627
inventory.c File Reference
#include "gx11.h"
#include "client.h"
#include "gtkproto.h"
#include "pixmaps/all.xpm"
#include "pixmaps/hand.xpm"
#include "pixmaps/hand2.xpm"
#include "pixmaps/coin.xpm"
#include "pixmaps/skull.xpm"
#include "pixmaps/mag.xpm"
#include "pixmaps/nonmag.xpm"
#include "pixmaps/lock.xpm"
#include "pixmaps/unlock.xpm"
+ Include dependency graph for inventory.c:

Go to the source code of this file.

Data Structures

struct  fixed_tab_init
 
struct  inventory_viewer
 
struct  item_delete
 

Macros

#define bool   uint8 /* Grr! Pick *something*, please! */
 
#define FMT_WEIGHT(buf, buf_size, it)   snprintf(buf, buf_size, "%6.1f" , it->nrof * it->weight)
 
#define MAGIC_SAFE_WIDTH   75
 
#define TYPE_LISTS   9
 

Typedefs

typedef bool(* itemfilter )(item *it)
 

Functions

static void add_removal_victim (gpointer view_x, gpointer victim_views_p_x)
 
static void animate_item (gpointer view_x, gpointer item_x)
 
static void animate_items (void)
 
static void animate_one_item (gpointer item_x, gpointer ignored)
 
void close_container (item *op)
 
static void close_container_callback (item *op)
 
void command_show (const char *params)
 
static void container_clearing_one (gpointer view_x, gpointer op_x)
 
static void count_callback (GtkWidget *widget, GtkWidget *entry)
 
void get_inv_display (GtkWidget *frame)
 
static GtkWidget * get_inv_widget (void)
 
void get_look_display (GtkWidget *frame)
 
static GtkWidget * get_look_widget (void)
 
static void highlight_item (GtkWidget *list, item *it, gint row)
 
void inventory_splitwin_toggling (void)
 
void inventory_tick (void)
 
static void inventory_viewer_set_container (inventory_viewer *view, item *new_cont)
 
static void inventory_viewer_set_highlight (inventory_viewer *view, bool highlight)
 
static void inventory_viewer_set_show_flags (inventory_viewer *view, bool show_flags)
 
static void inventory_viewer_set_show_weight (inventory_viewer *view, bool show_weight)
 
static void item_changed_anim_hook (item *op)
 
static void item_changed_one (gpointer view_x, gpointer op_x)
 
static void item_deleting_one (gpointer view_x, gpointer op_x)
 
void item_event_container_clearing (item *op)
 
void item_event_item_changed (item *op)
 
void item_event_item_deleting (item *op)
 
static void item_tick_per_view (gpointer data, gpointer user_data_ignored)
 
static void item_to_widget_remove_item (item *const op)
 
static void item_to_widget_remove_widget (inventory_viewer *view)
 
static item_deleteitem_to_widget_retrieve (item *op)
 
static GList * item_to_widget_retrieve_viewers (item *op)
 
static void item_to_widget_store (item *op, inventory_viewer *view)
 
void itemlist_set_show_icon (itemlist *l, int new_setting)
 
static void itemview_tick (void)
 
static void list_button_event (GtkWidget *gtklist, gint row, gint column, GdkEventButton *event, inventory_viewer *view)
 
static inventory_viewernew_inventory_viewer (item *container, itemfilter filter, item *move_dest)
 
static void nuke_view (gpointer view_x, gpointer notused)
 
void open_container (item *op)
 
static void rebuild_our_widget (inventory_viewer *view)
 
static void redraw_on_show (GtkWidget *a, GdkEventVisibility *event, gpointer view_x)
 
static void remove_widget_one (gpointer item_and_widget_x, gpointer view_x)
 
static void resize_left_widget_one (gpointer view_x, gpointer total_width_x)
 
static void resize_left_widgets (GtkWidget *widget, GtkAllocation *event)
 
static void set_flags_one (gpointer view_x, gpointer show_flags)
 
static void set_inv_flags (bool show_flags)
 
static void set_look_flags (bool show_flags)
 
void set_look_list_env (item *op)
 
static void set_look_list_env_one (gpointer view_x, gpointer new_look_x)
 
void set_show_icon (const char *s)
 
void set_show_weight (const char *s)
 
static void set_show_weight_inv_one (gpointer view_x, gpointer new_setting)
 
void set_weight_limit (uint32 wlim)
 
static bool show_all (item *ignored)
 
static bool show_applied (item *it)
 
static bool show_cursed (item *it)
 
static bool show_locked (item *it)
 
static bool show_magical (item *it)
 
static bool show_nonmagical (item *it)
 
static bool show_unapplied (item *it)
 
static bool show_unlocked (item *it)
 
static bool show_unpaid (item *it)
 
void update_list_labels (itemlist *l)
 
static void update_lists_labels (void)
 
static bool view_visible (inventory_viewer *view)
 

Variables

static GList * animated_items = NULL
 
GtkWidget * closebutton
 
GtkWidget * counttext
 
static fixed_tab_init fixed_tabs [TYPE_LISTS]
 
GdkColor gdk_black
 
GdkColor gdk_grey
 
static GList * highlit_inv_viewers = NULL
 
itemlist inv_list
 
static GtkWidget * inv_notebook = NULL
 
static GList * inv_viewers = NULL
 
static GList * item_to_widgets = NULL
 
itemlist look_list
 
static inventory_viewerlook_viewer = NULL
 
static GtkWidget * look_widget = NULL
 
GtkWidget * spellinventory
 
static GList * views
 

Macro Definition Documentation

#define bool   uint8 /* Grr! Pick *something*, please! */

Definition at line 13 of file inventory.c.

#define FMT_WEIGHT (   buf,
  buf_size,
  it 
)    snprintf(buf, buf_size, "%6.1f" , it->nrof * it->weight)

Definition at line 335 of file inventory.c.

Referenced by rebuild_our_widget().

#define MAGIC_SAFE_WIDTH   75

Definition at line 844 of file inventory.c.

Referenced by resize_left_widgets().

#define TYPE_LISTS   9

Definition at line 743 of file inventory.c.

Referenced by command_show(), and get_inv_widget().

Typedef Documentation

typedef bool(* itemfilter)(item *it)

Definition at line 20 of file inventory.c.

Function Documentation

static void add_removal_victim ( gpointer  view_x,
gpointer  victim_views_p_x 
)
static

Definition at line 775 of file inventory.c.

Referenced by inventory_splitwin_toggling().

+ Here is the caller graph for this function:

static void animate_item ( gpointer  view_x,
gpointer  item_x 
)
static

Definition at line 251 of file inventory.c.

References inventory_viewer::complete_rebuild, item_struct::face, PixmapInfo::icon_image, PixmapInfo::icon_mask, inventory_viewer::list, and pixmaps.

Referenced by animate_one_item().

+ Here is the caller graph for this function:

static void animate_items ( void  )
static

Definition at line 293 of file inventory.c.

References animate_one_item(), and animated_items.

Referenced by itemview_tick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void animate_one_item ( gpointer  item_x,
gpointer  ignored 
)
static

Definition at line 267 of file inventory.c.

References item_struct::anim_speed, item_struct::anim_state, animate_item(), item_struct::animation_id, animations, item_struct::face, Animations::faces, item_to_widget_retrieve_viewers(), item_struct::last_anim, Animations::num_animations, and views.

Referenced by animate_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void close_container ( item op)

Definition at line 1342 of file inventory.c.

static void close_container_callback ( item op)
static

Definition at line 1359 of file inventory.c.

References Player_Struct::below, client_send_apply(), closebutton, cpl, itemlist::env, FALSE, set_look_list_env(), item_struct::tag, itemlist::title, and update_list_labels().

Referenced by get_look_display().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void command_show ( const char *  params)

Definition at line 1153 of file inventory.c.

static void container_clearing_one ( gpointer  view_x,
gpointer  op_x 
)
static

Definition at line 506 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::cont, item_to_widget_remove_widget(), and TRUE.

Referenced by item_event_container_clearing().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void count_callback ( GtkWidget *  widget,
GtkWidget *  entry 
)
static

Definition at line 1074 of file inventory.c.

References Player_Struct::count, counttext, cpl, and gtkwin_info_text.

Referenced by get_inv_display().

+ Here is the caller graph for this function:

void get_inv_display ( GtkWidget *  frame)
void get_look_display ( GtkWidget *  frame)
static GtkWidget* get_look_widget ( void  )
static

Definition at line 994 of file inventory.c.

References Player_Struct::below, cpl, inventory_viewer::face_column_resizes, inventory_viewer::highlight, highlit_inv_viewers, look_widget, new_inventory_viewer(), Player_Struct::ob, inventory_viewer::scroll_window, show_all(), and TRUE.

Referenced by get_look_display().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void highlight_item ( GtkWidget *  list,
item it,
gint  row 
)
static

Definition at line 317 of file inventory.c.

References item_struct::cursed, item_struct::damned, item_struct::magical, NDI_BLUE, NDI_NAVY, NDI_RED, and root_color.

Referenced by rebuild_our_widget().

+ Here is the caller graph for this function:

void inventory_splitwin_toggling ( void  )

Definition at line 790 of file inventory.c.

References add_removal_victim(), highlit_inv_viewers, inv_notebook, inv_viewers, look_widget, and nuke_view().

Referenced by toggle_splitwin().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void inventory_tick ( void  )

Definition at line 1374 of file inventory.c.

static void inventory_viewer_set_container ( inventory_viewer view,
item new_cont 
)
static

Definition at line 644 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::cont, and TRUE.

Referenced by set_look_list_env().

+ Here is the caller graph for this function:

static void inventory_viewer_set_highlight ( inventory_viewer view,
bool  highlight 
)
static

Definition at line 626 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::highlight, and TRUE.

Referenced by get_inv_widget().

+ Here is the caller graph for this function:

static void inventory_viewer_set_show_flags ( inventory_viewer view,
bool  show_flags 
)
static

Definition at line 635 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::show_flags, and TRUE.

Referenced by set_flags_one(), and set_look_flags().

+ Here is the caller graph for this function:

static void inventory_viewer_set_show_weight ( inventory_viewer view,
bool  show_weight 
)
static

Definition at line 617 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::show_weight, and TRUE.

Referenced by set_show_weight(), and set_show_weight_inv_one().

+ Here is the caller graph for this function:

static void item_changed_anim_hook ( item op)
static

Definition at line 298 of file inventory.c.

References item_struct::anim_speed, animated_items, and item_struct::animation_id.

Referenced by item_event_item_changed().

+ Here is the caller graph for this function:

static void item_changed_one ( gpointer  view_x,
gpointer  op_x 
)
static

Definition at line 472 of file inventory.c.

References inventory_viewer::complete_rebuild, inventory_viewer::cont, item_struct::env, and TRUE.

Referenced by item_event_item_changed().

+ Here is the caller graph for this function:

void item_event_container_clearing ( item op)

Definition at line 525 of file inventory.c.

void item_event_item_changed ( item op)

Definition at line 489 of file inventory.c.

void item_event_item_deleting ( item op)

Definition at line 596 of file inventory.c.

static void item_tick_per_view ( gpointer  data,
gpointer  user_data_ignored 
)
static

Definition at line 432 of file inventory.c.

References inventory_viewer::complete_rebuild, rebuild_our_widget(), redraw_needed, TRUE, and view_visible().

Referenced by itemview_tick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void item_to_widget_remove_item ( item *const  op)
static

Definition at line 210 of file inventory.c.

References animated_items, item_delete::it, item_to_widgets, and item_delete::viewers.

Referenced by item_event_item_deleting().

+ Here is the caller graph for this function:

static void item_to_widget_remove_widget ( inventory_viewer view)
static

Definition at line 206 of file inventory.c.

References item_to_widgets, and remove_widget_one().

Referenced by container_clearing_one(), and nuke_view().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static item_delete* item_to_widget_retrieve ( item op)
static

Definition at line 145 of file inventory.c.

References item_delete::it, item_to_widgets, and item_delete::viewers.

Referenced by item_to_widget_retrieve_viewers(), and item_to_widget_store().

+ Here is the caller graph for this function:

static GList* item_to_widget_retrieve_viewers ( item op)
static

Definition at line 171 of file inventory.c.

References item_to_widget_retrieve(), and item_delete::viewers.

Referenced by animate_one_item().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void item_to_widget_store ( item op,
inventory_viewer view 
)
static

Definition at line 175 of file inventory.c.

References item_struct::anim_speed, animated_items, item_struct::animation_id, item_to_widget_retrieve(), and item_delete::viewers.

Referenced by rebuild_our_widget().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void itemlist_set_show_icon ( itemlist l,
int  new_setting 
)

Definition at line 1288 of file inventory.c.

References set_inv_flags(), set_look_flags(), and itemlist::show_icon.

Referenced by applyconfig(), init_windows(), load_defaults(), and set_show_icon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void itemview_tick ( void  )
static

Definition at line 463 of file inventory.c.

References animate_items(), item_tick_per_view(), and views.

Referenced by inventory_tick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void list_button_event ( GtkWidget *  gtklist,
gint  row,
gint  column,
GdkEventButton *  event,
inventory_viewer view 
)
static

Definition at line 658 of file inventory.c.

References client_send_apply(), client_send_examine(), client_send_move(), CONFIG_POPUPS, Player_Struct::count, counttext, cpl, draw_info(), item_struct::locked, inventory_viewer::move_dest, NDI_BLACK, send_mark_obj(), item_struct::tag, toggle_locked(), and use_config.

Referenced by new_inventory_viewer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void nuke_view ( gpointer  view_x,
gpointer  notused 
)
static

Definition at line 783 of file inventory.c.

References item_to_widget_remove_widget(), and views.

Referenced by inventory_splitwin_toggling().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void open_container ( item op)

Definition at line 1334 of file inventory.c.

static void redraw_on_show ( GtkWidget *  a,
GdkEventVisibility *  event,
gpointer  view_x 
)
static

Definition at line 896 of file inventory.c.

References inventory_viewer::complete_rebuild, and rebuild_our_widget().

Referenced by get_inv_widget().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void remove_widget_one ( gpointer  item_and_widget_x,
gpointer  view_x 
)
static

Definition at line 200 of file inventory.c.

References item_delete::viewers.

Referenced by item_to_widget_remove_widget().

+ Here is the caller graph for this function:

static void resize_left_widget_one ( gpointer  view_x,
gpointer  total_width_x 
)
static

Definition at line 820 of file inventory.c.

References inventory_viewer::image_width, and inventory_viewer::list.

Referenced by resize_left_widgets().

+ Here is the caller graph for this function:

static void resize_left_widgets ( GtkWidget *  widget,
GtkAllocation *  event 
)
static

Definition at line 846 of file inventory.c.

References inv_viewers, inventory_viewer::list, MAGIC_SAFE_WIDTH, and resize_left_widget_one().

Referenced by get_inv_widget().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_flags_one ( gpointer  view_x,
gpointer  show_flags 
)
static

Definition at line 1275 of file inventory.c.

References inventory_viewer_set_show_flags().

Referenced by set_inv_flags().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_inv_flags ( bool  show_flags)
static

Definition at line 1280 of file inventory.c.

References inv_viewers, and set_flags_one().

Referenced by itemlist_set_show_icon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_look_flags ( bool  show_flags)
static

Definition at line 1284 of file inventory.c.

References inventory_viewer_set_show_flags().

Referenced by itemlist_set_show_icon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void set_look_list_env ( item op)

Definition at line 1323 of file inventory.c.

References itemlist::env, inv_viewers, inventory_viewer_set_container(), and set_look_list_env_one().

Referenced by close_container(), close_container_callback(), main(), and open_container().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void set_look_list_env_one ( gpointer  view_x,
gpointer  new_look_x 
)
static

Definition at line 1315 of file inventory.c.

References inventory_viewer::move_dest.

Referenced by set_look_list_env().

+ Here is the caller graph for this function:

void set_show_icon ( const char *  s)

Definition at line 1303 of file inventory.c.

void set_show_weight ( const char *  s)

Definition at line 1258 of file inventory.c.

static void set_show_weight_inv_one ( gpointer  view_x,
gpointer  new_setting 
)
static

Definition at line 1253 of file inventory.c.

References inventory_viewer_set_show_weight().

Referenced by set_show_weight().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void set_weight_limit ( uint32  wlim)

Definition at line 1245 of file inventory.c.

static bool show_all ( item ignored)
static

Definition at line 725 of file inventory.c.

References TRUE.

Referenced by get_look_widget().

+ Here is the caller graph for this function:

static bool show_applied ( item it)
static

Definition at line 726 of file inventory.c.

References item_struct::applied.

static bool show_cursed ( item it)
static

Definition at line 729 of file inventory.c.

References item_struct::cursed, and item_struct::damned.

static bool show_locked ( item it)
static

Definition at line 732 of file inventory.c.

References item_struct::locked.

static bool show_magical ( item it)
static

Definition at line 730 of file inventory.c.

References item_struct::magical.

static bool show_nonmagical ( item it)
static

Definition at line 731 of file inventory.c.

References item_struct::magical.

static bool show_unapplied ( item it)
static

Definition at line 727 of file inventory.c.

References item_struct::applied.

static bool show_unlocked ( item it)
static

Definition at line 733 of file inventory.c.

References item_struct::locked.

static bool show_unpaid ( item it)
static

Definition at line 728 of file inventory.c.

References item_struct::unpaid.

static void update_lists_labels ( void  )
static

Definition at line 1227 of file inventory.c.

References itemlist::env, item_struct::inv_updated, and update_list_labels().

Referenced by inventory_tick().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool view_visible ( inventory_viewer view)
static

Definition at line 875 of file inventory.c.

References inv_notebook, inv_viewers, inventory_viewer::scroll_window, and TRUE.

Referenced by item_tick_per_view().

+ Here is the caller graph for this function:

Variable Documentation

GList* animated_items = NULL
static
GtkWidget* closebutton
GtkWidget* counttext

Definition at line 1072 of file inventory.c.

Referenced by count_callback(), get_inv_display(), list_button_event(), and parse_key().

fixed_tab_init fixed_tabs[TYPE_LISTS]
static
Initial value:
= {
{ "all", all_xpm, show_all, TRUE },
{ "applied", hand_xpm, show_applied, FALSE },
{ "unapplied", hand2_xpm, show_unapplied, FALSE },
{ "unpaid", coin_xpm, show_unpaid, FALSE },
{ "cursed", skull_xpm, show_cursed, FALSE },
{ "magical", mag_xpm, show_magical, FALSE },
{ "nonmagical", nonmag_xpm, show_nonmagical, FALSE },
{ "locked", lock_xpm, show_locked, FALSE },
{ "unlocked", unlock_xpm, show_unlocked, TRUE }
}
static bool show_unapplied(item *it)
Definition: inventory.c:727
static bool show_unlocked(item *it)
Definition: inventory.c:733
static bool show_unpaid(item *it)
Definition: inventory.c:728
#define TRUE
Definition: client-types.h:71
static bool show_locked(item *it)
Definition: inventory.c:732
static bool show_nonmagical(item *it)
Definition: inventory.c:731
static bool show_cursed(item *it)
Definition: inventory.c:729
static bool show_applied(item *it)
Definition: inventory.c:726
static bool show_all(item *ignored)
Definition: inventory.c:725
static bool show_magical(item *it)
Definition: inventory.c:730
#define FALSE
Definition: client-types.h:68

Definition at line 746 of file inventory.c.

GdkColor gdk_black

Definition at line 240 of file gx11.c.

Referenced by menu_spells(), and new_inventory_viewer().

GdkColor gdk_grey

Definition at line 239 of file gx11.c.

Referenced by menu_spells(), and new_inventory_viewer().

GList* highlit_inv_viewers = NULL
static

Definition at line 763 of file inventory.c.

Referenced by get_inv_widget(), get_look_widget(), and inventory_splitwin_toggling().

itemlist inv_list

Definition at line 1013 of file inventory.c.

Referenced by applyconfig(), init_windows(), load_defaults(), and toggle_splitwin().

GtkWidget* inv_notebook = NULL
static
GList* item_to_widgets = NULL
static
itemlist look_list

Definition at line 1013 of file inventory.c.

Referenced by toggle_splitwin().

inventory_viewer* look_viewer = NULL
static

Definition at line 760 of file inventory.c.

GtkWidget* look_widget = NULL
static

Definition at line 765 of file inventory.c.

Referenced by get_look_widget(), and inventory_splitwin_toggling().

GtkWidget* spellinventory

Definition at line 2984 of file gx11.c.

Referenced by item_event_item_changed(), and item_event_item_deleting().