summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-24 20:44:36 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-24 20:44:36 +0000
commitfbffd8669da6a7246fed2297a2fd7754e4c0534c (patch)
tree813ffe75f35cd7d3d1e214851183b1e742bc92d4 /src
parent1d2cd17fbfac7aa5d54b74e6eacb6c06f2f9c40b (diff)
downloadhercules-fbffd8669da6a7246fed2297a2fd7754e4c0534c.tar.gz
hercules-fbffd8669da6a7246fed2297a2fd7754e4c0534c.tar.bz2
hercules-fbffd8669da6a7246fed2297a2fd7754e4c0534c.tar.xz
hercules-fbffd8669da6a7246fed2297a2fd7754e4c0534c.zip
- Cleaned up a bit the npc undercharging item warning to specify when it is displaying overcharge/discount prices instead of the actual values. It should also prevent overflows.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5737 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index ccf634cf7..0035f6739 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1530,10 +1530,14 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
value = id->value_buy;
nd->u.shop_item[pos].value = value;
// check for bad prices that can possibly cause exploits
- if (value/100*75 < id->value_sell/100*124) { // Modified to prevent loopbacks, divide before multiplying [Lance]
+ if (value/124. < id->value_sell/75.) { //Clened up formula to prevent overflows.
printf("\r"); //Carriage return to clear the 'loading..' line. [Skotlex]
- ShowWarning ("Item %s [%d] buying price (%d) is less than selling price (%d)\n",
- id->name, id->nameid, value*75/100, id->value_sell*124/100);
+ if (value < id->value_sell)
+ ShowWarning ("Item %s [%d] buying price (%d) is less than selling price (%d)\n",
+ id->name, id->nameid, value, id->value_sell);
+ else
+ ShowWarning ("Item %s [%d] discounted buying price (%d) is less than overcharged selling price (%d)\n",
+ id->name, id->nameid, value/100*75, id->value_sell/100*124);
}
//for logs filters, atcommands and iteminfo script command
if (id->maxchance<=0)