• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Medium Priority Shipyard Sale Price: Cargo Included, but Kept Anyway

anchoret

Landlubber
hello again! is it only me or not in that when i try to buy a new ship and it automatically exchanges-sells your own I MAKE gold instead of losing even if I have a cheaper ship?? seems like a major bug if its not me messing up somehow .. cheers
 
Which modpack version?
I'm pretty sure that shouldn't be the case, unless you have plenty cargo left on the ship you're replacing.
 
@Pieter Boelen (I can do that too now:checklist) : my ship had cargo in it but the thing is I got to keep that cargo after I replaced it, so it looks like I'm been paid for that cargo (even though it seems to me I'm getting more additional money than my cargo is worth) but I keep too. I could make a million gold buying new ships replacing the one I got everytime making infinite money :cheers
 
@Pieter Boelen (I can do that too now:checklist) : my ship had cargo in it but the thing is I got to keep that cargo after I replaced it, so it looks like I'm been paid for that cargo (even though it seems to me I'm getting more additional money than my cargo is worth) but I keep too. I could make a million gold buying new ships replacing the one I got everytime making infinite money :cheers
Hmm... looks like that isn't it. Had a quick look through the code and it looks like when you buy a new ship, the cargo sale price is NOT included.

To really check what is going on, somebody would need to put some Trace statements in PROGRAM\INTERFACE\shipyard.c to see what exactly happens.
Relevant functions are GetSellPrice and GetBuyPrice . Plus of course the various calls to AddMoneyToCharacter .
 
and I thought about wrong place posted when I saw that bug reports thread.. aanyways first of all can we be sure that not pressing f11 ingame right after copying the zip files isn't causing this? didn't see I had too but I pressed it for other reason after some time anyways.

Now! I did some testing and definitely found the issue to be with the cargo in my ship.. my ship with full cargo costed ~120000 while empty about 60000 gold.

edit : I dunno man the exchange mechanic doesn't work at all for me even with completely empty cargo.. if I sell my ship first and after buy the new one everything is fine. with the exchenge the gold exchanged is on my favour for some reason and I tried to calculate the differences but they didn't make sense to me:boom:

edit2 : as for the above i think I'm not that someone .. no idea how to do that. not feeling to google that.. at least for now
 
Last edited:
first of all can we be sure that not pressing f11 ingame right after copying the zip files isn't causing this?
I very much doubt it. The reason why that is important is because some AI groups needed to be set correctly.

Now! I did some testing and definitely found the issue to be with the cargo in my ship.. my ship with full cargo costed ~120000 while empty about 60000 gold.
That's normal. When you sell the ship, you sell the cargo on it too. No cargo = no cargo included in sale price.
But when buying a new ship, that same mechanic looks to be skipped.

By the way, I don't think you ever did confirm the exact modpack version you're running.
That's rather important....
 
Trace statements are just extra lines of code that write to compile.log .
You can use them to check what happens with the various variables.
 
Had a look at this and basically in shipyard interface function DoBuyShip() you get a call to dosellship which gives you the money for your present ship and then via using buyPrice only charges you the discounted exchange price for the new one - these two values are what are logged in the quest book transaction too. I can't believe it has remained like this for any great length of time being so clearcut an exploit (I even thought it could be my doing when adding the navycut but I think the sellPrice was already done that way before I meddled) but perhaps the price calculations were re-vamped or something.

Simple fix looks to be to change to using bPrice for the minus money to character so the full amount is charged and also put that in the log file and the amount returned to shipyard - that seems OK. However @Pieter Boelen may have an idea if that would have a knock on anywhere else. If not here would be an amended shipyard interface
 

Attachments

  • shipyard.7z
    26.1 KB · Views: 194
Thanks for looking into this, @pedrwyth!

Where do you get the sell price now later then? Is that because DoSellShip also gives you the money?
So with your change, the ONLY reason for keeping this section then is to avoid you buying a ship you cannot afford?
Code:
   // TIH --> fixed price bug Jul27'06
   int bPrice = GetBuyPrice(nCurSScrollNum);
   int sPrice = GetSellPrice(nCurFourNum,"skipcargo");
   int buyPrice = bPrice - sPrice;
   if ( IsMoneyForBuyEnable(bPrice, sPrice) > 0 ) return;
   // TIH <--
But that sell price with "skipcargo" doesn't actually need to be subtracted, because you get it back later.
Did I get that right....?
 
nevermind this post. it didn't show me the last 2 posts and I asked if anyone confirmed this. nice to have helped even a bit
 
Last edited:
Where do you get the sell price now later then? Is that because DoSellShip also gives you the money?
Yes
So with your change, the ONLY reason for keeping this section then is to avoid you buying a ship you cannot afford?
Code:
   // TIH --> fixed price bug Jul27'06
   int bPrice = GetBuyPrice(nCurSScrollNum);
   int sPrice = GetSellPrice(nCurFourNum,"skipcargo");
   int buyPrice = bPrice - sPrice;
   if ( IsMoneyForBuyEnable(bPrice, sPrice) > 0 ) return;
   // TIH <--
Yes
But that sell price with "skipcargo" doesn't actually need to be subtracted, because you get it back later.
Did I get that right....?
yes just lower down
Code:
// TIH <--

    ref chref = GetCharacter(cn);
    DoSellShip("keepcrew","keepcargo");// TIH keep any stuff around as we only swap ships (or add ship to companion) Jul27'06 <--------- this call results in you getting your ship value PW
IF I have got it right BUT I am still concerned how this could have arisen and not been spotted before - it all seems a bit glaring
 
IF I have got it right BUT I am still concerned how this could have arisen and not been spotted before - it all seems a bit glaring
Wouldn't be the first time that stuff has been badly wrong and nobody noticed for far too long.
So I wouldn't rule out the possibility... :facepalm
 
Unbelievable (to me) but I just checked build 14 3.4 and it was like that back then too :shock. Just shows if you don't spot something it remains hidden in full view! :shrug
 
IF I have got it right BUT I am still concerned how this could have arisen and not been spotted before - it all seems a bit glaring

hey I felt the same when reporting it. I can surely imagine some playing this go "uhumm I don't mind that at all, they'll fix it for sure not need for me to report!" :p
 
Back
Top