Skip to content

Commit

Permalink
Correct files to comply with xr_ini
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Aug 13, 2017
1 parent ef3c96d commit fc16e3d
Show file tree
Hide file tree
Showing 43 changed files with 161 additions and 163 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ModelPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void CModelPool::Prefetch()
string256 section;
strconcat(sizeof(section), section, "prefetch_visuals_", g_pGamePersistent->m_game_params.m_game_type);
CInifile::Sect& sect = pSettings->r_section(section);
for (CInifile::SectCIt I = sect.Data.begin(); I != sect.Data.end(); I++)
for (auto I = sect.Data.cbegin(); I != sect.Data.cend(); I++)
{
const CInifile::Item& item = *I;
dxRender_Visual* V = Create(item.first.c_str());
Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRender/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ bool is_enough_address_space_available() { return true; }
int get_texture_load_lod(LPCSTR fn)
{
CInifile::Sect& sect = pSettings->r_section("reduce_lod_texture_list");
CInifile::SectCIt it_ = sect.Data.begin();
CInifile::SectCIt it_e_ = sect.Data.end();
auto it_ = sect.Data.cbegin();
auto it_e_ = sect.Data.cend();

CInifile::SectCIt it = it_;
CInifile::SectCIt it_e = it_e_;
auto it = it_;
auto it_e = it_e_;

static bool enough_address_space_available = is_enough_address_space_available();

Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRenderDX10/dx10Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ void fix_texture_name(LPSTR fn)
int get_texture_load_lod(LPCSTR fn)
{
CInifile::Sect& sect = pSettings->r_section("reduce_lod_texture_list");
CInifile::SectCIt it_ = sect.Data.begin();
CInifile::SectCIt it_e_ = sect.Data.end();
auto it_ = sect.Data.cbegin();
auto it_e_ = sect.Data.cend();

ENGINE_API bool is_enough_address_space_available();
static bool enough_address_space_available = is_enough_address_space_available();

CInifile::SectCIt it = it_;
CInifile::SectCIt it_e = it_e_;
auto it = it_;
auto it_e = it_e_;

for (; it != it_e; ++it)
{
Expand Down
22 changes: 11 additions & 11 deletions src/utils/mp_configs_verifyer/configs_dump_verifyer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static char* search_info_section(u8* buffer, u32 buffer_size)
--rbegin;
--r_size;
} while (r_size > 0);
return NULL;
return nullptr;
}

bool const configs_verifyer::verify_dsign(u8* data, u32 data_size, sha_checksum_t& sha_checksum)
Expand All @@ -64,7 +64,7 @@ bool const configs_verifyer::verify_dsign(u8* data, u32 data_size, sha_checksum_
u32 dst_size = static_cast<u32>((data + data_size) - (u8*)dst_buffer);
u32 src_data_size = data_size - dst_size;

LPCSTR add_str = NULL;
LPCSTR add_str = nullptr;
STRCONCAT(add_str, tmp_ini.r_string(cd_info_secion, cd_player_name_key),
tmp_ini.r_string(cd_info_secion, cd_player_digest_key), tmp_ini.r_string(cd_info_secion, cd_creation_date));

Expand All @@ -84,14 +84,14 @@ bool const configs_verifyer::verify_dsign(u8* data, u32 data_size, sha_checksum_

LPCSTR configs_verifyer::get_section_diff(CInifile::Sect* sect_ptr, CInifile& active_params, string256& dst_diff)
{
LPCSTR diff_str = NULL;
pcstr diff_str = nullptr;
bool tmp_active_param = false;
if (!strncmp(sect_ptr->Name.c_str(), "ap_", 3))
{
tmp_active_param = true;
}

for (CInifile::SectCIt cit = sect_ptr->Data.begin(), ciet = sect_ptr->Data.end(); cit != ciet; ++cit)
for (auto cit = sect_ptr->Data.cbegin(), ciet = sect_ptr->Data.cend(); cit != ciet; ++cit)
{
shared_str const& tmp_value = cit->second;
shared_str real_value;
Expand All @@ -102,7 +102,7 @@ LPCSTR configs_verifyer::get_section_diff(CInifile::Sect* sect_ptr, CInifile& ac
real_value = active_params.r_string(sect_ptr->Name.c_str(), cit->first.c_str());
if (tmp_value != real_value)
{
LPCSTR tmp_key_str = NULL;
pcstr tmp_key_str = nullptr;
STRCONCAT(tmp_key_str, sect_ptr->Name.c_str(), "::", cit->first.c_str());
STRCONCAT(diff_str, tmp_key_str, " = ", tmp_value.c_str(), ",right = ", real_value.c_str());
strncpy_s(dst_diff, diff_str, sizeof(dst_diff) - 1);
Expand All @@ -122,21 +122,21 @@ LPCSTR configs_verifyer::get_section_diff(CInifile::Sect* sect_ptr, CInifile& ac
real_value = pSettings->r_string(sect_ptr->Name.c_str(), cit->first.c_str());
if (tmp_value != real_value)
{
LPCSTR tmp_key_str = NULL;
pcstr tmp_key_str = nullptr;
STRCONCAT(tmp_key_str, sect_ptr->Name.c_str(), "::", cit->first.c_str());
STRCONCAT(diff_str, tmp_key_str, " = ", tmp_value.c_str(), ",right = ", real_value.c_str());
strncpy_s(dst_diff, diff_str, sizeof(dst_diff) - 1);
dst_diff[sizeof(dst_diff) - 1] = 0;
return dst_diff;
}
}
return NULL;
return nullptr;
}

LPCSTR configs_verifyer::get_diff(CInifile& received, CInifile& active_params, string256& dst_diff)
{
LPCSTR diff_str = NULL;
for (CInifile::RootIt sit = received.sections().begin(), siet = received.sections().end(); sit != siet; ++sit)
pcstr diff_str = nullptr;
for (auto sit = received.sections().begin(), siet = received.sections().end(); sit != siet; ++sit)
{
CInifile::Sect* tmp_sect = *sit;
if (tmp_sect->Name == cd_info_secion)
Expand All @@ -163,7 +163,7 @@ bool const configs_verifyer::verify(u8* data, u32 data_size, string256& diff)
}
IReader tmp_reader(data, data_size);
CInifile tmp_ini(&tmp_reader);
CInifile tmp_active_params(NULL, FALSE, FALSE, FALSE);
CInifile tmp_active_params(nullptr, FALSE, FALSE, FALSE);

string16 tmp_digit;
u32 ap_index = 1;
Expand All @@ -189,7 +189,7 @@ bool const configs_verifyer::verify(u8* data, u32 data_size, string256& diff)
return false;
}

LPCSTR add_str = NULL;
LPCSTR add_str = nullptr;
STRCONCAT(add_str, tmp_ini.r_string(cd_info_secion, cd_player_name_key),
tmp_ini.r_string(cd_info_secion, cd_player_digest_key), tmp_ini.r_string(cd_info_secion, cd_creation_date));

Expand Down
14 changes: 7 additions & 7 deletions src/utils/xrCompress/xrCompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ void xrCompressor::OpenPack(LPCSTR tgt_folder, int num)
{
CMemoryWriter W;
CInifile::Sect& S = config_ltx->r_section("header");
CInifile::SectCIt it = S.Data.begin();
CInifile::SectCIt it_e = S.Data.end();
auto it = S.Data.cbegin();
auto it_e = S.Data.cend();
string4096 buff;
xr_sprintf(buff, "[%s]", S.Name.c_str());
W.w_string(buff);
Expand Down Expand Up @@ -507,9 +507,9 @@ bool xrCompressor::IsFolderAccepted(CInifile& ltx, LPCSTR path, BOOL& recurse)
if (ltx.section_exist("exclude_folders"))
{
CInifile::Sect& ef_sect = ltx.r_section("exclude_folders");
for (CInifile::SectCIt ef_it = ef_sect.Data.begin(); ef_it != ef_sect.Data.end(); ef_it++)
for (auto ef_it = ef_sect.Data.cbegin(); ef_it != ef_sect.Data.cend(); ef_it++)
{
recurse = CInifile::IsBOOL(ef_it->second.c_str());
recurse = CInifile::isBool(ef_it->second.c_str());
if (recurse)
{
if (path == strstr(path, ef_it->first.c_str()))
Expand Down Expand Up @@ -539,9 +539,9 @@ void xrCompressor::ProcessLTX(CInifile& ltx)
{
CInifile::Sect& if_sect = ltx.r_section("include_folders");

for (CInifile::SectCIt if_it = if_sect.Data.begin(); if_it != if_sect.Data.end(); ++if_it)
for (auto if_it = if_sect.Data.cbegin(); if_it != if_sect.Data.cend(); ++if_it)
{
BOOL ifRecurse = CInifile::IsBOOL(if_it->second.c_str());
BOOL ifRecurse = CInifile::isBool(if_it->second.c_str());
u32 folder_mask = FS_ListFolders | (ifRecurse ? 0 : FS_RootOnly);

string_path path;
Expand Down Expand Up @@ -598,7 +598,7 @@ void xrCompressor::ProcessLTX(CInifile& ltx)
if (ltx.section_exist("include_files"))
{
CInifile::Sect& if_sect = ltx.r_section("include_files");
for (CInifile::SectCIt if_it = if_sect.Data.begin(); if_it != if_sect.Data.end(); ++if_it)
for (auto if_it = if_sect.Data.cbegin(); if_it != if_sect.Data.cend(); ++if_it)
{
files_list->push_back(xr_strdup(if_it->first.c_str()));
}
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/Animation/SkeletonMotions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void CPartition::load(IKinematics* V, LPCSTR model_name)
xr_sprintf(buff, sizeof(buff), "part_%d", i);

CInifile::Sect S = ini.r_section(buff);
CInifile::SectCIt it = S.Data.begin();
CInifile::SectCIt it_e = S.Data.end();
auto it = S.Data.cbegin();
auto it_e = S.Data.cend();
if (S.Data.size())
{
P[i].bones.clear_not_free();
Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,11 @@ void CLocatorAPI::_initialize(u32 flags, pcstr target_folder, pcstr fs_name)
u32 fl = 0;
_GetItem(temp, 0, b_v, _delimiter);

if (CInifile::IsBOOL(b_v))
if (CInifile::isBool(b_v))
fl |= FS_Path::flRecurse;

_GetItem(temp, 1, b_v, _delimiter);
if (CInifile::IsBOOL(b_v))
if (CInifile::isBool(b_v))
fl |= FS_Path::flNotif;

_GetItem(temp, 2, root, _delimiter);
Expand Down
3 changes: 1 addition & 2 deletions src/xrEngine/IGame_ObjectPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ void IGame_ObjectPool::prefetch()
// prefetch objects
strconcat(sizeof(section), section, "prefetch_objects_", g_pGamePersistent->m_game_params.m_game_type);
CInifile::Sect const& sect = pSettings->r_section(section);
for (CInifile::SectCIt I = sect.Data.begin(); I != sect.Data.end(); I++)
for (const auto& item : sect.Data)
{
const CInifile::Item& item = *I;
CLASS_ID CLS = pSettings->r_clsid(item.first.c_str(), "class");
p_count++;
IGameObject* pObject = smart_cast<IGameObject*>(NEW_INSTANCE(CLS));
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_efflensflare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void CLensFlareDescriptor::load(CInifile* pIni, LPCSTR sect)
AddFlare(r, o, p, name, S);
}
}
m_Flags.set(flGradient, CInifile::IsBOOL(pIni->r_string(sect, "gradient")));
m_Flags.set(flGradient, CInifile::isBool(pIni->r_string(sect, "gradient")));
if (m_Flags.is(flGradient))
{
LPCSTR S = pIni->r_string(sect, "gradient_shader");
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ActorHelmet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ bool CHelmet::install_upgrade_impl(LPCSTR section, bool test)
result |= process_if_exists(
section, "telepatic_protection", &CInifile::r_float, m_HitTypeProtection[ALife::eHitTypeTelepatic], test);
result |= process_if_exists(section, "chemical_burn_protection", &CInifile::r_float,
m_HitTypeProtection[ALife::eHitTypeChemicalBurn], test);
m_HitTypeProtection[ALife::eHitTypeChemicalBurn], test);
result |= process_if_exists(
section, "explosion_protection", &CInifile::r_float, m_HitTypeProtection[ALife::eHitTypeExplosion], test);
result |= process_if_exists(
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/BoneProtections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ void SBoneProtections::reload(const shared_str& bone_sect, IKinematics* kinemati
m_default.BonePassBullet = FALSE;

CInifile::Sect& protections = pSettings->r_section(bone_sect);
for (CInifile::SectCIt i = protections.Data.begin(); protections.Data.end() != i; ++i)
for (auto i = protections.Data.cbegin(); protections.Data.cend() != i; ++i)
{
string256 buffer;

BoneProtection BP;

BP.koeff = (float)atof(_GetItem(i->second.c_str(), 0, buffer));
BP.armor = (float)atof(_GetItem(i->second.c_str(), 1, buffer));
BP.BonePassBullet = (BOOL)(atof(_GetItem(i->second.c_str(), 2, buffer)) > 0.5f);
BP.BonePassBullet = (bool)(atof(_GetItem(i->second.c_str(), 2, buffer)) > 0.5f);

if (!xr_strcmp(i->first.c_str(), "default"))
{
Expand All @@ -78,7 +78,7 @@ void SBoneProtections::add(const shared_str& bone_sect, IKinematics* kinematics)
m_fHitFracNpc += READ_IF_EXISTS(pSettings, r_float, bone_sect.c_str(), "hit_fraction_npc", 0.0f);

CInifile::Sect& protections = pSettings->r_section(bone_sect);
for (CInifile::SectCIt i = protections.Data.begin(); protections.Data.end() != i; ++i)
for (auto i = protections.Data.cbegin(); protections.Data.cend() != i; ++i)
{
if (!xr_strcmp(i->first.c_str(), "hit_fraction"))
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ void CCar::Init()
if (ini->section_exist("damage_items"))
{
CInifile::Sect& data = ini->r_section("damage_items");
for (CInifile::SectCIt I = data.Data.begin(); I != data.Data.end(); I++)
for (auto I = data.Data.cbegin(); I != data.Data.cend(); I++)
{
const CInifile::Item& item = *I;
u16 index = pKinematics->LL_BoneID(*item.first);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/CustomOutfit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ bool CCustomOutfit::install_upgrade_impl(LPCSTR section, bool test)
result |= process_if_exists(
section, "telepatic_protection", &CInifile::r_float, m_HitTypeProtection[ALife::eHitTypeTelepatic], test);
result |= process_if_exists(section, "chemical_burn_protection", &CInifile::r_float,
m_HitTypeProtection[ALife::eHitTypeChemicalBurn], test);
m_HitTypeProtection[ALife::eHitTypeChemicalBurn], test);
result |= process_if_exists(
section, "explosion_protection", &CInifile::r_float, m_HitTypeProtection[ALife::eHitTypeExplosion], test);
result |= process_if_exists(
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ bool CLevel::Load_GameSpecific_After()
{
CInifile::Sect& S = pSettings->r_section("sounds_random");
Sounds_Random.reserve(S.Data.size());
for (CInifile::SectCIt I = S.Data.begin(); S.Data.end() != I; ++I)
for (auto I = S.Data.cbegin(); S.Data.cend() != I; ++I)
{
Sounds_Random.push_back(ref_sound());
Sound->create(Sounds_Random.back(), *I->first, st_Effect, sg_SourceType);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/PHCollisionDamageReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void CPHCollisionDamageReceiver::Init()
if (ini->section_exist("collision_damage"))
{
CInifile::Sect& data = ini->r_section("collision_damage");
for (CInifile::SectCIt I = data.Data.begin(); I != data.Data.end(); I++)
for (auto I = data.Data.cbegin(); I != data.Data.cend(); I++)
{
const CInifile::Item& item = *I;
u16 index = K->LL_BoneID(*item.first);
Expand Down
25 changes: 12 additions & 13 deletions src/xrGame/PHDestroyable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ av_transition_factor =1 ; коэффициент передачи угл
CPHDestroyable::CPHDestroyable()
{
m_flags.flags = 0;
m_flags.set(fl_released, TRUE);
m_flags.set(fl_released, true);
m_depended_objects = 0;
}
/////////spawn object representing destroyed
Expand Down Expand Up @@ -145,7 +145,7 @@ void CPHDestroyable::Destroy(u16 source_id /*=u16(-1)*/, LPCSTR section /*="ph_s
obj->processing_activate();
if (source_id == obj->ID())
{
m_flags.set(fl_released, FALSE);
m_flags.set(fl_released, false);
}
xr_vector<shared_str>::iterator i = m_destroyed_obj_visual_names.begin(), e = m_destroyed_obj_visual_names.end();

Expand All @@ -155,44 +155,43 @@ void CPHDestroyable::Destroy(u16 source_id /*=u16(-1)*/, LPCSTR section /*="ph_s
GenSpawnReplace(source_id, section, *i);
};
///////////////////////////////////////////////////////////////////////////
m_flags.set(fl_destroyed, TRUE);
return;
m_flags.set(fl_destroyed, true);
}

void CPHDestroyable::Load(CInifile* ini, LPCSTR section)
{
m_flags.set(fl_destroyable, FALSE);
m_flags.set(fl_destroyable, false);
if (ini->line_exist(section, "destroyed_vis_name"))
{
m_flags.set(fl_destroyable, TRUE);
m_flags.set(fl_destroyable, true);
m_destroyed_obj_visual_names.push_back(ini->r_string(section, "destroyed_vis_name"));
}
else
{
CInifile::Sect& data = ini->r_section(section);
if (data.Data.size() > 0)
m_flags.set(fl_destroyable, TRUE);
for (CInifile::SectCIt I = data.Data.begin(); I != data.Data.end(); I++)
m_flags.set(fl_destroyable, true);
for (auto I = data.Data.cbegin(); I != data.Data.cend(); I++)
if (I->first.size())
m_destroyed_obj_visual_names.push_back(I->first);
}
}
void CPHDestroyable::Load(LPCSTR section)
{
m_flags.set(fl_destroyable, FALSE);
m_flags.set(fl_destroyable, false);

if (pSettings->line_exist(section, "destroyed_vis_name"))
{
m_flags.set(fl_destroyable, TRUE);
m_flags.set(fl_destroyable, true);
m_destroyed_obj_visual_names.push_back(pSettings->r_string(section, "destroyed_vis_name"));
}
}

void CPHDestroyable::Init() { m_depended_objects = 0; }
void CPHDestroyable::RespawnInit()
{
m_flags.set(fl_destroyed, FALSE);
m_flags.set(fl_released, TRUE);
m_flags.set(fl_destroyed, false);
m_flags.set(fl_released, true);
m_destroyed_obj_visual_names.clear();
m_notificate_objects.clear();
m_depended_objects = 0;
Expand Down Expand Up @@ -349,7 +348,7 @@ void CPHDestroyable::NotificateDestroy(CPHDestroyableNotificate* dn)
NotificatePart(*i);
PhysicallyRemoveSelf();
m_notificate_objects.clear();
m_flags.set(fl_released, TRUE);
m_flags.set(fl_released, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ParticlesPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void CParticlesPlayer::LoadParticles(IKinematics* K)
{
bone_mask = 0;
CInifile::Sect& data = ini->r_section("particle_bones");
for (CInifile::SectCIt I = data.Data.begin(); I != data.Data.end(); I++)
for (auto I = data.Data.cbegin(); I != data.Data.cend(); I++)
{
const CInifile::Item& item = *I;
u16 index = K->LL_BoneID(*item.first);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ShootingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class CShootingObject : public IAnticheatDumpable
Fvector vLoadedShellPoint;
float m_fPredBulletTime;
float m_fTimeToAim;
BOOL m_bUseAimBullet;
bool m_bUseAimBullet;

protected:
//имя пратиклов для огня
Expand Down
Loading

0 comments on commit fc16e3d

Please sign in to comment.