From 15b17af683b207f0cc2a7cc5dbd13f4bb3fa1449 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 6 Sep 2023 05:13:09 +0300 Subject: [PATCH] server: fix Stupid MSVC6 Bug --- dlls/animation.cpp | 5 +++-- dlls/client.cpp | 3 ++- dlls/nodes.cpp | 31 ++++++++++++++++++++----------- dlls/player.cpp | 3 ++- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/dlls/animation.cpp b/dlls/animation.cpp index 9be524e..d1e7093 100644 --- a/dlls/animation.cpp +++ b/dlls/animation.cpp @@ -329,7 +329,8 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu mstudiobonecontroller_t *pbonecontroller = (mstudiobonecontroller_t *)((byte *)pstudiohdr + pstudiohdr->bonecontrollerindex); // find first controller that matches the index - for (int i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++) + int i; + for (i = 0; i < pstudiohdr->numbonecontrollers; i++, pbonecontroller++) { if (pbonecontroller->index == iController) break; @@ -524,4 +525,4 @@ int GetBodygroup( void *pmodel, entvars_t *pev, int iGroup ) int iCurrent = (pev->body / pbodypart->base) % pbodypart->nummodels; return iCurrent; -} \ No newline at end of file +} diff --git a/dlls/client.cpp b/dlls/client.cpp index a1f34be..a7b841c 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -301,7 +301,8 @@ void Host_Say( edict_t *pEntity, int teamonly ) } // make sure the text has content - for ( char *pc = p; pc != NULL && *pc != 0; pc++ ) + char *pc; + for ( pc = p; pc != NULL && *pc != 0; pc++ ) { if ( isprint( *pc ) && !isspace( *pc ) ) { diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index 2bb2dd2..ba88db3 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -655,7 +655,8 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull, // Mark all the nodes as unvisited. // - for ( int i = 0; i < m_cNodes; i++) + int i; + for ( i = 0; i < m_cNodes; i++) { m_pNodes[ i ].m_flClosestSoFar = -1.0; } @@ -2732,7 +2733,8 @@ void CGraph::HashChoosePrimes(int TableSize) // We divide this interval into 16 equal sized zones. We want to find // one prime number that best represents that zone. // - for (int iZone = 1, iPrime = 0; iPrime < 16; iZone += Spacing) + int iZone, iPrime; + for (iZone = 1, iPrime = 0; iPrime < 16; iZone += Spacing) { // Search for a prime number that is less than the target zone // number given by iZone. @@ -2788,9 +2790,9 @@ void CGraph::SortNodes(void) // After assigning new node numbers to everything, we move // things and patchup the links. // - int iNodeCnt = 0; + int iNodeCnt = 0, i; m_pNodes[0].m_iPreviousNode = iNodeCnt++; - for (int i = 1; i < m_cNodes; i++) + for (i = 1; i < m_cNodes; i++) { m_pNodes[i].m_iPreviousNode = UNNUMBERED_NODE; } @@ -2855,7 +2857,8 @@ void CGraph::BuildLinkLookups(void) ALERT(at_aiconsole, "Couldn't allocated Link Lookup Table.\n"); return; } - for (int i = 0; i < m_nHashLinks; i++) + int i; + for (i = 0; i < m_nHashLinks; i++) { m_pHashLinks[i] = ENTRY_STATE_EMPTY; } @@ -2895,7 +2898,8 @@ void CGraph::BuildRegionTables(void) // Calculate regions for all the nodes. // // - for (int i = 0; i < 3; i++) + int i; + for (i = 0; i < 3; i++) { m_RegionMin[i] = 999999999.0; // just a big number out there; m_RegionMax[i] = -999999999.0; // just a big number out there; @@ -2925,7 +2929,8 @@ void CGraph::BuildRegionTables(void) for (i = 0; i < 3; i++) { - for (int j = 0; j < NUM_RANGES; j++) + int j; + for (j = 0; j < NUM_RANGES; j++) { m_RangeStart[i][j] = 255; m_RangeEnd[i][j] = 0; @@ -3059,7 +3064,8 @@ void CGraph :: ComputeStaticRoutingTables( void ) // Initialize Routing table to uncalculated. // - for (int iFrom = 0; iFrom < m_cNodes; iFrom++) + int iFrom; + for (iFrom = 0; iFrom < m_cNodes; iFrom++) { for (int iTo = 0; iTo < m_cNodes; iTo++) { @@ -3275,7 +3281,8 @@ void CGraph :: ComputeStaticRoutingTables( void ) int nRoute = p - pRoute; if (m_pRouteInfo) { - for (int i = 0; i < m_nRouteInfo - nRoute; i++) + int i; + for (i = 0; i < m_nRouteInfo - nRoute; i++) { if (memcmp(m_pRouteInfo + i, pRoute, nRoute) == 0) { @@ -3367,7 +3374,8 @@ void CGraph :: TestRoutingTables( void ) // #if 1 float flDistance1 = 0.0; - for (int i = 0; i < cPathSize1-1; i++) + int i; + for (i = 0; i < cPathSize1-1; i++) { // Find the link from pMyPath[i] to pMyPath[i+1] // @@ -3421,7 +3429,8 @@ void CGraph :: TestRoutingTables( void ) #endif ALERT(at_aiconsole, "Routing is inconsistent!!!\n"); ALERT(at_aiconsole, "(%d to %d |%d/%d)1:", iFrom, iTo, iHull, iCap); - for (int i = 0; i < cPathSize1; i++) + int i; + for (i = 0; i < cPathSize1; i++) { ALERT(at_aiconsole, "%d ", pMyPath[i]); } diff --git a/dlls/player.cpp b/dlls/player.cpp index 57a3820..6b3a5b0 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -272,7 +272,8 @@ BOOL CPlayerInventory::SetInventory( int Slot, int Index ) void CPlayerInventory::SpawnInventory( CBasePlayer *pPlayer ) { - for( int i = 0;i < 5;i++ ) + int i; + for( i = 0;i < 5;i++ ) { playeritemlist_t *pList = GetListForSlot( i ); int index;