Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ bool ChatChannel::executeOnSpeakEvent(const Player& player, SpeakClasses& type,
tfs::lua::pushUserdata(L, &player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, type);
lua_pushinteger(L, type);
tfs::lua::pushString(L, message);

bool result = false;
Expand Down
8 changes: 4 additions & 4 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@ void ValueCallback::getMinMaxValues(Player* player, CombatDamage& damage) const
switch (type) {
case COMBAT_FORMULA_LEVELMAGIC: {
// onGetPlayerMinMaxValues(player, level, maglevel)
lua_pushnumber(L, player->getLevel());
lua_pushnumber(L, player->getMagicLevel() + player->getSpecialMagicLevel(damage.primary.type));
lua_pushinteger(L, player->getLevel());
lua_pushinteger(L, player->getMagicLevel() + player->getSpecialMagicLevel(damage.primary.type));
parameters += 2;
break;
}
Expand All @@ -1105,8 +1105,8 @@ void ValueCallback::getMinMaxValues(Player* player, CombatDamage& damage) const
damage.secondary.value = weapon->getElementDamage(player, nullptr, tool);
}

lua_pushnumber(L, player->getWeaponSkill(item ? item : tool));
lua_pushnumber(L, attackValue);
lua_pushinteger(L, player->getWeaponSkill(item ? item : tool));
lua_pushinteger(L, attackValue);
lua_pushnumber(L, player->getAttackFactor());
parameters += 3;
break;
Expand Down
16 changes: 8 additions & 8 deletions src/creatureevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ bool CreatureEvent::executeOnThink(Creature* creature, uint32_t interval)
scriptInterface->pushFunction(scriptId);
tfs::lua::pushUserdata(L, creature);
tfs::lua::setCreatureMetatable(L, -1, creature);
lua_pushnumber(L, interval);
lua_pushinteger(L, interval);

return scriptInterface->callFunction(2);
}
Expand Down Expand Up @@ -401,9 +401,9 @@ bool CreatureEvent::executeAdvance(Player* player, skills_t skill, uint32_t oldL
scriptInterface->pushFunction(scriptId);
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");
lua_pushnumber(L, static_cast<uint32_t>(skill));
lua_pushnumber(L, oldLevel);
lua_pushnumber(L, newLevel);
lua_pushinteger(L, static_cast<uint32_t>(skill));
lua_pushinteger(L, oldLevel);
lua_pushinteger(L, newLevel);

return scriptInterface->callFunction(4);
}
Expand Down Expand Up @@ -446,9 +446,9 @@ void CreatureEvent::executeModalWindow(Player* player, uint32_t modalWindowId, u
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, modalWindowId);
lua_pushnumber(L, buttonId);
lua_pushnumber(L, choiceId);
lua_pushinteger(L, modalWindowId);
lua_pushinteger(L, buttonId);
lua_pushinteger(L, choiceId);

scriptInterface->callVoidFunction(4);
}
Expand Down Expand Up @@ -590,7 +590,7 @@ void CreatureEvent::executeExtendedOpcode(Player* player, uint8_t opcode, const
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, opcode);
lua_pushinteger(L, opcode);
tfs::lua::pushString(L, buffer);

scriptInterface->callVoidFunction(3);
Expand Down
50 changes: 25 additions & 25 deletions src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void Events::eventCreatureOnHear(Creature* creature, Creature* speaker, const st
tfs::lua::setCreatureMetatable(L, -1, speaker);

tfs::lua::pushString(L, words);
lua_pushnumber(L, type);
lua_pushinteger(L, type);

scriptInterface.callVoidFunction(4);
}
Expand All @@ -332,8 +332,8 @@ void Events::eventCreatureOnChangeZone(Creature* creature, ZoneType_t fromZone,
tfs::lua::pushUserdata(L, creature);
tfs::lua::setCreatureMetatable(L, -1, creature);

lua_pushnumber(L, fromZone);
lua_pushnumber(L, toZone);
lua_pushinteger(L, fromZone);
lua_pushinteger(L, toZone);

scriptInterface.callVoidFunction(3);
}
Expand All @@ -360,16 +360,16 @@ void Events::eventCreatureOnUpdateStorage(Creature* creature, uint32_t key, std:
tfs::lua::pushUserdata(L, creature);
tfs::lua::setMetatable(L, -1, "Creature");

lua_pushnumber(L, key);
lua_pushinteger(L, key);

if (value) {
lua_pushnumber(L, value.value());
lua_pushinteger(L, value.value());
} else {
lua_pushnil(L);
}

if (oldValue) {
lua_pushnumber(L, oldValue.value());
lua_pushinteger(L, oldValue.value());
} else {
lua_pushnil(L);
}
Expand Down Expand Up @@ -560,7 +560,7 @@ void Events::eventPartyOnShareExperience(Party* party, uint64_t& exp)
tfs::lua::pushUserdata(L, party);
tfs::lua::setMetatable(L, -1, "Party");

lua_pushnumber(L, exp);
lua_pushinteger(L, exp);

if (tfs::lua::protectedCall(L, 2, 1) != 0) {
reportErrorFunc(L, tfs::lua::popString(L));
Expand Down Expand Up @@ -632,7 +632,7 @@ void Events::eventPlayerOnLook(Player* player, const Position& position, Thing*
}

tfs::lua::pushPosition(L, position, stackpos);
lua_pushnumber(L, lookDistance);
lua_pushinteger(L, lookDistance);

scriptInterface.callVoidFunction(4);
}
Expand Down Expand Up @@ -662,7 +662,7 @@ void Events::eventPlayerOnLookInBattleList(Player* player, Creature* creature, i
tfs::lua::pushUserdata(L, creature);
tfs::lua::setCreatureMetatable(L, -1, creature);

lua_pushnumber(L, lookDistance);
lua_pushinteger(L, lookDistance);

scriptInterface.callVoidFunction(3);
}
Expand Down Expand Up @@ -694,7 +694,7 @@ void Events::eventPlayerOnLookInTrade(Player* player, Player* partner, Item* ite
tfs::lua::pushUserdata(L, item);
tfs::lua::setItemMetatable(L, -1, item);

lua_pushnumber(L, lookDistance);
lua_pushinteger(L, lookDistance);

scriptInterface.callVoidFunction(4);
}
Expand Down Expand Up @@ -723,7 +723,7 @@ bool Events::eventPlayerOnLookInShop(Player* player, const ItemType* itemType, u
tfs::lua::pushUserdata(L, itemType);
tfs::lua::setMetatable(L, -1, "ItemType");

lua_pushnumber(L, count);
lua_pushinteger(L, count);

return scriptInterface.callFunction(3);
}
Expand Down Expand Up @@ -781,7 +781,7 @@ ReturnValue Events::eventPlayerOnMoveItem(Player* player, Item* item, uint16_t c
tfs::lua::pushUserdata(L, item);
tfs::lua::setItemMetatable(L, -1, item);

lua_pushnumber(L, count);
lua_pushinteger(L, count);
tfs::lua::pushPosition(L, fromPosition);
tfs::lua::pushPosition(L, toPosition);

Expand Down Expand Up @@ -827,7 +827,7 @@ void Events::eventPlayerOnItemMoved(Player* player, Item* item, uint16_t count,
tfs::lua::pushUserdata(L, item);
tfs::lua::setItemMetatable(L, -1, item);

lua_pushnumber(L, count);
lua_pushinteger(L, count);
tfs::lua::pushPosition(L, fromPosition);
tfs::lua::pushPosition(L, toPosition);

Expand Down Expand Up @@ -894,8 +894,8 @@ void Events::eventPlayerOnReportRuleViolation(Player* player, const std::string&

tfs::lua::pushString(L, targetName);

lua_pushnumber(L, reportType);
lua_pushnumber(L, reportReason);
lua_pushinteger(L, reportType);
lua_pushinteger(L, reportReason);

tfs::lua::pushString(L, comment);
tfs::lua::pushString(L, translation);
Expand Down Expand Up @@ -927,7 +927,7 @@ bool Events::eventPlayerOnReportBug(Player* player, const std::string& message,

tfs::lua::pushString(L, message);
tfs::lua::pushPosition(L, position);
lua_pushnumber(L, category);
lua_pushinteger(L, category);

return scriptInterface.callFunction(4);
}
Expand Down Expand Up @@ -980,7 +980,7 @@ bool Events::eventPlayerOnTurn(Player* player, Direction direction)
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, direction);
lua_pushinteger(L, direction);

return scriptInterface.callFunction(2);
}
Expand Down Expand Up @@ -1138,7 +1138,7 @@ void Events::eventPlayerOnPodiumEdit(Player* player, Item* item, const Outfit_t&

tfs::lua::pushOutfit(L, outfit);

lua_pushnumber(L, direction);
lua_pushinteger(L, direction);
lua_pushboolean(L, podiumVisible);

scriptInterface.callFunction(5);
Expand Down Expand Up @@ -1173,8 +1173,8 @@ void Events::eventPlayerOnGainExperience(Player* player, Creature* source, uint6
lua_pushnil(L);
}

lua_pushnumber(L, exp);
lua_pushnumber(L, rawExp);
lua_pushinteger(L, exp);
lua_pushinteger(L, rawExp);
tfs::lua::pushBoolean(L, sendText);

if (tfs::lua::protectedCall(L, 5, 1) != 0) {
Expand Down Expand Up @@ -1208,7 +1208,7 @@ void Events::eventPlayerOnLoseExperience(Player* player, uint64_t& exp)
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, exp);
lua_pushinteger(L, exp);

if (tfs::lua::protectedCall(L, 2, 1) != 0) {
reportErrorFunc(L, tfs::lua::popString(L));
Expand Down Expand Up @@ -1241,8 +1241,8 @@ void Events::eventPlayerOnGainSkillTries(Player* player, skills_t skill, uint64_
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, skill);
lua_pushnumber(L, tries);
lua_pushinteger(L, skill);
lua_pushinteger(L, tries);

if (tfs::lua::protectedCall(L, 3, 1) != 0) {
reportErrorFunc(L, tfs::lua::popString(L));
Expand Down Expand Up @@ -1305,7 +1305,7 @@ void Events::eventPlayerOnInventoryUpdate(Player* player, Item* item, slots_t sl
tfs::lua::pushUserdata(L, item);
tfs::lua::setItemMetatable(L, -1, item);

lua_pushnumber(L, slot);
lua_pushinteger(L, slot);
tfs::lua::pushBoolean(L, equip);

scriptInterface.callVoidFunction(4);
Expand All @@ -1332,7 +1332,7 @@ void Events::eventPlayerOnNetworkMessage(Player* player, uint8_t recvByte, Netwo
tfs::lua::pushUserdata(L, player);
tfs::lua::setMetatable(L, -1, "Player");

lua_pushnumber(L, recvByte);
lua_pushinteger(L, recvByte);

tfs::lua::pushUserdata(L, msg);
tfs::lua::setMetatable(L, -1, "NetworkMessage");
Expand Down
6 changes: 3 additions & 3 deletions src/globalevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ bool GlobalEvent::executeRecord(uint32_t current, uint32_t old)
lua_State* L = scriptInterface->getLuaState();
scriptInterface->pushFunction(scriptId);

lua_pushnumber(L, current);
lua_pushnumber(L, old);
lua_pushinteger(L, current);
lua_pushinteger(L, old);
return scriptInterface->callFunction(2);
}

Expand All @@ -359,7 +359,7 @@ bool GlobalEvent::executeEvent() const

int32_t params = 0;
if (eventType == GLOBALEVENT_NONE || eventType == GLOBALEVENT_TIMER) {
lua_pushnumber(L, interval);
lua_pushinteger(L, interval);
params = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class ItemAttributes

void operator()(bool v) const { tfs::lua::pushBoolean(L, v); }

void operator()(const int64_t& v) const { lua_pushnumber(L, v); }
void operator()(const int64_t& v) const { lua_pushinteger(L, v); }

void operator()(const double& v) const { lua_pushnumber(L, v); }
};
Expand Down
Loading