Skip to content

Commit

Permalink
Fix various minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Zegeri committed Sep 16, 2018
1 parent a902b75 commit 2e5ee9c
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ typedef unsigned char* LPBYTE;
typedef unsigned int UINT;
typedef int INT;
typedef unsigned long ULONG;
typedef unsigned long& ULONG_PTR;
typedef unsigned long* ULONG_PTR;
typedef long long int LARGE_INTEGER;
typedef unsigned long long int ULARGE_INTEGER;

Expand Down Expand Up @@ -208,7 +208,7 @@ typedef unsigned int UINT_PTR;
typedef long LONG_PTR;
#endif // XR_X64

typedef int HANDLE;
typedef void* HANDLE;
typedef void* HMODULE;
typedef void* PVOID;
typedef void* LPVOID;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ bool CMainMenu::IsCDKeyIsValid()
for (int i = 0; i < 4; i++)
{
GetGameID(&GameID, i);
if (VerifyClientCheck(CDKey, unsigned short(GameID)) == 1)
if (VerifyClientCheck(CDKey, (unsigned short)(GameID)) == 1)
return true;
};
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/PHSkeleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void CPHSkeleton::RecursiveBonesCheck(u16 id)
Flags64 mask;
mask.assign(K->LL_GetBonesVisible());
///////////////////////////////////////////
if (mask.is(1ui64 << (u64)id) && !(BD.shape.flags.is(SBoneShape::sfRemoveAfterBreak)))
if (mask.is(u64(1) << (u64)id) && !(BD.shape.flags.is(SBoneShape::sfRemoveAfterBreak)))
{
removable = false;
return;
Expand Down
2 changes: 2 additions & 0 deletions src/xrGame/ai/monsters/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "debug_text_tree.h"
#endif

inline TTime current_time() { return Device.dwTimeGlobal; }

template <typename _Object>
class CState
{
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/ai/monsters/state_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ EMonsterState CStateAbstract::get_state_type()
TEMPLATE_SPECIALIZATION
void CStateAbstract::remove_links(IGameObject* object)
{
SubStates::iterator i = substates.begin();
SubStates::iterator e = substates.end();
auto i = substates.begin();
auto e = substates.end();
for (; i != e; ++i)
(*i).second->remove_links(object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "ai/weighted_random.h"

inline TTime current_time() { return Device.dwTimeGlobal; }
template <typename _Object>
class CStateMonsterAttackOnRun : public CState<_Object>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "state_custom_action.h"
#include "state_move_to_point.h"
#include "ai_monster_squad.h"

#define TEMPLATE_SPECIALIZATION \
template <typename _Object\
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/attachable_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void CAttachableItem::afterDetach()
object().processing_deactivate();
}

virtual bool CAttachableItem::use_parent_ai_locations() const
bool CAttachableItem::use_parent_ai_locations() const
{
return !enabled();
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/entity_alive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ ICollisionHitCallback* CEntityAlive::get_collision_hit_callback()
if (cs)
return cs->get_collision_hit_callback();
else
return false;
return nullptr;
}

void CEntityAlive::set_collision_hit_callback(ICollisionHitCallback* cc)
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/game_sv_mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct real_sender
P = Packet;
flags_to_send = flags;
}

void operator()(IClient* client)
{
xrClientData* tmp_client = static_cast<xrClientData*>(client);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/level_location_selector_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define CLevelLocationSelector CBaseLocationSelector<CLevelGraph, _VertexEvaluator, _vertex_id_type>

TEMPLATE_SPECIALIZATION
IC CLevelLocationSelector::CBaseLocationSelector(CRestrictedObject* object) : inherited(object, selector_manager) {}
IC CLevelLocationSelector::CBaseLocationSelector(CRestrictedObject* object) : inherited(object) {}
TEMPLATE_SPECIALIZATION
IC void CLevelLocationSelector::before_search(_vertex_id_type& vertex_id)
{
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/login_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void login_manager::save_password_to_registry(char const* password)
return;
}

key_t pass_key;
secure_messaging::key_t pass_key;
generate_key(pass_key_seed, pass_key);
u32 buffer_size = xr_strlen(password) + 1;
u8* buffer = static_cast<u8*>(_alloca(buffer_size));
Expand All @@ -370,7 +370,7 @@ char const* login_manager::get_password_from_registry()

if (pass_size)
{
key_t pass_key;
secure_messaging::key_t pass_key;
generate_key(pass_key_seed, pass_key);
decrypt(tmp_password_dest, pass_size, pass_key);
xr_strcpy(m_reg_password, (char*)tmp_password_dest);
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/memory_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ template <typename T>
void CMemoryManager::update(const xr_vector<T>& objects, bool add_enemies)
{
squad_mask_type mask = m_stalker ? m_stalker->agent_manager().member().mask(m_stalker) : 0;
xr_vector<T>::const_iterator I = objects.begin();
xr_vector<T>::const_iterator E = objects.end();
auto I = objects.cbegin();
auto E = objects.cend();
for (; I != E; ++I)
{
if (!(*I).m_enabled)
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/object_actions_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "object_handler.h"
#include "object_handler_space.h"

//////////////////////////////////////////////////////////////////////////
// CObjectActionBase
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/script_game_object_inventory_owner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ LPCSTR CScriptGameObject::aim_bone_id() const
if (!stalker)
{
GEnv.ScriptEngine->script_log(LuaMessageType::Error, "CAI_Stalker : cannot access class member aim_bone_id!");
return (false);
return nullptr;
}

return (stalker->aim_bone_id().c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/setup_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
template <typename _action_type, typename _object_type, typename _action_id_type>
class CSetupManager
{
private:
protected:
typedef std::pair<_action_id_type, _action_type*> setup_pair;
typedef xr_vector<setup_pair> setup_actions;

Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/smart_cover_description.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,20 @@ IC void delete_data(const CGraphAbstract<_data_type, _edge_weight_type, _vertex_

Graph& graph = const_cast<Graph&>(graph_);

typedef Graph::VERTICES Vertices;
typedef Graph::EDGES Edges;
using Vertices = typename Graph::VERTICES;
using Edges = typename Graph::EDGES;

Vertices& verts = graph.vertices();

for (auto vi = verts.begin(); vi != verts.end(); ++vi)
{
Graph::CVertex* vert = (*vi).second;
typename Graph::CVertex* vert = (*vi).second;
delete_data(vert->data());

Edges& edges = const_cast<Edges&>(vert->edges());
for (auto ei = edges.begin(); ei != edges.end(); ++ei)
{
Graph::CEdge& edge = (*ei);
typename Graph::CEdge& edge = (*ei);
delete_data(edge.data());
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/xrGame/state_arguments_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
namespace award_system
{
// definitions of static members of functions_cf

template<>
ge_function<float> functions_cf<float>::ge_function;
template<>
le_function<float> functions_cf<float>::le_function;

template<>
ge_function<u32> functions_cf<u32>::ge_function;
template<>
le_function<u32> functions_cf<u32>::le_function;

} // namespace award_system
6 changes: 3 additions & 3 deletions src/xrGame/ui/uiscriptwnd_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ struct CWrapperBase : public T, public luabind::wrap_base

virtual bool OnKeyboardAction(int dik, EUIMessages keyboard_action)
{
return call_member<bool>(this, "OnKeyboard", dik, keyboard_action);
return luabind::call_member<bool>(this, "OnKeyboard", dik, keyboard_action);
}
static bool OnKeyboard_static(inherited* ptr, int dik, EUIMessages keyboard_action)
{
return ptr->self_type::inherited::OnKeyboardAction(dik, keyboard_action);
}

virtual void Update() { call_member<void>(this, "Update"); }
virtual void Update() { luabind::call_member<void>(this, "Update"); }
static void Update_static(inherited* ptr) { ptr->self_type::inherited::Update(); }
virtual bool Dispatch(int cmd, int param) { return call_member<bool>(this, "Dispatch", cmd, param); }
virtual bool Dispatch(int cmd, int param) { return luabind::call_member<bool>(this, "Dispatch", cmd, param); }
static bool Dispatch_static(inherited* ptr, int cmd, int param)
{
return ptr->self_type::inherited::Dispatch(cmd, param);
Expand Down

0 comments on commit 2e5ee9c

Please sign in to comment.