version 1.78 | | version 1.79 |
---|
| | |
/* | | /* |
* static char *rcsid_c_object_c = | | * static char *rcsid_c_object_c = |
* "$Id: c_object.c,v 1.78 2006/03/14 15:25:24 ryo_saeba Exp $"; | | * "$Id: c_object.c,v 1.79 2006/05/05 09:47:40 ryo_saeba Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
#endif | | #endif |
#include <living.h> | | #include <living.h> |
#include <math.h> | | #include <math.h> |
| | |
| | static void set_pickup_mode(const object *op, int i); |
| | |
/* | | /* |
* Object id parsing functions | | * Object id parsing functions |
*/ | | */ |
| | |
#define OBLINKMALLOC(p) if(!((p)=(objectlink *)malloc(sizeof(objectlink))))\ | | #define OBLINKMALLOC(p) if(!((p)=(objectlink *)malloc(sizeof(objectlink))))\ |
fatal(OUT_OF_MEMORY); | | fatal(OUT_OF_MEMORY); |
| | |
#define ADD_ITEM(NEW,COUNT)\ | | |
if(!first) {\ | | |
OBLINKMALLOC(first);\ | | |
last=first;\ | | |
} else {\ | | |
OBLINKMALLOC(last->next);\ | | |
last=last->next;\ | | |
}\ | | |
last->next=NULL;\ | | |
last->ob=(NEW);\ | | |
last->id=(COUNT); | | |
| | |
/** | | /** |
* Search the inventory of 'pl' for what matches best with params. | | * Search the inventory of 'pl' for what matches best with params. |
* we use item_matched_string above - this gives us consistent behaviour | | * we use item_matched_string above - this gives us consistent behaviour |
| | |
/** | | /** |
* Shortcut to find_best_apply_object_match(pl, params, AF_NULL); | | * Shortcut to find_best_apply_object_match(pl, params, AF_NULL); |
**/ | | **/ |
object *find_best_object_match(object *pl, const char *params) | | static object *find_best_object_match(object *pl, const char *params) |
{ | | { |
return find_best_apply_object_match(pl, params, AP_NULL); | | return find_best_apply_object_match(pl, params, AP_NULL); |
} | | } |
| | |
* certain number of objects to drop, so we can pass that number, and | | * certain number of objects to drop, so we can pass that number, and |
* not need to use split_ob and stuff. | | * not need to use split_ob and stuff. |
*/ | | */ |
int sack_can_hold (object *pl, object *sack, object *op, uint32 nrof) { | | int sack_can_hold(const object *pl, const object *sack, const object *op, uint32 nrof) { |
| | |
if (! QUERY_FLAG (sack, FLAG_APPLIED)) { | | if (! QUERY_FLAG (sack, FLAG_APPLIED)) { |
new_draw_info_format(NDI_UNIQUE, 0, pl, | | new_draw_info_format(NDI_UNIQUE, 0, pl, |
| | |
| | |
| | |
/* tmp is the object being described, pl is who is examing it. */ | | /* tmp is the object being described, pl is who is examing it. */ |
char *long_desc(object *tmp, object *pl) { | | const char *long_desc(const object *tmp, const object *pl) { |
static char buf[VERY_BIG_BUF]; | | static char buf[VERY_BIG_BUF]; |
char *cp; | | char *cp; |
| | |
| | |
*/ | | */ |
void inventory(object *op,object *inv) { | | void inventory(object *op,object *inv) { |
object *tmp; | | object *tmp; |
char *in; | | const char *in; |
int items = 0, length; | | int items = 0, length; |
| | |
if (inv==NULL && op==NULL) { | | if (inv==NULL && op==NULL) { |
| | |
} | | } |
} | | } |
| | |
static void display_new_pickup( object* op ) | | static void display_new_pickup(const object* op) |
{ | | { |
int i = op->contr->mode; | | int i = op->contr->mode; |
| | |
| | |
return 1; | | return 1; |
} | | } |
| | |
void set_pickup_mode(object *op,int i) { | | static void set_pickup_mode(const object *op, int i) { |
switch(op->contr->mode=i) { | | switch(op->contr->mode=i) { |
case 0: | | case 0: |
new_draw_info(NDI_UNIQUE, 0,op,"Mode: Don't pick up."); | | new_draw_info(NDI_UNIQUE, 0,op,"Mode: Don't pick up."); |