Closed w4454962 closed 5 years ago
我查了一下问题,技能按钮的偏移在1.27里偏移了4字节
static bool ability_mouse_event(lua_State L, ability_mouse_message_t msg) { lua_getfield(L, LUA_REGISTRYINDEX, "_JASS_MESSAGE_HANDLE"); if (!lua_isfunction(L, -1)) { lua_pop(L, 1); return true; } lua_newtable(L); lua_pushstring(L, "mouse_ability"); lua_setfield(L, -2, "type"); auto button = msg->button; war3_searcher& s = get_war3_searcher(); if (s.get_version() >= version_127a) { button = (CCommandButton*)msg->unk0B; } if (msg && msg->button&& button->ability) { lua_pushinteger(L, msg->code); lua_setfield(L, -2, "code"); lua_pushinteger(L, button->ability->ability_id); lua_setfield(L, -2, "ability"); lua_pushinteger(L, button->ability->order_id); lua_setfield(L, -2, "order"); } lua_insert(L, -2); lua_pushvalue(L, -2); if (safe_call_not_sleep(L, 1, 1, true) != LUA_OK) { lua_pop(L, 1); return true; } int ok = lua_toboolean(L, -1); lua_pop(L, 1); lua_pop(L, 1); return !!ok; }
这是改正后的正常的代码。
PR please
什么鬼- -
请提供pull request
我查了一下问题,技能按钮的偏移在1.27里偏移了4字节
static bool ability_mouse_event(lua_State L, ability_mouse_message_t msg) { lua_getfield(L, LUA_REGISTRYINDEX, "_JASS_MESSAGE_HANDLE"); if (!lua_isfunction(L, -1)) { lua_pop(L, 1); return true; } lua_newtable(L); lua_pushstring(L, "mouse_ability"); lua_setfield(L, -2, "type"); auto button = msg->button; war3_searcher& s = get_war3_searcher(); if (s.get_version() >= version_127a) { button = (CCommandButton*)msg->unk0B; } if (msg && msg->button&& button->ability) { lua_pushinteger(L, msg->code); lua_setfield(L, -2, "code"); lua_pushinteger(L, button->ability->ability_id); lua_setfield(L, -2, "ability"); lua_pushinteger(L, button->ability->order_id); lua_setfield(L, -2, "order"); } lua_insert(L, -2); lua_pushvalue(L, -2); if (safe_call_not_sleep(L, 1, 1, true) != LUA_OK) { lua_pop(L, 1); return true; } int ok = lua_toboolean(L, -1); lua_pop(L, 1); lua_pop(L, 1); return !!ok; }
这是改正后的正常的代码。