2020-03-02 17:11:57 +08:00

49 lines
1.1 KiB
C++
Executable File

#include "precompile.h"
#include "global.h"
int g_hint_flags = 0;
bool Global::IsVirtualItem(int itemid)
{
return (itemid == VID_Item_Exp ||
itemid == VID_Item_Gold ||
itemid == VID_Soul_Stone ||
itemid == VID_Pickaxe);
}
time_t Global::BetweenDays(time_t time1, time_t time2)
{
return (time1 + g_time_zone*3600)/3600/24 - (time2 + g_time_zone*3600)/3600/24;
}
time_t Global::GetDaySeconds(time_t time, int incdays)
{
return time_t((time + g_time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * g_time_zone;
}
bool Global::IsTimeToReset(int time)
{
return BetweenDays(g_nowtime - 60 * SYS_RESET_TIME, time - 60 * SYS_RESET_TIME) > 0;
}
int Global::g_nowtime = time(nullptr);
int Global::g_time_zone = 8;
bool Global::g_shutdown = false;
ColliderComponent* Global::last_collider = nullptr;
bool IsValidSlotId(int slot_id)
{
return slot_id >= 0 && slot_id < IS_END;
}
bool IsValidBuffEffect(int buff_effect)
{
return buff_effect > kBET_Begin && buff_effect < kBET_End;
}
bool IsValidHumanAttr(int attr_type)
{
return attr_type > kHAT_Begin && attr_type < kHAT_End;
}