forked from DaaGvda/xray-oxygen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlobalFeelTouch.cpp
41 lines (37 loc) · 1.08 KB
/
GlobalFeelTouch.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "stdafx.h"
#include "GlobalFeelTouch.hpp"
#include <functional>
struct delete_predicate_by_time
{
bool operator () (Feel::Touch::DenyTouch const & left, DWORD const expire_time) const
{
if (left.Expire <= expire_time)
return true;
return false;
};
};
struct objects_ptrs_equal
{
bool operator() (Feel::Touch::DenyTouch const & left, CObject const * const right) const
{
if (left.O == right)
return true;
return false;
}
};
void GlobalFeelTouch::feel_touch_update(Fvector& P, float R) noexcept
{
//we ignore P and R arguments, we need just delete vealed denied objects...
auto new_end = std::remove_if(feel_touch_disable.begin(), feel_touch_disable.end(),
std::bind(delete_predicate_by_time(), std::placeholders::_1, Device.dwTimeGlobal));
feel_touch_disable.erase(new_end, feel_touch_disable.end());
}
bool GlobalFeelTouch::is_object_denied(CObject const * O) noexcept
{
if (std::find_if(feel_touch_disable.begin(), feel_touch_disable.end(),
std::bind(objects_ptrs_equal(), std::placeholders::_1, O)) == feel_touch_disable.end())
{
return false;
}
return true;
}