Crossfire Client, Branches  R11627
pickup.c File Reference
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "main.h"
#include "client.h"
#include "image.h"
#include "gtk2proto.h"
+ Include dependency graph for pickup.c:

Go to the source code of this file.

Data Structures

struct  PickupMapping
 

Macros

#define MAX_PICKUPS   50
 
#define PU_ALLWEAPON   0x00020000
 
#define PU_ARMOUR   0x00000800
 
#define PU_ARROW   0x00000100
 
#define PU_BOOTS   0x00001000
 
#define PU_BOW   0x00000080
 
#define PU_CLOAK   0x00004000
 
#define PU_DEBUG   0x10000000
 
#define PU_DRINK   0x00000020
 
#define PU_FLESH   0x04000000
 
#define PU_FOOD   0x00000010
 
#define PU_GLOVES   0x00002000
 
#define PU_HELMET   0x00000200
 
#define PU_INHIBIT   0x20000000
 
#define PU_JEWELS   0x02000000
 
#define PU_KEY   0x00008000
 
#define PU_MAGIC_DEVICE   0x00800000
 
#define PU_MAGICAL   0x00040000
 
#define PU_MISSILEWEAPON   0x00010000
 
#define PU_NEWMODE   0x80000000
 
#define PU_NOT_CURSED   0x01000000
 
#define PU_NOTHING   0x00000000
 
#define PU_POTION   0x00080000
 
#define PU_RATIO   0x0000000F
 
#define PU_READABLES   0x00400000
 
#define PU_SHIELD   0x00000400
 
#define PU_SKILLSCROLL   0x00200000
 
#define PU_SPELLBOOK   0x00100000
 
#define PU_STOP   0x40000000
 
#define PU_VALUABLES   0x00000040
 

Functions

void client_pickup (uint32 pickup)
 
static void new_menu_pickup (int on, int val)
 
void on_menu_all_weapons_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_arrows_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_body_armor_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_boots_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_bows_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_cloaks_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_dont_pickup_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_drinks_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_flesh_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_food_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_gloves_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_helmets_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_jewels_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_keys_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_magical_items_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_missile_weapons_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_normal_book_scrolls_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_not_cursed_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_potions_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_10_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_15_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_20_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_25_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_30_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_35_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_40_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_45_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_50_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_5_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_ratio_pickup_off_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_shields_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_skillscrolls_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_spellbooks_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_stop_before_pickup_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_valuables_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void on_menu_wands_rods_horns_activate (GtkMenuItem *menuitem, gpointer user_data)
 
void pickup_init (GtkWidget *window_root)
 

Variables

static unsigned int no_recurse =0
 
static int num_pickups =0
 
PickupMapping pickup_mapping [MAX_PICKUPS]
 
static unsigned int pmode =0
 
const char *const rcsid_gtk2_pickup_c
 

Detailed Description

This file covers the pickup menu items. We only implement the new pickup code - it seems to me that it should be able to cover everything the old pickup mode does.

Definition in file pickup.c.

Macro Definition Documentation

#define MAX_PICKUPS   50

Definition at line 50 of file pickup.c.

Referenced by pickup_init().

#define PU_ALLWEAPON   0x00020000

Definition at line 86 of file pickup.c.

Referenced by on_menu_all_weapons_activate(), and pickup_init().

#define PU_ARMOUR   0x00000800

Definition at line 78 of file pickup.c.

Referenced by on_menu_body_armor_activate(), and pickup_init().

#define PU_ARROW   0x00000100

Definition at line 75 of file pickup.c.

Referenced by on_menu_arrows_activate(), and pickup_init().

#define PU_BOOTS   0x00001000

Definition at line 80 of file pickup.c.

Referenced by on_menu_boots_activate(), and pickup_init().

#define PU_BOW   0x00000080

Definition at line 73 of file pickup.c.

Referenced by on_menu_bows_activate(), and pickup_init().

#define PU_CLOAK   0x00004000

Definition at line 82 of file pickup.c.

Referenced by on_menu_cloaks_activate(), and pickup_init().

#define PU_DEBUG   0x10000000

Definition at line 63 of file pickup.c.

#define PU_DRINK   0x00000020

Definition at line 71 of file pickup.c.

Referenced by on_menu_drinks_activate(), and pickup_init().

#define PU_FLESH   0x04000000

Definition at line 97 of file pickup.c.

Referenced by on_menu_flesh_activate(), and pickup_init().

#define PU_FOOD   0x00000010

Definition at line 70 of file pickup.c.

Referenced by on_menu_food_activate(), and pickup_init().

#define PU_GLOVES   0x00002000

Definition at line 81 of file pickup.c.

Referenced by on_menu_gloves_activate(), and pickup_init().

#define PU_HELMET   0x00000200

Definition at line 76 of file pickup.c.

Referenced by on_menu_helmets_activate(), and pickup_init().

#define PU_INHIBIT   0x20000000

Definition at line 64 of file pickup.c.

Referenced by on_menu_dont_pickup_activate(), and pickup_init().

#define PU_JEWELS   0x02000000

Definition at line 96 of file pickup.c.

Referenced by on_menu_jewels_activate(), and pickup_init().

#define PU_KEY   0x00008000

Definition at line 83 of file pickup.c.

Referenced by on_menu_keys_activate(), and pickup_init().

#define PU_MAGIC_DEVICE   0x00800000

Definition at line 93 of file pickup.c.

Referenced by on_menu_wands_rods_horns_activate(), and pickup_init().

#define PU_MAGICAL   0x00040000

Definition at line 87 of file pickup.c.

Referenced by on_menu_magical_items_activate(), and pickup_init().

#define PU_MISSILEWEAPON   0x00010000

Definition at line 85 of file pickup.c.

Referenced by on_menu_missile_weapons_activate(), and pickup_init().

#define PU_NEWMODE   0x80000000

Definition at line 66 of file pickup.c.

Referenced by new_menu_pickup().

#define PU_NOT_CURSED   0x01000000

Definition at line 95 of file pickup.c.

Referenced by on_menu_not_cursed_activate(), and pickup_init().

#define PU_NOTHING   0x00000000

Definition at line 61 of file pickup.c.

#define PU_POTION   0x00080000

Definition at line 88 of file pickup.c.

Referenced by on_menu_potions_activate(), and pickup_init().

#define PU_RATIO   0x0000000F

Definition at line 68 of file pickup.c.

Referenced by client_pickup(), and pickup_init().

#define PU_READABLES   0x00400000

Definition at line 92 of file pickup.c.

Referenced by on_menu_normal_book_scrolls_activate(), and pickup_init().

#define PU_SHIELD   0x00000400

Definition at line 77 of file pickup.c.

Referenced by on_menu_shields_activate(), and pickup_init().

#define PU_SKILLSCROLL   0x00200000

Definition at line 91 of file pickup.c.

Referenced by on_menu_skillscrolls_activate(), and pickup_init().

#define PU_SPELLBOOK   0x00100000

Definition at line 90 of file pickup.c.

Referenced by on_menu_spellbooks_activate(), and pickup_init().

#define PU_STOP   0x40000000

Definition at line 65 of file pickup.c.

Referenced by on_menu_stop_before_pickup_activate(), and pickup_init().

#define PU_VALUABLES   0x00000040

Definition at line 72 of file pickup.c.

Referenced by on_menu_valuables_activate(), and pickup_init().

Function Documentation

void client_pickup ( uint32  pickup)

We get pickup information from server, update our status.

Definition at line 629 of file pickup.c.

References no_recurse, num_pickups, pickup_mode, pmode, and PU_RATIO.

static void new_menu_pickup ( int  on,
int  val 
)
static

Handles the pickup operations. Unfortunately, it isn't easy (possible?) in glade to attach values to the menu items.

Parameters
onis TRUE if the button is activated, 0 if it is off.
valis the PU_ bitmasks to set/clear.

Definition at line 108 of file pickup.c.

References draw_info(), NDI_BLACK, no_recurse, pmode, PU_NEWMODE, and send_command().

Referenced by on_menu_all_weapons_activate(), on_menu_arrows_activate(), on_menu_body_armor_activate(), on_menu_boots_activate(), on_menu_bows_activate(), on_menu_cloaks_activate(), on_menu_dont_pickup_activate(), on_menu_drinks_activate(), on_menu_flesh_activate(), on_menu_food_activate(), on_menu_gloves_activate(), on_menu_helmets_activate(), on_menu_jewels_activate(), on_menu_keys_activate(), on_menu_magical_items_activate(), on_menu_missile_weapons_activate(), on_menu_normal_book_scrolls_activate(), on_menu_not_cursed_activate(), on_menu_potions_activate(), on_menu_ratio_10_activate(), on_menu_ratio_15_activate(), on_menu_ratio_20_activate(), on_menu_ratio_25_activate(), on_menu_ratio_30_activate(), on_menu_ratio_35_activate(), on_menu_ratio_40_activate(), on_menu_ratio_45_activate(), on_menu_ratio_50_activate(), on_menu_ratio_5_activate(), on_menu_ratio_pickup_off_activate(), on_menu_shields_activate(), on_menu_skillscrolls_activate(), on_menu_spellbooks_activate(), on_menu_stop_before_pickup_activate(), on_menu_valuables_activate(), and on_menu_wands_rods_horns_activate().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_all_weapons_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 291 of file pickup.c.

References new_menu_pickup(), and PU_ALLWEAPON.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_arrows_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 312 of file pickup.c.

References new_menu_pickup(), and PU_ARROW.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_body_armor_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 146 of file pickup.c.

References new_menu_pickup(), and PU_ARMOUR.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_boots_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 153 of file pickup.c.

References new_menu_pickup(), and PU_BOOTS.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_bows_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 305 of file pickup.c.

References new_menu_pickup(), and PU_BOW.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_cloaks_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 160 of file pickup.c.

References new_menu_pickup(), and PU_CLOAK.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_dont_pickup_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 128 of file pickup.c.

References new_menu_pickup(), and PU_INHIBIT.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_drinks_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 217 of file pickup.c.

References new_menu_pickup(), and PU_DRINK.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_flesh_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 280 of file pickup.c.

References new_menu_pickup(), and PU_FLESH.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_food_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 224 of file pickup.c.

References new_menu_pickup(), and PU_FOOD.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_gloves_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 167 of file pickup.c.

References new_menu_pickup(), and PU_GLOVES.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_helmets_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 174 of file pickup.c.

References new_menu_pickup(), and PU_HELMET.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_jewels_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 273 of file pickup.c.

References new_menu_pickup(), and PU_JEWELS.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_keys_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 231 of file pickup.c.

References new_menu_pickup(), and PU_KEY.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_magical_items_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 238 of file pickup.c.

References new_menu_pickup(), and PU_MAGICAL.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_missile_weapons_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 298 of file pickup.c.

References new_menu_pickup(), and PU_MISSILEWEAPON.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_normal_book_scrolls_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 200 of file pickup.c.

References new_menu_pickup(), and PU_READABLES.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_not_cursed_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 266 of file pickup.c.

References new_menu_pickup(), and PU_NOT_CURSED.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_potions_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 245 of file pickup.c.

References new_menu_pickup(), and PU_POTION.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_10_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 337 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_15_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 344 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_20_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 351 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_25_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 358 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_30_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 365 of file pickup.c.

References new_menu_pickup().

+ Here is the call graph for this function:

void on_menu_ratio_35_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 372 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_40_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 379 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_45_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 386 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_50_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 393 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_5_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 330 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_ratio_pickup_off_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 323 of file pickup.c.

References new_menu_pickup().

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_shields_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 181 of file pickup.c.

References new_menu_pickup(), and PU_SHIELD.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_skillscrolls_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 192 of file pickup.c.

References new_menu_pickup(), and PU_SKILLSCROLL.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_spellbooks_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 208 of file pickup.c.

References new_menu_pickup(), and PU_SPELLBOOK.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_stop_before_pickup_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 135 of file pickup.c.

References new_menu_pickup(), and PU_STOP.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_valuables_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 252 of file pickup.c.

References new_menu_pickup(), and PU_VALUABLES.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void on_menu_wands_rods_horns_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Definition at line 259 of file pickup.c.

References new_menu_pickup(), and PU_MAGIC_DEVICE.

Referenced by enable_menu_items().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pickup_init ( GtkWidget *  window_root)

Maps the menuitem lists into pickup values. In this way, client_pickup knows what values to change.

Parameters
window_root

Definition at line 405 of file pickup.c.

References has_init, LOG(), LOG_ERROR, MAX_PICKUPS, PickupMapping::menuitem, num_pickups, PickupMapping::pickup_mode, PU_ALLWEAPON, PU_ARMOUR, PU_ARROW, PU_BOOTS, PU_BOW, PU_CLOAK, PU_DRINK, PU_FLESH, PU_FOOD, PU_GLOVES, PU_HELMET, PU_INHIBIT, PU_JEWELS, PU_KEY, PU_MAGIC_DEVICE, PU_MAGICAL, PU_MISSILEWEAPON, PU_NOT_CURSED, PU_POTION, PU_RATIO, PU_READABLES, PU_SHIELD, PU_SKILLSCROLL, PU_SPELLBOOK, PU_STOP, and PU_VALUABLES.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

unsigned int no_recurse =0
static

Definition at line 99 of file pickup.c.

Referenced by client_pickup(), and new_menu_pickup().

int num_pickups =0
static

Definition at line 53 of file pickup.c.

Referenced by client_pickup(), and pickup_init().

PickupMapping pickup_mapping[MAX_PICKUPS]

Definition at line 52 of file pickup.c.

unsigned int pmode =0
static

Definition at line 99 of file pickup.c.

Referenced by client_pickup(), and new_menu_pickup().

const char* const rcsid_gtk2_pickup_c
Initial value:
=
"$Id: pickup.c 9200 2008-06-01 17:12:43Z anmaster $"

Definition at line 1 of file pickup.c.