There is a 10X discrepancy between the Stock Purchase Tooltip (10 blocks of 1000 shares) and miBaseSharePrice (iNewValue /= 100). I'd be amazed if there isn't some corner case that is doing the conversion wrong.

iNewValue is not the new share price. Look at the code again.

iNewValue is incremented by STOCK_STEPS for every multiple of STOCK_STEPS that iTotalValue exceeds while iTotalValue is depreciated by 1/4th at each step. So, if STOCK_STEPS is 100,000 (maybe it is 10k or 1mil, we don't know for sure here), then for every (let's say) 100k in value you have, iNewValue is incremented by 100k and the remaining total value gets depreciated by 25%. This gives a heavier depreciation on values which are much higher than 100k. So, for example, the amounts over 600k would be depreciated by 25% at least 6 times. This is a huge depreciation factor. It probably should be 10% or maybe even 5%. This is why the stock buyouts are so screwed up at the end and why level 2 and 3 HQ players can buy out level 5 HQ players. All the extra value the level 5 players have is being heavily depreciated vs the value that the level 2 and 3 HQ players have.

But, moving on...

Once we get through the loop, iNewValue is a discounted representation of the total value. The stock is 10 buckets of 1000 shares. So, that is 10,000 shares total. However, the price point is based on 1000 shares, so the price point is 1/10th of the depreciated company value. After we divide iNewValue by 100, it represents 1/100th of the whole company, which is an order of magnitude less expensive than the desired breakdown. But, look at the code which follows...

iNewValue /= 100;

iNewValue = Math.Max(iNewValue, 0);

if (getBaseSharePrice() != iNewValue)

{

if (bForce || (Math.Abs(getBaseSharePrice() - iNewValue) < (Constants.STOCK_MULTIPLIER / 10)))

{

miBaseSharePrice = iNewValue;

}

else

{

miBaseSharePrice = ((getBaseSharePrice() * 9) + iNewValue) / 10;

}

makeDirty();

}

Presumably, iNewValue would equal getBaseSharePrice() for all ticks where nothing has changed in terms of the numbers. That implies that getBaseSharePrice() is returning a number which is 1/100th of the value of the company. Assuming the two numbers no longer match, an update is in order. When it updates, it updates miBaseSharePrice by taking 9/10ths of getBaseSharePrice() and 1/10th of iNewValue and adding them together. So, we are using 1/10th of 1/100th of the newly calculated and depreciated company value and 9/10th of getBaseSharePrice() to arrive at our new baseSharePrice. At least, that's what it looks like to me. Which is why 100k in cash only changes the value of your company by pennies. The original baseSharePrice makes up the bulk of the number.