Skip to content

Commit c2caf8b

Browse files
committed
Revert "Cleaned up some parts of client deathmatch"
This reverts commit da1709d.
1 parent e3035bc commit c2caf8b

File tree

121 files changed

+2063
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+2063
-864
lines changed

Client/core/CSettings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,8 +3397,10 @@ void CSettings::LoadChatPresets( )
33973397
if ( !pPresetsRoot )
33983398
pPresetsRoot = pPresetsFile->CreateRootNode ( CHAT_PRESETS_ROOT );
33993399

3400-
for ( auto& pNode : pPresetsRoot->GetChildren() )
3400+
list < CXMLNode* >::const_iterator iter = pPresetsRoot->ChildrenBegin ();
3401+
for ( ; iter != pPresetsRoot->ChildrenEnd (); iter++ )
34013402
{
3403+
CXMLNode* pNode = reinterpret_cast < CXMLNode* > ( *iter );
34023404
if ( pNode->GetTagName ().compare ( "preset" ) == 0 )
34033405
{
34043406
CXMLAttribute* pName = pNode->GetAttributes().Find ( "name" );
@@ -3475,9 +3477,11 @@ bool CSettings::OnChatLoadPresetClick( CGUIElement* pElement )
34753477
if ( !pNode )
34763478
return true;
34773479

3478-
for ( auto& pSubNode : pNode->GetChildren() )
3480+
list < CXMLNode* >::const_iterator iter = pNode->ChildrenBegin ();
3481+
for ( ; iter != pNode->ChildrenEnd (); iter++ )
34793482
{
34803483
// Load all settings provided
3484+
CXMLNode* pSubNode = reinterpret_cast < CXMLNode* > ( *iter );
34813485
string strTag = pSubNode->GetTagName ();
34823486
string strValue = pSubNode->GetTagContent();
34833487

Client/core/Webbrowser/CWebCore.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,9 @@ void CWebCore::LoadListsFromXML ( bool bWhitelist, bool bBlacklist, bool bCustom
580580
CXMLNode* pWhiteSubNode = pRootNode->FindSubNode ( "globalwhitelist" );
581581
if ( pWhiteSubNode )
582582
{
583-
for ( auto& pChild : pWhiteSubNode->GetChildren() )
583+
for ( std::list<CXMLNode*>::iterator iter = pWhiteSubNode->ChildrenBegin (); iter != pWhiteSubNode->ChildrenEnd (); ++iter )
584584
{
585-
AddAllowedPage ( pChild->GetTagContent (), eWebFilterType::WEBFILTER_DYNAMIC );
585+
AddAllowedPage ( (*iter)->GetTagContent (), eWebFilterType::WEBFILTER_DYNAMIC );
586586
}
587587
}
588588
}
@@ -592,9 +592,9 @@ void CWebCore::LoadListsFromXML ( bool bWhitelist, bool bBlacklist, bool bCustom
592592
CXMLNode* pBlackSubNode = pRootNode->FindSubNode ( "globalblacklist" );
593593
if ( pBlackSubNode )
594594
{
595-
for (auto& pChild : pBlackSubNode->GetChildren())
595+
for ( std::list<CXMLNode*>::iterator iter = pBlackSubNode->ChildrenBegin (); iter != pBlackSubNode->ChildrenEnd (); ++iter )
596596
{
597-
AddBlockedPage (pChild->GetTagContent (), eWebFilterType::WEBFILTER_DYNAMIC );
597+
AddBlockedPage ( (*iter)->GetTagContent (), eWebFilterType::WEBFILTER_DYNAMIC );
598598
}
599599
}
600600
}
@@ -604,17 +604,17 @@ void CWebCore::LoadListsFromXML ( bool bWhitelist, bool bBlacklist, bool bCustom
604604
CXMLNode* pBlackSubNode = pRootNode->FindSubNode ( "customblacklist" );
605605
if ( pBlackSubNode )
606606
{
607-
for (auto& pChild : pBlackSubNode->GetChildren())
607+
for ( std::list<CXMLNode*>::iterator iter = pBlackSubNode->ChildrenBegin (); iter != pBlackSubNode->ChildrenEnd (); ++iter )
608608
{
609-
AddBlockedPage (pChild->GetTagContent (), eWebFilterType::WEBFILTER_USER );
609+
AddBlockedPage ( (*iter)->GetTagContent (), eWebFilterType::WEBFILTER_USER );
610610
}
611611
}
612612
CXMLNode* pWhiteSubNode = pRootNode->FindSubNode ( "customwhitelist" );
613613
if ( pWhiteSubNode )
614614
{
615-
for (auto& pChild : pWhiteSubNode->GetChildren())
615+
for ( std::list<CXMLNode*>::iterator iter = pWhiteSubNode->ChildrenBegin (); iter != pWhiteSubNode->ChildrenEnd (); ++iter )
616616
{
617-
AddAllowedPage (pChild->GetTagContent (), eWebFilterType::WEBFILTER_USER );
617+
AddAllowedPage ( (*iter)->GetTagContent (), eWebFilterType::WEBFILTER_USER );
618618
}
619619
}
620620
}

Client/game_sa/CModelInfoSA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ BYTE CModelInfoSA::GetLevelFromPosition ( CVector * vecPosition )
466466
return bReturn;
467467
}
468468

469-
bool CModelInfoSA::IsLoaded ( )
469+
BOOL CModelInfoSA::IsLoaded ( )
470470
{
471471
if ( DoIsLoaded () )
472472
{

Client/game_sa/CModelInfoSA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class CModelInfoSA : public CModelInfo
299299
VOID Request ( EModelRequestType requestType, const char* szTag );
300300
VOID Remove ( void );
301301
BYTE GetLevelFromPosition ( CVector * vecPosition );
302-
bool IsLoaded ( void );
302+
BOOL IsLoaded ( void );
303303
BOOL DoIsLoaded ( void );
304304
BYTE GetFlags ( void );
305305
CBoundingBox * GetBoundingBox ( void );
@@ -361,4 +361,4 @@ class CModelInfoSA : public CModelInfo
361361
void RwSetSupportedUpgrades ( RwFrame * parent, DWORD dwModel );
362362
};
363363

364-
#endif
364+
#endif

Client/mods/deathmatch/CClient.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ int CClient::ClientInitialize ( const char* szArguments, CCoreInterface* pCore )
102102
g_pCore->GetCommands ()->Add ( "showsync", "show sync data", COMMAND_ShowSyncData );
103103
//g_pCore->GetCommands ()->Add ( "dumpall", "dump internals (comment)", COMMAND_DumpPlayers );
104104
#endif
105+
#ifdef MTA_DEBUG
106+
g_pCore->GetCommands ()->Add ( "foo", "debug command for devs", COMMAND_Foo );
107+
#endif
105108

106109
// Debug commands
107110
#if defined (MTA_DEBUG) || defined(MTA_BETA)
@@ -306,12 +309,14 @@ bool CClient::HandleException ( CExceptionInformation* pExceptionInformation )
306309

307310
void CClient::GetPlayerNames ( std::vector<SString> &vPlayerNames )
308311
{
309-
if ( g_pClientGame )
310-
{
312+
if ( g_pClientGame ) {
311313
vPlayerNames.clear ();
312-
for ( auto& pPlayer : g_pClientGame->GetPlayerManager()->GetPlayers() )
314+
for ( std::vector<CClientPlayer*>::const_iterator iter = g_pClientGame->GetPlayerManager ()->IterBegin ();
315+
iter != g_pClientGame->GetPlayerManager ()->IterEnd ();
316+
++iter )
313317
{
314-
SString strPlayerName = pPlayer->GetNametagText ();
318+
CClientPlayer* pClient = *iter;
319+
SString strPlayerName = pClient->GetNametagText ();
315320
vPlayerNames.push_back ( strPlayerName );
316321
}
317322
}

Client/mods/deathmatch/ClientCommands.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ void COMMAND_RadioPrevious ( const char* szCmdLine )
233233
}
234234
}
235235

236+
/*
237+
void COMMAND_Screenshot ( const char* szCmdLine )
238+
{
239+
g_pClientGame->GetScreenshot ()->SetScreenshotKey ( true );
240+
}
241+
*/
242+
236243
void COMMAND_RadarMap ( const char* szCmdLine )
237244
{
238245
int iCmd = ( szCmdLine && szCmdLine [ 0 ] ) ? atoi ( szCmdLine ) : -1;
@@ -723,10 +730,11 @@ void COMMAND_DumpPlayers ( const char* szCmdLine )
723730
fprintf ( pFile, "Used point single link pool: %u\n\n\n", g_pGame->GetPools ()->GetNumberOfUsedSpaces ( POINTER_SINGLE_LINK_POOL ) );
724731

725732
// Loop through all players
726-
for ( auto& pPlayer : g_pClientGame->GetPlayerManager()->GetPlayers() )
733+
vector < CClientPlayer* > ::const_iterator iter = g_pClientGame->GetPlayerManager ()->IterBegin ();
734+
for ( ; iter != g_pClientGame->GetPlayerManager ()->IterEnd (); iter++ )
727735
{
728736
// Write the player dump
729-
DumpPlayer ( pPlayer, pFile );
737+
DumpPlayer ( *iter, pFile );
730738
}
731739

732740
// End of the dump. Close it
@@ -786,6 +794,15 @@ void COMMAND_ShowSyncing ( const char *szCmdLine )
786794

787795
#endif
788796

797+
#ifdef MTA_DEBUG
798+
799+
void COMMAND_Foo ( const char* szCmdLine )
800+
{
801+
g_pClientGame->m_Foo.Test ( szCmdLine );
802+
}
803+
804+
#endif
805+
789806
#if defined(MTA_DEBUG) || defined(MTA_DEBUG_COMMANDS)
790807
void COMMAND_ShowWepdata ( const char* szCmdLine )
791808
{

Client/mods/deathmatch/logic/CAntiCheat.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,28 @@ void CAntiCheat::AddModule ( CAntiCheatModule& Module )
3838

3939
void CAntiCheat::RemoveModule ( CAntiCheatModule& Module )
4040
{
41-
// Find the entry
42-
auto iter = std::find(m_Entries.begin(), m_Entries.end(), &Module);
43-
// Did we find it?
44-
if (iter == m_Entries.end())
45-
return;
46-
47-
// Does this iterator match our last index?
48-
if (m_LastEntry == iter)
41+
// Find the entry
42+
std::list < CAntiCheatModule* > ::iterator iter = m_Entries.begin ();
43+
for ( ; iter != m_Entries.end (); iter++ )
4944
{
50-
// Make it our last entry. This might be end(), but it'll be valid.
51-
m_LastEntry = m_Entries.erase(iter);
52-
return;
45+
// Is this the module?
46+
if ( *iter == &Module )
47+
{
48+
// Does this iterator match our last index?
49+
if ( m_LastEntry == iter )
50+
{
51+
// Make it our last entry. This might be end(), but it'll be valid.
52+
m_LastEntry = m_Entries.erase ( iter );
53+
return;
54+
}
55+
else
56+
{
57+
// Just erase it and return. Our last entry should be valid.
58+
m_Entries.erase ( iter );
59+
return;
60+
}
61+
}
5362
}
54-
else
55-
{
56-
// Just erase it and return. Our last entry should be valid.
57-
m_Entries.erase(iter);
58-
return;
59-
}
60-
6163
}
6264

6365

Client/mods/deathmatch/logic/CClient3DMarker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ CClient3DMarker::CClient3DMarker ( CClientMarker * pThis )
2929
}
3030

3131

32+
CClient3DMarker::~CClient3DMarker ( void )
33+
{
34+
35+
}
36+
37+
3238
unsigned long CClient3DMarker::Get3DMarkerType ( void )
3339
{
3440
switch ( m_dwType )

Client/mods/deathmatch/logic/CClient3DMarker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CClient3DMarker : public CClientMarkerCommon
2828
};
2929

3030
CClient3DMarker ( CClientMarker * pThis );
31-
~CClient3DMarker ( void ) = default;
31+
~CClient3DMarker ( void );
3232

3333
inline unsigned int GetMarkerType ( void ) const { return CClientMarkerCommon::CLASS_3DMARKER; };
3434

Client/mods/deathmatch/logic/CClientColManager.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#include "StdInc.h"
1414

15+
using std::list;
16+
using std::vector;
17+
1518
CClientColManager::~CClientColManager ( void )
1619
{
1720
DeleteAll ();
@@ -55,9 +58,10 @@ void CClientColManager::DoHitDetectionForColShape ( CClientColShape* pShape )
5558
CClientEntityResult result;
5659
GetClientSpatialDatabase()->SphereQuery ( result, querySphere );
5760

58-
// Extract relevant types
59-
for ( auto& pEntity : result )
61+
// Extract relevant types
62+
for ( CClientEntityResult::const_iterator it = result.begin () ; it != result.end (); ++it )
6063
{
64+
CClientEntity* pEntity = *it;
6165
switch ( pEntity->GetType () )
6266
{
6367
case CCLIENTRADARMARKER:
@@ -78,16 +82,16 @@ void CClientColManager::DoHitDetectionForColShape ( CClientColShape* pShape )
7882
}
7983
}
8084

81-
// Add existing colliders, so they can be disconnected if required
82-
for (auto& it : pShape->GetColliders() )
85+
// Add existing colliders, so they can be disconnected if required
86+
for ( CFastList < CClientEntity* > ::const_iterator it = pShape->CollidersBegin () ; it != pShape->CollidersEnd (); ++it )
8387
{
84-
entityList[ it ] = 1;
88+
entityList[ *it ] = 1;
8589
}
8690

87-
// Test each entity against the colshape
88-
for (auto& it : entityList)
89-
{
90-
CClientEntity* pEntity = it.first;
91+
// Test each entity against the colshape
92+
for ( std::map < CClientEntity*, int > ::const_iterator it = entityList.begin () ; it != entityList.end (); ++it )
93+
{
94+
CClientEntity* pEntity = it->first;
9195
CVector vecPosition;
9296
pEntity->GetPosition ( vecPosition );
9397

@@ -110,18 +114,18 @@ void CClientColManager::DoHitDetectionForEntity ( const CVector& vecNowPosition,
110114
GetClientSpatialDatabase()->SphereQuery ( queryResult, CSphere ( vecNowPosition, fRadius ) );
111115

112116
// Extract colshapes
113-
for ( auto& pColShape : queryResult )
114-
if ( pColShape->GetType () == CCLIENTCOLSHAPE )
115-
shortList[ (CClientColShape*)pColShape ] = 1;
117+
for ( CClientEntityResult ::const_iterator it = queryResult.begin () ; it != queryResult.end (); ++it )
118+
if ( (*it)->GetType () == CCLIENTCOLSHAPE )
119+
shortList[ (CClientColShape*)*it ] = 1;
116120

117121
// Add existing collisions, so they can be disconnected if required
118-
for ( auto& it : pEntity->GetCollisions() )
119-
shortList[ it ] = 1;
122+
for ( CFastList < CClientColShape* > ::const_iterator it = pEntity->CollisionsBegin () ; it != pEntity->CollisionsEnd (); ++it )
123+
shortList[ *it ] = 1;
120124

121125
// Test each colshape against the entity
122-
for ( auto& it : shortList )
126+
for ( std::map < CClientColShape*, int > ::const_iterator it = shortList.begin () ; it != shortList.end (); ++it )
123127
{
124-
CClientColShape* pShape = it.first;
128+
CClientColShape* pShape = it->first;
125129

126130
// Enabled and not being deleted?
127131
if ( !pShape->IsBeingDeleted () && pShape->IsEnabled () )
@@ -203,10 +207,11 @@ bool CClientColManager::Exists ( CClientColShape* pShape )
203207
void CClientColManager::DeleteAll ( void )
204208
{
205209
// Delete all of them
206-
std::vector < CClientColShape * > cloneList = m_List;
207-
for ( auto& iter : cloneList )
210+
vector < CClientColShape * > cloneList = m_List;
211+
vector < CClientColShape* > ::const_iterator iter = cloneList.begin ();
212+
for ( ; iter != cloneList.end (); ++iter )
208213
{
209-
delete iter;
214+
delete *iter;
210215
}
211216
m_List.clear ();
212217
}

0 commit comments

Comments
 (0)