Commit b7388787 authored by wind2009's avatar wind2009

Merge branch 'develop' into develop-8888

parents d57237d1 ea1d5b9f
#ifndef CORE_BUFFER_H
#define CORE_BUFFER_H
#include <cstdio>
#include <cstring>
#include <vector>
......@@ -21,7 +22,7 @@ inline void buffer_write_block(unsigned char*& p, const void* src, size_t size)
}
template<typename T>
inline void buffer_write(unsigned char*& p, T value) {
buffer_write_block(p, &value,sizeof(T));
buffer_write_block(p, &value, sizeof(T));
}
inline void vector_write_block(std::vector<unsigned char>& buffer, const void* src, size_t size) {
......@@ -34,4 +35,11 @@ inline void vector_write(std::vector<unsigned char>& buffer, T value) {
vector_write_block(buffer, &value, sizeof(T));
}
inline void vector_fread(std::vector<unsigned char>& buffer, FILE* fp) {
unsigned char temp[4096]{};
while (size_t len = std::fread(temp, 1, sizeof temp, fp))
vector_write_block(buffer, temp, len);
std::fclose(fp);
}
#endif // !CORE_BUFFER_H
......@@ -246,12 +246,12 @@ enum effect_flag2 : uint64 {
EFFECT_FLAG2_ACTIVATE_MONSTER_SZONE = 0x0400,
};
constexpr effect_flag operator|(effect_flag flag1, effect_flag flag2) {
return static_cast<effect_flag>(static_cast<uint32>(flag1) | static_cast<uint32>(flag2));
return static_cast<effect_flag>(static_cast<uint64>(flag1) | static_cast<uint64>(flag2));
}
constexpr uint32 INTERNAL_FLAGS = EFFECT_FLAG_INITIAL | EFFECT_FLAG_COPY | EFFECT_FLAG_FUNC_VALUE | EFFECT_FLAG_COUNT_LIMIT | EFFECT_FLAG_FIELD_ONLY | EFFECT_FLAG_ABSOLUTE_TARGET;
constexpr uint64 INTERNAL_FLAGS = EFFECT_FLAG_INITIAL | EFFECT_FLAG_COPY | EFFECT_FLAG_FUNC_VALUE | EFFECT_FLAG_COUNT_LIMIT | EFFECT_FLAG_FIELD_ONLY | EFFECT_FLAG_ABSOLUTE_TARGET;
//Category
enum effect_category :uint64 {
enum effect_category : uint64 {
CATEGORY_DESTROY = 0x1,
CATEGORY_RELEASE = 0x2,
CATEGORY_REMOVE = 0x4,
......
......@@ -2026,7 +2026,7 @@ int32 scriptlib::card_register_flag_effect(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
int32 code = (lua_tointeger(L, 2) & MAX_CARD_ID) | EFFECT_FLAG_EFFECT;
int32 reset = (int32)lua_tointeger(L, 3);
uint32 flag = (uint32)lua_tointeger(L, 4);
uint64 flag = lua_tointeger(L, 4);
int32 count = (int32)lua_tointeger(L, 5);
lua_Integer lab = 0;
int32 desc = 0;
......
......@@ -313,7 +313,7 @@ int32 scriptlib::duel_register_flag_effect(lua_State *L) {
return 0;
int32 code = (lua_tointeger(L, 2) & MAX_CARD_ID) | EFFECT_FLAG_EFFECT;
int32 reset = (int32)lua_tointeger(L, 3);
uint32 flag = (uint32)lua_tointeger(L, 4);
uint64 flag = lua_tointeger(L, 4);
int32 count = (int32)lua_tointeger(L, 5);
lua_Integer lab = 0;
if(lua_gettop(L) >= 6)
......
......@@ -250,8 +250,8 @@ int32 scriptlib::effect_set_property(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 v1 = (uint32)lua_tointeger(L, 2);
uint32 v2 = (uint32)lua_tointeger(L, 3);
uint64 v1 = lua_tointeger(L, 2);
uint64 v2 = lua_tointeger(L, 3);
peffect->flag[0] = (peffect->flag[0] & INTERNAL_FLAGS) | (v1 & ~INTERNAL_FLAGS);
peffect->flag[1] = v2;
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment