Batch #3314 by eAthena: 0 byte-identical, 6 confirmed by peer review. - fn_06506 CPrivateAirplaneMgr::GetNeedItem: logic confirmed by peer review - fn_06507 CPrivateAirplaneMgr::IsEndableMap: logic confirmed by peer review - fn_06508 CPrivateAirplaneMgr::IsStartableMap: logic confirmed by peer review - fn_06511 CPrivateAirplaneMgr::L_InsertNeedItem: logic confirmed by peer review - fn_06512 CPrivateAirplaneMgr::L_InsertEndableMap: logic confirmed by peer review - fn_06513 CPrivateAirplaneMgr::L_InsertStartableMap: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, meitogi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
92 lines
2.4 KiB
C++
92 lines
2.4 KiB
C++
#include "Contents/PrivateAirplaneMgr.h"
|
|
|
|
extern "C" {
|
|
#include <lua.h>
|
|
}
|
|
|
|
// GLOBAL: gl_24636
|
|
CPrivateAirplaneMgr* g_privateAirplaneItems;
|
|
|
|
// OFFSET: 0x006D0620
|
|
// FUNCTION: fn_06505
|
|
void CPrivateAirplaneMgr::Destroy() {
|
|
if (g_privateAirplaneItems != nullptr) {
|
|
delete g_privateAirplaneItems;
|
|
g_privateAirplaneItems = nullptr;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x006D0640
|
|
// FUNCTION: fn_06506
|
|
int CPrivateAirplaneMgr::GetNeedItem(int index) {
|
|
auto it = this->m_needItems.begin();
|
|
for (int count = 0; count < index; ++count) {
|
|
if (it == this->m_needItems.end()) {
|
|
break;
|
|
}
|
|
++it;
|
|
}
|
|
|
|
return *it;
|
|
}
|
|
|
|
// OFFSET: 0x006D0860
|
|
// FUNCTION: fn_06507
|
|
bool CPrivateAirplaneMgr::IsEndableMap(std::string map) {
|
|
return this->m_endableMaps.find(map) != this->m_endableMaps.end();
|
|
}
|
|
|
|
// OFFSET: 0x006D0950
|
|
// FUNCTION: fn_06508
|
|
bool CPrivateAirplaneMgr::IsStartableMap(std::string map) {
|
|
return this->m_startableMaps.find(map) != this->m_startableMaps.end();
|
|
}
|
|
|
|
// OFFSET: 0x006D0EF0
|
|
// FUNCTION: fn_06511
|
|
int CPrivateAirplaneMgr::L_InsertNeedItem(lua_State* state) {
|
|
if (!lua_isstring(state, -1)) {
|
|
lua_pushboolean(state, 0);
|
|
lua_pushstring(state, "[InsertNeedItem] argument 1st is must string");
|
|
} else {
|
|
const std::string name = lua_tostring(state, -1);
|
|
const int item = static_cast<int>(lua_tonumber(state, -2));
|
|
g_privateAirplaneItems->m_needItems.insert(item);
|
|
lua_pushboolean(state, 1);
|
|
lua_pushstring(state, "good");
|
|
}
|
|
|
|
return 2;
|
|
}
|
|
|
|
// OFFSET: 0x006D10E0
|
|
// FUNCTION: fn_06512
|
|
int CPrivateAirplaneMgr::L_InsertEndableMap(lua_State* state) {
|
|
if (!lua_isstring(state, -1)) {
|
|
lua_pushboolean(state, 0);
|
|
lua_pushstring(state, "[InsertEndableMap] argument 1st is must string");
|
|
} else {
|
|
const std::string map = lua_tostring(state, -1) + std::string(".gat");
|
|
g_privateAirplaneItems->InsertEndableMap(map);
|
|
lua_pushboolean(state, 1);
|
|
lua_pushstring(state, "good");
|
|
}
|
|
|
|
return 2;
|
|
}
|
|
|
|
// OFFSET: 0x006D1260
|
|
// FUNCTION: fn_06513
|
|
int CPrivateAirplaneMgr::L_InsertStartableMap(lua_State* state) {
|
|
if (!lua_isstring(state, -1)) {
|
|
lua_pushboolean(state, 0);
|
|
lua_pushstring(state, "[InsertStartableMap] argument 1st is must string");
|
|
} else {
|
|
const std::string map = lua_tostring(state, -1) + std::string(".gat");
|
|
g_privateAirplaneItems->InsertStartableMap(map);
|
|
lua_pushboolean(state, 1);
|
|
lua_pushstring(state, "good");
|
|
}
|
|
|
|
return 2;
|
|
}
|