@@ -785,27 +785,26 @@ void CActor::Die(IGameObject* who)
785785 if (!IsGameTypeSingle ())
786786 {
787787 // if we are on server and actor has PDA - destroy PDA
788- TIItemContainer& l_rlist = inventory ().m_ruck ;
789- for (TIItemContainer::iterator l_it = l_rlist.begin (); l_rlist.end () != l_it; ++l_it)
788+ for (auto & l_it : inventory ().m_ruck )
790789 {
791790 if (GameID () == eGameIDArtefactHunt)
792791 {
793- CArtefact* pArtefact = smart_cast<CArtefact*>(* l_it);
792+ auto pArtefact = smart_cast<CArtefact*>(l_it);
794793 if (pArtefact)
795794 {
796- (* l_it) ->SetDropManual (TRUE );
795+ l_it->SetDropManual (true );
797796 continue ;
798- };
799- };
797+ }
798+ }
800799
801- if ((* l_it) ->object ().CLS_ID == CLSID_OBJECT_PLAYERS_BAG)
800+ if (l_it->object ().CLS_ID == CLSID_OBJECT_PLAYERS_BAG)
802801 {
803- (* l_it) ->SetDropManual (TRUE );
802+ l_it->SetDropManual (true );
804803 continue ;
805- };
806- };
807- };
808- };
804+ }
805+ }
806+ }
807+ }
809808
810809 if (!GEnv.isDedicatedServer )
811810 {
@@ -958,13 +957,14 @@ void CActor::UpdateCL()
958957
959958 if (m_feel_touch_characters > 0 )
960959 {
961- for (xr_vector<IGameObject*>::iterator it = feel_touch. begin (); it != feel_touch. end (); it++ )
960+ for (auto & it : feel_touch)
962961 {
963- CPhysicsShellHolder* sh = smart_cast<CPhysicsShellHolder*>(* it);
964- if (sh && sh-> character_physics_support () )
962+ auto sh = smart_cast<CPhysicsShellHolder*>(it);
963+ if (sh)
965964 {
966- sh->character_physics_support ()->movement ()->UpdateObjectBox (
967- character_physics_support ()->movement ()->PHCharacter ());
965+ auto shcps = sh->character_physics_support ();
966+ if (shcps)
967+ shcps->movement ()->UpdateObjectBox (shcps->movement ()->PHCharacter ());
968968 }
969969 }
970970 }
@@ -1705,12 +1705,9 @@ void CActor::OnItemDropUpdate()
17051705{
17061706 CInventoryOwner::OnItemDropUpdate ();
17071707
1708- TIItemContainer::iterator I = inventory ().m_all .begin ();
1709- TIItemContainer::iterator E = inventory ().m_all .end ();
1710-
1711- for (; I != E; ++I)
1712- if (!(*I)->IsInvalid () && !attached (*I))
1713- attach (*I);
1708+ for (auto & it : inventory ().m_all )
1709+ if (it->IsInvalid () && !attached (it))
1710+ attach (it);
17141711}
17151712
17161713void CActor::OnItemRuck (CInventoryItem* inventory_item, const SInvItemPlace& previous_place)
@@ -1742,9 +1739,9 @@ void CActor::UpdateArtefactsOnBeltAndOutfit()
17421739 update_time = 0 .0f ;
17431740 }
17441741
1745- for (TIItemContainer::iterator it = inventory ().m_belt . begin (); inventory (). m_belt . end () != it; ++it )
1742+ for (auto & it : inventory ().m_belt )
17461743 {
1747- CArtefact* artefact = smart_cast<CArtefact*>(* it);
1744+ const auto artefact = smart_cast<CArtefact*>(it);
17481745 if (artefact)
17491746 {
17501747 conditions ().ChangeBleeding (artefact->m_fBleedingRestoreSpeed * f_update_time);
@@ -1761,6 +1758,7 @@ void CActor::UpdateArtefactsOnBeltAndOutfit()
17611758 conditions ().ChangeRadiation (artefact->m_fRadiationRestoreSpeed * f_update_time);
17621759 }
17631760 }
1761+
17641762 CCustomOutfit* outfit = GetOutfit ();
17651763 if (outfit)
17661764 {
@@ -1786,15 +1784,11 @@ void CActor::UpdateArtefactsOnBeltAndOutfit()
17861784
17871785float CActor::HitArtefactsOnBelt (float hit_power, ALife::EHitType hit_type)
17881786{
1789- TIItemContainer::iterator it = inventory ().m_belt .begin ();
1790- TIItemContainer::iterator ite = inventory ().m_belt .end ();
1791- for (; it != ite; ++it)
1787+ for (auto & it : inventory ().m_belt )
17921788 {
1793- CArtefact* artefact = smart_cast<CArtefact*>(* it);
1789+ const auto artefact = smart_cast<CArtefact*>(it);
17941790 if (artefact)
1795- {
17961791 hit_power -= artefact->m_ArtefactHitImmunities .AffectHit (1 .0f , hit_type);
1797- }
17981792 }
17991793 clamp (hit_power, 0 .0f , flt_max);
18001794
@@ -1804,15 +1798,11 @@ float CActor::HitArtefactsOnBelt(float hit_power, ALife::EHitType hit_type)
18041798float CActor::GetProtection_ArtefactsOnBelt (ALife::EHitType hit_type)
18051799{
18061800 float sum = 0 .0f ;
1807- TIItemContainer::iterator it = inventory ().m_belt .begin ();
1808- TIItemContainer::iterator ite = inventory ().m_belt .end ();
1809- for (; it != ite; ++it)
1801+ for (auto & it : inventory ().m_belt )
18101802 {
1811- CArtefact* artefact = smart_cast<CArtefact*>(* it);
1803+ const auto artefact = smart_cast<CArtefact*>(it);
18121804 if (artefact)
1813- {
18141805 sum += artefact->m_ArtefactHitImmunities .AffectHit (1 .0f , hit_type);
1815- }
18161806 }
18171807 return sum;
18181808}
@@ -1917,7 +1907,7 @@ bool CActor::can_attach(const CInventoryItem* inventory_item) const
19171907 std::find (m_attach_item_sections.begin (), m_attach_item_sections.end (), inventory_item->object ().cNameSect ()))
19181908 return false ;
19191909
1920- // если уже есть присоединненый объет такого типа
1910+ // если уже есть присоединённый объект такого типа
19211911 if (attached (inventory_item->object ().cNameSect ()))
19221912 return false ;
19231913
@@ -1928,7 +1918,7 @@ void CActor::OnDifficultyChanged()
19281918{
19291919 // immunities
19301920 VERIFY (g_SingleGameDifficulty >= egdNovice && g_SingleGameDifficulty <= egdMaster);
1931- LPCSTR diff_name = get_token_name (difficulty_type_token, g_SingleGameDifficulty);
1921+ pcstr diff_name = get_token_name (difficulty_type_token, g_SingleGameDifficulty);
19321922 string128 tmp;
19331923 strconcat (sizeof (tmp), tmp, " actor_immunities_" , diff_name);
19341924 conditions ().LoadImmunities (tmp, pSettings);
@@ -1940,7 +1930,7 @@ void CActor::OnDifficultyChanged()
19401930 conditions ().LoadTwoHitsDeathParams (tmp);
19411931}
19421932
1943- CVisualMemoryManager* CActor::visual_memory () const { return ( &memory ().visual () ); }
1933+ CVisualMemoryManager* CActor::visual_memory () const { return &memory ().visual (); }
19441934float CActor::GetMass ()
19451935{
19461936 return g_Alive () ? character_physics_support ()->movement ()->GetMass () :
@@ -1949,12 +1939,12 @@ float CActor::GetMass()
19491939
19501940bool CActor::is_on_ground ()
19511941{
1952- return ( character_physics_support ()->movement ()->Environment () != CPHMovementControl::peInAir) ;
1942+ return character_physics_support ()->movement ()->Environment () != CPHMovementControl::peInAir;
19531943}
19541944
19551945bool CActor::is_ai_obstacle () const
19561946{
1957- return ( false ) ; // true);
1947+ return false ; // true);
19581948}
19591949
19601950float CActor::GetRestoreSpeed (ALife::EConditionRestoreType const & type)
@@ -1965,80 +1955,64 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
19651955 case ALife::eHealthRestoreSpeed:
19661956 {
19671957 res = conditions ().change_v ().m_fV_HealthRestore ;
1968- res += conditions ().V_SatietyHealth () * (( conditions ().GetSatiety () > 0 .0f ) ? 1 .0f : -1 .0f );
1958+ res += conditions ().V_SatietyHealth () * (conditions ().GetSatiety () > 0 .0f ? 1 .0f : -1 .0f );
19691959
1970- TIItemContainer::iterator itb = inventory ().m_belt .begin ();
1971- TIItemContainer::iterator ite = inventory ().m_belt .end ();
1972- for (; itb != ite; ++itb)
1960+ for (auto & it : inventory ().m_belt )
19731961 {
1974- CArtefact* artefact = smart_cast<CArtefact*>(*itb );
1962+ const auto artefact = smart_cast<CArtefact*>(it );
19751963 if (artefact)
1976- {
19771964 res += artefact->m_fHealthRestoreSpeed ;
1978- }
19791965 }
1980- CCustomOutfit* outfit = GetOutfit ();
1966+
1967+ const auto outfit = GetOutfit ();
19811968 if (outfit)
1982- {
19831969 res += outfit->m_fHealthRestoreSpeed ;
1984- }
1970+
19851971 break ;
19861972 }
19871973 case ALife::eRadiationRestoreSpeed:
19881974 {
1989- TIItemContainer::iterator itb = inventory ().m_belt .begin ();
1990- TIItemContainer::iterator ite = inventory ().m_belt .end ();
1991- for (; itb != ite; ++itb)
1975+ for (auto & it : inventory ().m_belt )
19921976 {
1993- CArtefact* artefact = smart_cast<CArtefact*>(*itb );
1977+ const auto artefact = smart_cast<CArtefact*>(it );
19941978 if (artefact)
1995- {
19961979 res += artefact->m_fRadiationRestoreSpeed ;
1997- }
19981980 }
1999- CCustomOutfit* outfit = GetOutfit ();
1981+
1982+ const auto outfit = GetOutfit ();
20001983 if (outfit)
2001- {
20021984 res += outfit->m_fRadiationRestoreSpeed ;
2003- }
1985+
20041986 break ;
20051987 }
20061988 case ALife::eSatietyRestoreSpeed:
20071989 {
20081990 res = conditions ().V_Satiety ();
20091991
2010- TIItemContainer::iterator itb = inventory ().m_belt .begin ();
2011- TIItemContainer::iterator ite = inventory ().m_belt .end ();
2012- for (; itb != ite; ++itb)
1992+ for (auto & it : inventory ().m_belt )
20131993 {
2014- CArtefact* artefact = smart_cast<CArtefact*>(*itb );
1994+ const auto artefact = smart_cast<CArtefact*>(it );
20151995 if (artefact)
2016- {
20171996 res += artefact->m_fSatietyRestoreSpeed ;
2018- }
20191997 }
2020- CCustomOutfit* outfit = GetOutfit ();
1998+
1999+ const auto outfit = GetOutfit ();
20212000 if (outfit)
2022- {
20232001 res += outfit->m_fSatietyRestoreSpeed ;
2024- }
2002+
20252003 break ;
20262004 }
20272005 case ALife::ePowerRestoreSpeed:
20282006 {
20292007 res = conditions ().GetSatietyPower ();
20302008
2031- TIItemContainer::iterator itb = inventory ().m_belt .begin ();
2032- TIItemContainer::iterator ite = inventory ().m_belt .end ();
2033- for (; itb != ite; ++itb)
2009+ for (auto & it : inventory ().m_belt )
20342010 {
2035- CArtefact* artefact = smart_cast<CArtefact*>(*itb );
2011+ const auto artefact = smart_cast<CArtefact*>(it );
20362012 if (artefact)
2037- {
20382013 res += artefact->m_fPowerRestoreSpeed ;
2039- }
20402014 }
2041- CCustomOutfit* outfit = GetOutfit ();
2015+ auto outfit = GetOutfit ();
20422016 if (outfit)
20432017 {
20442018 res += outfit->m_fPowerRestoreSpeed ;
@@ -2047,27 +2021,24 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
20472021 }
20482022 else
20492023 res /= 0 .5f ;
2024+
20502025 break ;
20512026 }
20522027 case ALife::eBleedingRestoreSpeed:
20532028 {
20542029 res = conditions ().change_v ().m_fV_WoundIncarnation ;
20552030
2056- TIItemContainer::iterator itb = inventory ().m_belt .begin ();
2057- TIItemContainer::iterator ite = inventory ().m_belt .end ();
2058- for (; itb != ite; ++itb)
2031+ for (auto & it : inventory ().m_belt )
20592032 {
2060- CArtefact* artefact = smart_cast<CArtefact*>(*itb );
2033+ const auto artefact = smart_cast<CArtefact*>(it );
20612034 if (artefact)
2062- {
20632035 res += artefact->m_fBleedingRestoreSpeed ;
2064- }
20652036 }
2066- CCustomOutfit* outfit = GetOutfit ();
2037+
2038+ const auto outfit = GetOutfit ();
20672039 if (outfit)
2068- {
20692040 res += outfit->m_fBleedingRestoreSpeed ;
2070- }
2041+
20712042 break ;
20722043 }
20732044 } // switch
@@ -2077,7 +2048,7 @@ float CActor::GetRestoreSpeed(ALife::EConditionRestoreType const& type)
20772048
20782049void CActor::On_SetEntity ()
20792050{
2080- CCustomOutfit* pOutfit = GetOutfit ();
2051+ auto pOutfit = GetOutfit ();
20812052 if (!pOutfit)
20822053 g_player_hud->load_default ();
20832054 else
0 commit comments