Uh oh!
There was an error while loading. Please reload this page.
Reimplement native market pricing and goods trading - #216
Conversation
TheRedDaemon
left a comment
There was a problem hiding this comment.
Hi, thanks for the contribution!
Comments are on the code, also:
We have a "soft" status file status/addresses-SHC-3BB0A8C1.txt where we track the general status of the functions to avoid heavier test pipelines for the start.
The structure should be self explaining, just check some entries by searching for Reimplemented. The percentage also does not have to be too precise. If the only mismatches are the resolvers/proxies and the structure fits, saying "100.0%" is ok. If the structure still has issues, the percentage (with struct resolvers active) is ok.
Now I will also mention @gynt and add him to the review, since I will give him the final word on the wiki entry/purpose. Also, he has a lot of smaller functions in his branches and needs to check if they overlap with your MR.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| The Game itself | ||
| ------------------ | ||
| - :doc:`Load balancing of the core game engine <wiki/load-balancing-table>` | ||
| - :doc:`Market pricing and goods trading <wiki/market-trading>` |
There was a problem hiding this comment.
Did you replace something here?
There was a problem hiding this comment.
No existing entry was replaced: the diff adds only the market-trading link below the load-balancing page. The rest of the index is unchanged.
There was a problem hiding this comment.
I think it is unclear that this article will be about AI. Please add a AI subsection and add this entry to it with AI in the title. And make sure the .md file refers to AI market behavior explicitly.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Krarilotus
commented
Sep 6, 2026
Updated in 9edc084: field access now uses I checked Gynt's |
| The Game itself | ||
| ------------------ | ||
| - :doc:`Load balancing of the core game engine <wiki/load-balancing-table>` | ||
| - :doc:`Market pricing and goods trading <wiki/market-trading>` |
There was a problem hiding this comment.
I think it is unclear that this article will be about AI. Please add a AI subsection and add this entry to it with AI in the title. And make sure the .md file refers to AI market behavior explicitly.
TheRedDaemon
left a comment
There was a problem hiding this comment.
Looks good from my side.
TL;DR: Reimplements the game's market prices and AI goods trading, preserving how purchases and sales change stored resources and gold. Adds a short wiki description of these rules.
The four C++03 implementations use the existing types and resolvers:
GameStateStructures::getBuyPrice0x004588A0GameStateStructures::getSellPrice0x00458910AICState::buyGoods0x004CC000AICState::sellGoods0x004CBFA0Prices preserve division before multiplication. Purchases charge gold only after resource storage succeeds; sales preserve the order of gold/statistics updates, resource removal and trade display. Field access uses the struct resolver's
instance; member-call arguments useptr.Rebuilt the full
OpenSHC.dllwith MSVC 2005 SP1 x86, CMake 3.31.6 andRelWithDebInfo, selecting these four sources locally. Compared each function against Crusader 1.41 SHA2563bb0a8c1e72331b3a30a5aa93ed94beca0081b476b04c1960e26d5b45387ac5a. The trade diffs are confined to resolver calls and symbolic global references; control flow, register use and field accesses match. The soft status entries use 100.0% following the review guidance for these resolver-only differences; the table above retains the raw scores.The comparison build uses a current Windows SDK manifest tool because the legacy
mt.execrashes on this machine. Compiler and optimization settings remain the project's; no build override is included in the PR. The DLL has not been deployed or tested in-game.Overlap:
origin/reimpl/simple-functions-set-1at5b9da3dalready contains the two price implementations, with identical expressions. The AI trade routines are additional. These price files can be dropped when that branch lands; no competing implementation is intended.