Fixes (by The_Bob):

- Fixed index out of bounds in get items assignment check
- Fixed attachment popup not allowing more than one of the same attachment
- Improved timer control sanity check code
- Added timer adjustment for variable CPU frequency
- Added shortcut: ctrl+left-click on attachment to remove and drop it in sector inventory

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8400 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2017-04-14 08:34:20 +00:00
parent fef0722178
commit d7f91064f0
4 changed files with 71 additions and 33 deletions
+8 -6
View File
@@ -286,15 +286,17 @@ static inline bool TimerSanityCheck() {
UINT32 GetNextCounterDoneTime(void)
{
QueryPerformanceCounter(&gliPerfCount);
if (TimerSanityCheck() == false) {
// timer has gone off the rails, try to reset and hope for the best.
gliPerfCountNext.QuadPart = gliPerfCount.QuadPart + 25;
}
gliTimestampDiff = gliPerfCountNext.QuadPart - gliPerfCount.QuadPart;
gliWaitTime = (gliTimestampDiff * FREQUENCY_CONST) / gliPerfFreq.QuadPart;
// if the wait time is too long/short, re-evaluate the timer and try waiting 125ms
if (gliWaitTime > 15 * FREQUENCY_CONST) {
gliWaitTime = 125; // in mili-seconds
QueryPerformanceFrequency(&gliPerfFreq);
gliPerfCountNext.QuadPart = gliPerfCount.QuadPart + ((125 * gliPerfFreq.QuadPart) / 1000000);
}
return (UINT32)((gliWaitTime > 0) ? gliWaitTime : 0);
}