1 | /* |
1 | /* |
2 | * static char *rcsid_apply_c = |
2 | * static char *rcsid_apply_c = |
3 | * "$Id: apply.C,v 1.20 2006/09/04 16:46:33 root Exp $"; |
3 | * "$Id: apply.C,v 1.21 2006/09/07 10:01:57 pippijn Exp $"; |
4 | */ |
4 | */ |
5 | /* |
5 | /* |
6 | CrossFire, A Multiplayer game for X-windows |
6 | CrossFire, A Multiplayer game for X-windows |
7 | |
7 | |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
8 | Copyright (C) 2001 Mark Wedel & Crossfire Development Team |
… | |
… | |
892 | * item is the object that triggered the converter - if it is not |
892 | * item is the object that triggered the converter - if it is not |
893 | * what the converter wants, this will not do anything. |
893 | * what the converter wants, this will not do anything. |
894 | */ |
894 | */ |
895 | int convert_item(object *item, object *converter) { |
895 | int convert_item(object *item, object *converter) { |
896 | int nr=0; |
896 | int nr=0; |
897 | object *tmp; |
|
|
898 | uint32 price_in; |
897 | uint32 price_in; |
899 | |
898 | |
900 | /* We make some assumptions - we assume if it takes money as it type, |
899 | /* We make some assumptions - we assume if it takes money as it type, |
901 | * it wants some amount. We don't make change (ie, if something costs |
900 | * it wants some amount. We don't make change (ie, if something costs |
902 | * 3 gp and player drops a platinum, tough luck) |
901 | * 3 gp and player drops a platinum, tough luck) |
… | |
… | |
916 | |
915 | |
917 | price_in = cost*item->value; |
916 | price_in = cost*item->value; |
918 | } |
917 | } |
919 | else { |
918 | else { |
920 | if(item->type==PLAYER||CONV_FROM(converter)!=item->arch->name|| |
919 | if(item->type==PLAYER||CONV_FROM(converter)!=item->arch->name|| |
921 | (CONV_NEED(converter)&&CONV_NEED(converter)>item->nrof)) |
920 | (CONV_NEED(converter) && CONV_NEED(converter) > (uint16) item->nrof)) |
922 | return 0; |
921 | return 0; |
923 | |
922 | |
924 | if(CONV_NEED(converter)) { |
923 | if(CONV_NEED(converter)) { |
925 | nr=item->nrof/CONV_NEED(converter); |
924 | nr=item->nrof/CONV_NEED(converter); |
926 | decrease_ob_nr(item,nr*CONV_NEED(converter)); |
925 | decrease_ob_nr(item,nr*CONV_NEED(converter)); |