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.87 by root, Sat Apr 23 04:56:57 2011 UTC vs.
Revision 1.92 by root, Mon Oct 29 23:55:55 2012 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25#include <global.h> 25#include <global.h>
26#include <spells.h> 26#include <spells.h>
720void 720void
721pay_player (object *pl, sint64 amount) 721pay_player (object *pl, sint64 amount)
722{ 722{
723 int count = 0; 723 int count = 0;
724 archetype *at = 0; 724 archetype *at = 0;
725 object *pouch = 0, *tmp = 0; 725 object *pouch = 0;
726 726
727 for (count = 0; coins[count]; count++) 727 for (count = 0; coins[count]; count++)
728 { 728 {
729 at = archetype::find (coins[count]); 729 at = archetype::find (coins[count]);
730 730
855 return 0; 855 return 0;
856 } 856 }
857 857
858 if (!item->type) 858 if (!item->type)
859 { 859 {
860 LOG (llevError, "shop_specialisation_ratio: passed an item with an invalid type\n"); 860 LOG (llevError, "shop_specialisation_ratio: passed an item with an invalid type: %s\n", item->debug_desc ());
861 /* 861 /*
862 * I'm not really sure what the /right/ thing to do here is, these types of 862 * I'm not really sure what the /right/ thing to do here is, these types of
863 * item shouldn't exist anyway, but returning the ratio is probably the best bet.." 863 * item shouldn't exist anyway, but returning the ratio is probably the best bet.."
864 */ 864 */
865 return SPECIALISATION_EFFECT; 865 return SPECIALISATION_EFFECT;
870 if (items[i].typenum == item->type || (!items[i].typenum && !likedness)) 870 if (items[i].typenum == item->type || (!items[i].typenum && !likedness))
871 likedness = items[i].strength; 871 likedness = items[i].strength;
872 872
873 if (likedness > 100) 873 if (likedness > 100)
874 { /* someone has been rather silly with the map headers. */ 874 { /* someone has been rather silly with the map headers. */
875 LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is above 100%%\n", item->type, &map->path); 875 LOG (llevDebug, "shop_specialisation ratio: item %s on map %s is above 100%%\n", item->debug_desc (), &map->path);
876 likedness = 100; 876 likedness = 100;
877 } 877 }
878 878
879 if (likedness < -100) 879 if (likedness < -100)
880 { 880 {
881 LOG (llevDebug, "shop_specialisation ratio: item type %d on map %s is below -100%%\n", item->type, &map->path); 881 LOG (llevDebug, "shop_specialisation ratio: item %s on map %s is below -100%%\n", item->debug_desc (), &map->path);
882 likedness = -100; 882 likedness = -100;
883 } 883 }
884 884
885 return lerp (double (likedness), -100., 100., SPECIALISATION_EFFECT, 1.); 885 return lerp (double (likedness), -100., 100., SPECIALISATION_EFFECT, 1.);
886} 886}
908/* limit the value of items based on the wealth of the shop. If the item is close 908/* limit the value of items based on the wealth of the shop. If the item is close
909 * to the maximum value a shop will offer, we start to reduce it, if the item is 909 * to the maximum value a shop will offer, we start to reduce it, if the item is
910 * below the minimum value the shop is prepared to trade in, then we don't 910 * below the minimum value the shop is prepared to trade in, then we don't
911 * want it and offer nothing. If it isn't a shop, check whether we should do generic 911 * want it and offer nothing. If it isn't a shop, check whether we should do generic
912 * value reduction. 912 * value reduction.
913 * 913 *
914 */ 914 */
915static sint64 915static sint64
916value_limit (sint64 val, int quantity, const object *who, int isshop) 916value_limit (sint64 val, int quantity, const object *who, int isshop)
917{ 917{
918 sint64 newval, unit_price, tmpshopmax; 918 sint64 newval, unit_price, tmpshopmax;
958{ 958{
959 dynbuf_text buf; 959 dynbuf_text buf;
960 maptile *map = op->map; 960 maptile *map = op->map;
961 961
962 /*shopitems *items=map->shopitems; */ 962 /*shopitems *items=map->shopitems; */
963 int pos = 0, i; 963 int i;
964 double opinion = 0; 964 double opinion = 0;
965 965
966 if (op->type != PLAYER) 966 if (op->type != PLAYER)
967 return 0; 967 return 0;
968 968
1112 1112
1113void 1113void
1114shop_listing (object *sign, object *op) 1114shop_listing (object *sign, object *op)
1115{ 1115{
1116 int i, j, x1, x2, y1, y2; 1116 int i, j, x1, x2, y1, y2;
1117 const char *shop_coords = sign->kv (shstr_shop_coords); 1117 const char *shop_coords = sign->kv [shstr_shop_coords];
1118 object *stack; 1118 object *stack;
1119 shopinv *items; 1119 shopinv *items;
1120 1120
1121 /* Should never happen, but just in case a monster does apply a sign */ 1121 /* Should never happen, but just in case a monster does apply a sign */
1122 if (!op->is_player ()) 1122 if (!op->is_player ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines