diff --git a/src/xrAICore/Navigation/data_storage_binary_heap_inline.h b/src/xrAICore/Navigation/data_storage_binary_heap_inline.h index ac370b745df..71d95003357 100644 --- a/src/xrAICore/Navigation/data_storage_binary_heap_inline.h +++ b/src/xrAICore/Navigation/data_storage_binary_heap_inline.h @@ -59,7 +59,9 @@ TEMPLATE_SPECIALIZATION inline void CBinaryHeap::decrease_opened(Vertex &vertex, const Distance value) { VERIFY(!is_opened_empty()); - for (Vertex **i = m_heap_head; *i!=&vertex; i++); + Vertex **i = m_heap_head; + while (*i!=&vertex) + i++; std::push_heap(m_heap_head, i+1, VertexPredicate()); } diff --git a/src/xrAICore/Navigation/edge_path_inline.h b/src/xrAICore/Navigation/edge_path_inline.h index a2de39d615f..b06705cedd7 100644 --- a/src/xrAICore/Navigation/edge_path_inline.h +++ b/src/xrAICore/Navigation/edge_path_inline.h @@ -38,7 +38,8 @@ TEMPLATE_SPECIALIZATION inline void CEdgePathBuilder::get_edge_path(xr_vector &path, Vertex *best, bool reverse_order) { Vertex *t1 = best, *t2 = best->back(); - for (u32 i=1; t2; t1 = t2, t2 = t2->back(), i++); + u32 i; + for (i=1; t2; t1 = t2, t2 = t2->back(), i++); u32 n = (u32)path.size(); i--; path.resize(n+i); diff --git a/src/xrGame/AI_PhraseDialogManager.cpp b/src/xrGame/AI_PhraseDialogManager.cpp index e25cd228e73..93f91282f7b 100644 --- a/src/xrGame/AI_PhraseDialogManager.cpp +++ b/src/xrGame/AI_PhraseDialogManager.cpp @@ -59,7 +59,7 @@ void CAI_PhraseDialogManager::AnswerPhrase (DIALOG_SHARED_PTR& phrase_dialog) } } - for(i=0; iPhraseList().size(); i++) + for(u32 i=0; iPhraseList().size(); i++) { if(phrase_goodwill == phrase_dialog->PhraseList()[phrase_num]->GoodwillLevel()) phrases.push_back(i); diff --git a/src/xrGame/ActorCameras.cpp b/src/xrGame/ActorCameras.cpp index c9df047bcc2..ad60cff9f2c 100644 --- a/src/xrGame/ActorCameras.cpp +++ b/src/xrGame/ActorCameras.cpp @@ -254,7 +254,8 @@ void CActor::cam_Lookout ( const Fmatrix &xform, float camera_height ) da = PI/1000.f; if (!fis_zero(r_torso.roll)) da *= r_torso.roll/_abs(r_torso.roll); - for (float angle=0.f; _abs(angle)<_abs(alpha); angle+=da) + float angle; + for (angle=0.f; _abs(angle)<_abs(alpha); angle+=da) { Fvector pt; calc_gl_point( pt, xform, radius, angle ); diff --git a/src/xrGame/Actor_Network.cpp b/src/xrGame/Actor_Network.cpp index e8a9ed98772..69a31043a83 100644 --- a/src/xrGame/Actor_Network.cpp +++ b/src/xrGame/Actor_Network.cpp @@ -1562,7 +1562,7 @@ void CActor::OnRender_Network() }; //drawing speed vectors - for (i=0; i<2; i++) + for (int i=0; i<2; i++) { c = float(i); for (u32 k=0; k<3; k++) diff --git a/src/xrGame/Inventory.cpp b/src/xrGame/Inventory.cpp index 4f2388d38cf..e83e840e0fe 100644 --- a/src/xrGame/Inventory.cpp +++ b/src/xrGame/Inventory.cpp @@ -825,7 +825,7 @@ void CInventory::UpdateDropTasks() UpdateDropItem (itm); } - for(i = 0; i < 2; ++i) + for(u16 i = 0; i < 2; ++i) { TIItemContainer &list = i?m_ruck:m_belt; TIItemContainer::iterator it = list.begin(); @@ -1197,8 +1197,8 @@ bool CInventory::CanTakeItem(CInventoryItem *inventory_item) const if (inventory_item->object().getDestroy()) return false; if(!inventory_item->CanTake()) return false; - - for(TIItemContainer::const_iterator it = m_all.begin(); it != m_all.end(); it++) + TIItemContainer::const_iterator it; + for(it = m_all.begin(); it != m_all.end(); it++) if((*it)->object().ID() == inventory_item->object().ID()) break; VERIFY3(it == m_all.end(), "item already exists in inventory",*inventory_item->object().cName()); diff --git a/src/xrGame/LevelGraphDebugRender.cpp b/src/xrGame/LevelGraphDebugRender.cpp index f0024f2c7d1..14d07b82ab8 100644 --- a/src/xrGame/LevelGraphDebugRender.cpp +++ b/src/xrGame/LevelGraphDebugRender.cpp @@ -749,7 +749,8 @@ void LevelGraphDebugRender::DrawCovers() CLevelGraph::CVertex *v = levelGraph->vertex(coverPoint->level_vertex_id()); Fvector dir; float bestValue = -1; - for (u32 i = 0, j = 0; i<36; ++i) + u32 j = 0; + for (u32 i = 0; i<36; ++i) { float value = levelGraph->high_cover_in_direction(float(10*i)/180*PI, v); dir.setHP(float(10*i)/180*PI, 0); @@ -785,7 +786,8 @@ void LevelGraphDebugRender::DrawCovers() debugRenderer.draw_aabb(pos, halfSize-0.01f, 1.f, halfSize-0.01f, color_xrgb(0, 255, 0)); v = levelGraph->vertex(coverPoint->level_vertex_id()); bestValue = -1; - for (u32 i = 0, j = 0; i<36; ++i) + j = 0; + for (u32 i = 0; i<36; ++i) { float value = levelGraph->low_cover_in_direction(float(10*i)/180*PI, v); dir.setHP(float(10*i)/180.f*PI, 0); diff --git a/src/xrGame/PHMovementControl.cpp b/src/xrGame/PHMovementControl.cpp index 7175c7f2371..7f837a77cb3 100644 --- a/src/xrGame/PHMovementControl.cpp +++ b/src/xrGame/PHMovementControl.cpp @@ -520,8 +520,8 @@ void CPHMovementControl::PathNearestPoint(const xr_vector1;--i) + int i; + for(i=m_start_index;i>1;--i) { const Fvector &first=path[i-1].position, &second=path[i].position; from_first.sub(new_position,first); diff --git a/src/xrGame/PhraseScript.cpp b/src/xrGame/PhraseScript.cpp index f224dcf4bf9..cabbe386e17 100644 --- a/src/xrGame/PhraseScript.cpp +++ b/src/xrGame/PhraseScript.cpp @@ -52,7 +52,7 @@ bool CDialogScriptHelper::CheckInfo(const CInventoryOwner* pOwner) const } } - for(i=0; iHasInfo(m_DontHasInfo[i])) { #ifdef DEBUG if(psAI_Flags.test(aiDialogs) ) @@ -72,7 +72,7 @@ void CDialogScriptHelper::TransferInfo (const CInventoryOwner* pOwner) const for(u32 i=0; iTransferInfo(m_GiveInfo[i], true); - for(i=0; iTransferInfo(m_DisableInfo[i], false); } diff --git a/src/xrGame/ai/ai_monsters_anims.h b/src/xrGame/ai/ai_monsters_anims.h index 2bb5d371039..e8e9af07105 100644 --- a/src/xrGame/ai/ai_monsters_anims.h +++ b/src/xrGame/ai/ai_monsters_anims.h @@ -28,7 +28,9 @@ template class CAniFVector { { A.clear (); string256 S; - for (int j=0; caBaseNames[j]; ++j); + int j = 0; + while (caBaseNames[j]) + j++; A.resize (j); for (int i=0; i class CAniCollection { { A.clear (); string256 S; - for (int j=0; caBaseNames[j]; ++j); + int j = 0; + while (caBaseNames[j]) + j++; A.resize (j); for (int i=0; i::select_target_for_move () float const move_scan_points = 8; float const move_scan_angle = deg2rad(360.f) / move_scan_points; - - for ( u32 index = 0; - index < move_scan_points; - ++index ) + u32 index = 0; + for (; index(ai().alife().objects().object(m_tpMembers[i])); if (!tpGroupMember) @@ -181,7 +183,7 @@ void CSE_ALifeGroupAbstract::try_switch_offline () tpGroupMember->m_bOnline = true; --m_wCount; --i; - --N; + --memberCount; } // checking if group is not empty @@ -191,7 +193,7 @@ void CSE_ALifeGroupAbstract::try_switch_offline () if (!I->can_switch_offline()) return; - if (I->can_switch_online() || (i == N)) + if (I->can_switch_online() || (i == memberCount)) I->alife().switch_offline (I); } diff --git a/src/xrGame/console_commands_mp.cpp b/src/xrGame/console_commands_mp.cpp index 84286557aeb..23abaaa4456 100644 --- a/src/xrGame/console_commands_mp.cpp +++ b/src/xrGame/console_commands_mp.cpp @@ -223,7 +223,7 @@ class CCC_Dbg_NumObjects : public IConsole_Command { u32 CLObjNum = Level().Objects.o_count(); xr_vector CObjID; - for (i=0; iID()); }; diff --git a/src/xrGame/cover_manager.cpp b/src/xrGame/cover_manager.cpp index 2fcdabf5ff9..694530ddd0f 100644 --- a/src/xrGame/cover_manager.cpp +++ b/src/xrGame/cover_manager.cpp @@ -89,7 +89,8 @@ void CCoverManager::compute_static_cover () m_temp.resize (ai().level_graph().header().vertex_count()); CLevelGraph const &graph = ai().level_graph(); - for (u32 i=0, n = ai().level_graph().header().vertex_count(); iinsert(xr_new(ai().level_graph().vertex_position(ai().level_graph().vertex(i)),i)); diff --git a/src/xrGame/ef_pattern.cpp b/src/xrGame/ef_pattern.cpp index 84a4b483aa3..01412dd6fd5 100644 --- a/src/xrGame/ef_pattern.cpp +++ b/src/xrGame/ef_pattern.cpp @@ -84,7 +84,7 @@ void CPatternFunction::vfLoadEF(LPCSTR caFileName) m_dwaPatternIndexes = xr_alloc(m_dwPatternCount); ZeroMemory (m_dwaPatternIndexes,m_dwPatternCount*sizeof(u32)); m_dwParameterCount = 0; - for ( i=0; ir (&(m_tpPatterns[i].dwCardinality),sizeof(m_tpPatterns[i].dwCardinality)); @@ -132,7 +132,7 @@ float CPatternFunction::ffGetValue() int j = xr_sprintf(caString,sizeof(caString),"%32s (",m_caName); - for ( i=0; ibegin(); + T_VECTOR::iterator it; + for(it = m_pItemDataVector->begin(); m_pItemDataVector->end() != it; it++) { if(!xr_strcmp((*it).id, str_id)) diff --git a/src/xrGame/purchase_list.cpp b/src/xrGame/purchase_list.cpp index 696002c7544..6a9064f0176 100644 --- a/src/xrGame/purchase_list.cpp +++ b/src/xrGame/purchase_list.cpp @@ -48,7 +48,8 @@ void CPurchaseList::process (const CGameObject &owner, const shared_str &name, c const u32 &level_vertex_id = owner.ai_location().level_vertex_id(); const ALife::_OBJECT_ID &id = owner.ID(); CRandom random((u32)(CPU::QPC() & u32(-1))); - for (u32 i=0, j=0; i probability) continue; diff --git a/src/xrGame/relation_registry_fights.cpp b/src/xrGame/relation_registry_fights.cpp index 57045171cf3..40ab86fd52e 100644 --- a/src/xrGame/relation_registry_fights.cpp +++ b/src/xrGame/relation_registry_fights.cpp @@ -27,7 +27,8 @@ void RELATION_REGISTRY::FightRegister (u16 attacker, u16 defender, ALife::ERelat UpdateFightRegister(); FIGHT_VECTOR& fights = fight_registry(); - for(FIGHT_VECTOR_IT it = fights.begin(); it != fights.end(); it++) + FIGHT_VECTOR_IT it; + for(it = fights.begin(); it != fights.end(); it++) { FIGHT_DATA& fight_data = *it; if(attacker == fight_data.attacker && defender == fight_data.defender) diff --git a/src/xrGame/safe_map_iterator_inline.h b/src/xrGame/safe_map_iterator_inline.h index e420b555028..a9c08b44ede 100644 --- a/src/xrGame/safe_map_iterator_inline.h +++ b/src/xrGame/safe_map_iterator_inline.h @@ -122,7 +122,8 @@ IC u32 CSSafeMapIterator::update (const _update_predicate &predicate, bool co ++m_cycle_count; _iterator I = next(); VERIFY (I != m_objects.end()); - for (u32 i=0; (I != m_objects.end()) && !time_over() && predicate(I,m_cycle_count,true); ++i) { + u32 i; + for (i=0; (I != m_objects.end()) && !time_over() && predicate(I,m_cycle_count,true); ++i) { update_next (); predicate (I,m_cycle_count); I = next(); diff --git a/src/xrGame/ui_base.cpp b/src/xrGame/ui_base.cpp index d8d91f33548..d04c29d9453 100644 --- a/src/xrGame/ui_base.cpp +++ b/src/xrGame/ui_base.cpp @@ -57,7 +57,7 @@ sPoly2D* C2DFrustum::ClipPoly (sPoly2D& S, sPoly2D& D) const cls[src->size()] = cls[0] ; src->push_back((*src)[0]) ; Fvector2 dir_pt,dir_uv; float denum,t; - for (j=0; jsize()-1; j++) { + for (u32 j=0; jsize()-1; j++) { if ((*src)[j].pt.similar((*src)[j+1].pt,EPS_S)) continue; if (negative(cls[j])) { dest->push_back((*src)[j]) ; diff --git a/src/xrServerEntities/xml_str_id_loader.h b/src/xrServerEntities/xml_str_id_loader.h index f530b9293a5..0934d0d3d9c 100644 --- a/src/xrServerEntities/xml_str_id_loader.h +++ b/src/xrServerEntities/xml_str_id_loader.h @@ -95,18 +95,17 @@ TEMPLATE_SPECIALIZATION const typename ITEM_DATA* CSXML_IdToIndex::GetById (const shared_str& str_id, bool no_assert) { T_INIT::InitXmlIdToIndex(); - - for(T_VECTOR::iterator it = m_pItemDataVector->begin(); - m_pItemDataVector->end() != it; it++) + T_VECTOR::iterator it; + for (it = m_pItemDataVector->begin(); m_pItemDataVector->end()!=it; it++) { - if( (*it).id == str_id) - break; + if ((*it).id == str_id) + break; } - if(m_pItemDataVector->end() == it) + if (it==m_pItemDataVector->end()) { int i=0; - for(T_VECTOR::iterator it = m_pItemDataVector->begin(); m_pItemDataVector->end() != it; it++,i++) + for (it = m_pItemDataVector->begin(); m_pItemDataVector->end()!=it; it++, i++) Msg("[%d]=[%s]",i,*(*it).id ); R_ASSERT3(no_assert, "item not found, id", *str_id);