ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/shop.C
(Generate patch)

Comparing deliantra/server/server/shop.C (file contents):
Revision 1.41 by root, Sat Jul 21 19:04:45 2007 UTC vs.
Revision 1.42 by root, Sat Jul 21 19:18:02 2007 UTC

35 * setting this value above 1 or to a negative value would have interesting, 35 * setting this value above 1 or to a negative value would have interesting,
36 * (though not useful) effects. 36 * (though not useful) effects.
37 */ 37 */
38#define SPECIALISATION_EFFECT .5 38#define SPECIALISATION_EFFECT .5
39 39
40/* price a shopkeeper will give someone they neither like nor dislike */ 40// price a shopkeeper will give someone that is not of their race
41#define NEUTRAL_RATIO 0.8 41#define DISLIKE_RATIO 0.8
42 42
43static void pay_from_container (object *pl, object *pouch, sint64 &to_pay); 43static void pay_from_container (object *pl, object *pouch, sint64 &to_pay);
44static sint64 value_limit (sint64 val, int quantity, const object *who, int isshop); 44static sint64 value_limit (sint64 val, int quantity, const object *who, int isshop);
45static double shop_specialisation_ratio (const object *item, const maptile *map); 45static double shop_specialisation_ratio (const object *item, const maptile *map);
46static double shop_greed (const maptile *map); 46static double shop_greed (const maptile *map);
968 968
969/*returns the greed of the shop on map, or 1 if it isn't specified. */ 969/*returns the greed of the shop on map, or 1 if it isn't specified. */
970static double 970static double
971shop_greed (const maptile *map) 971shop_greed (const maptile *map)
972{ 972{
973 double greed = 1.0;
974
975 if (map->shopgreed)
976 return map->shopgreed; 973 return map->shopgreed
977 return greed; 974 ? map->shopgreed
975 : 1.;
978} 976}
979 977
980/* Returns a double based on how much the shopkeeper approves of the player. 978/* Returns a double based on how much the shopkeeper approves of the player.
981 * this is based on the race of the shopkeeper and that of the player. 979 * this is based on the race of the shopkeeper and that of the player.
982 */ 980 */
983double 981double
984shopkeeper_approval (const maptile *map, const object *player) 982shopkeeper_approval (const maptile *map, const object *player)
985{ 983{
986 double approval = 1.0; 984 return map->shoprace && player->race != map->shoprace
987 985 ? DISLIKE_RATIO
988 if (map->shoprace) 986 : 1.;
989 {
990 approval = NEUTRAL_RATIO;
991 if (player->race && !strcmp (player->race, map->shoprace))
992 approval = 1.0;
993 }
994
995 return approval;
996} 987}
997 988
998/* limit the value of items based on the wealth of the shop. If the item is close 989/* limit the value of items based on the wealth of the shop. If the item is close
999 * to the maximum value a shop will offer, we start to reduce it, if the item is 990 * to the maximum value a shop will offer, we start to reduce it, if the item is
1000 * below the minimum value the shop is prepared to trade in, then we don't 991 * below the minimum value the shop is prepared to trade in, then we don't

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines