Merge branch 'develop', read more

* moved network_api.*pp
* Added copyright notices to scripts
* Changed SQL table names (including hardcoded usage)
* Added monster tables to the database
* Made updates.sql (unneeded, and deleted)
* Added ForEachMonster() to the room API (incomplete)
* Created class MonsterData (incomplete)
* Created class MonsterManager (incomplete)
* Created MonsterManager API (incomplete)
This commit is contained in:
2015-07-07 12:52:46 +10:00
24 changed files with 318 additions and 93 deletions
+26
View File
@@ -1,3 +1,29 @@
--[[
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
--]]
--DOCS: a placeholder door utility
local doorUtility = {}
roomAPI = require("room")
+26
View File
@@ -1,3 +1,29 @@
--[[
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
--]]
--DOCS: a placeholder map generator
local regionAPI = require("region")
local mapMaker = {}
+24
View File
@@ -1,3 +1,27 @@
--[[
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
--]]
local region = require("region")
local mapSaver = {}
+27 -2
View File
@@ -1,3 +1,29 @@
--[[
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
--]]
--DOCS: This script is run by the server on startup
print("Lua script check")
--requirements
@@ -27,10 +53,9 @@ end)
--NOTE: room 0 is the first that the client asks for, therefore it must exist
local overworld, uidOne = roomManagerAPI.CreateRoom("overworld", "overworld.bmp")
roomAPI.Initialize(overworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugIsland, mapSaver.Save)
local underworld, uidTwo = roomManagerAPI.CreateRoom("underworld", "overworld.bmp")
roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrassland, mapSaver.Save)
--call the monstrosity
doorUtility.createDoorPair("pair 1", overworld, -64, -64, underworld, 64, 64)
print("Finished the lua script")
+60 -11
View File
@@ -1,6 +1,26 @@
--TODO: (3) An archive table of all dead characters
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
CREATE TABLE IF NOT EXISTS Accounts (
CREATE TABLE IF NOT EXISTS UserAccounts (
uid INTEGER PRIMARY KEY AUTOINCREMENT,
username varchar(100) UNIQUE, --TODO: (3) Swap username for email address
@@ -15,7 +35,7 @@ CREATE TABLE IF NOT EXISTS Accounts (
admin BIT DEFAULT 0
);
CREATE TABLE IF NOT EXISTS Characters (
CREATE TABLE IF NOT EXISTS LiveCharacters (
uid INTEGER PRIMARY KEY AUTOINCREMENT,
--metadata
@@ -31,16 +51,45 @@ CREATE TABLE IF NOT EXISTS Characters (
boundsX INTEGER DEFAULT 0,
boundsY INTEGER DEFAULT 0,
boundsW INTEGER DEFAULT 0,
boundsH INTEGER DEFAULT 0,
boundsH INTEGER DEFAULT 0
);
--statistics
baseStats INTEGER REFERENCES StatisticSets(uid),
CREATE TABLE IF NOT EXISTS DeadCharacters (
uid INTEGER PRIMARY KEY,
--equipment
weapon INTEGER REFERENCES WornEquipment(uid),
helmet INTEGER REFERENCES WornEquipment(uid),
armour INTEGER REFERENCES WornEquipment(uid)
--etc.
--metadata
owner INTEGER REFERENCES Accounts(uid),
handle varchar(100),
avatar varchar(100),
birth timestamp NOT NULL
);
CREATE TABLE IF NOT EXISTS LiveMonsters (
uid INTEGER PRIMARY KEY AUTOINCREMENT,
--metadata
handle varchar(100) UNIQUE,
avatar varchar(100),
--actions
-- script
--physically exists in the world
roomIndex INTEGER DEFAULT 0,
originX INTEGER DEFAULT 0,
originY INTEGER DEFAULT 0,
boundsX INTEGER DEFAULT 0,
boundsY INTEGER DEFAULT 0,
boundsW INTEGER DEFAULT 0,
boundsH INTEGER DEFAULT 0
);
CREATE TABLE IF NOT EXISTS DeadMonsters (
uid INTEGER PRIMARY KEY,
--metadata
handle varchar(100) UNIQUE,
avatar varchar(100)
);
-------------------------
+5 -5
View File
@@ -27,7 +27,7 @@
//Define the queries
//-------------------------
static const char* CREATE_USER_ACCOUNT = "INSERT INTO Accounts (username) VALUES (?);";
static const char* CREATE_USER_ACCOUNT = "INSERT INTO UserAccounts (username) VALUES (?);";
static const char* LOAD_USER_ACCOUNT = "SELECT "
"uid, "
@@ -35,18 +35,18 @@ static const char* LOAD_USER_ACCOUNT = "SELECT "
"whitelisted, "
"mod, "
"admin "
" FROM Accounts WHERE username = ?;";
" FROM UserAccounts WHERE username = ?;";
static const char* SAVE_USER_ACCOUNT = "UPDATE OR FAIL Accounts SET "
static const char* SAVE_USER_ACCOUNT = "UPDATE OR FAIL UserAccounts SET "
"blacklisted = ?2, "
"whitelisted = ?3, "
"mod = ?4, "
"admin = ?5 "
"WHERE uid = ?1;";
static const char* DELETE_USER_ACCOUNT = "DELETE FROM Accounts WHERE uid = ?;";
static const char* DELETE_USER_ACCOUNT = "DELETE FROM UserAccounts WHERE uid = ?;";
static const char* COUNT_USER_ACCOUNT_RECORDS = "SELECT COUNT(*) FROM Accounts;";
static const char* COUNT_USER_ACCOUNT_RECORDS = "SELECT COUNT(*) FROM UserAccounts;";
//-------------------------
//Define the public methods
+5 -5
View File
@@ -36,7 +36,7 @@
//NOTE: Programmer set variables are NOT zero-indexed
//NOTE: SQLite3 returned variables (i.e. loading) ARE zero-indexed
static const char* CREATE_CHARACTER = "INSERT INTO Characters ("
static const char* CREATE_CHARACTER = "INSERT INTO LiveCharacters ("
"owner, "
"handle, "
"avatar, "
@@ -58,9 +58,9 @@ static const char* LOAD_CHARACTER = "SELECT "
"boundsY, "
"boundsW, "
"boundsH "
"FROM Characters WHERE handle = ?;";
"FROM LiveCharacters WHERE handle = ?;";
static const char* SAVE_CHARACTER = "UPDATE OR FAIL Characters SET "
static const char* SAVE_CHARACTER = "UPDATE OR FAIL LiveCharacters SET "
"roomIndex = ?2, "
"originX = ?3, "
"originY = ?4, "
@@ -70,9 +70,9 @@ static const char* SAVE_CHARACTER = "UPDATE OR FAIL Characters SET "
"boundsH = ?8 "
"WHERE uid = ?1;";
static const char* DELETE_CHARACTER = "DELETE FROM Characters WHERE uid = ?;";
static const char* DELETE_CHARACTER = "DELETE FROM LiveCharacters WHERE uid = ?;";
static const char* COUNT_CHARACTER_RECORDS = "SELECT COUNT(*) FROM Characters;";
static const char* COUNT_CHARACTER_RECORDS = "SELECT COUNT(*) FROM LiveCharacters;";
//-------------------------
//Define the methods
+1 -1
View File
@@ -46,7 +46,7 @@ public:
const char* GetType() const;
protected:
Entity(const char*);
Entity(const char* type);
virtual ~Entity() = default;
int roomIndex = -1;
+4 -4
View File
@@ -41,8 +41,8 @@
#include "character_manager_api.hpp"
#include "region_api.hpp"
#include "region_pager_api.hpp"
#include "monster_api.hpp"
#include "monster_manager_api.hpp"
//#include "monster_api.hpp"
//#include "monster_manager_api.hpp"
#include "network_api.hpp"
#include "room_api.hpp"
#include "room_manager_api.hpp"
@@ -70,8 +70,8 @@ static const luaL_Reg preloadedlibs[] = {
{TORTUGA_ENTITY_API, openEntityAPI}, //required by derived classes
{TORTUGA_CHARACTER_API, openCharacterAPI},
{TORTUGA_CHARACTER_MANAGER_API, openCharacterManagerAPI},
{TORTUGA_MONSTER_API, openMonsterAPI},
{TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI},
// {TORTUGA_MONSTER_API, openMonsterAPI},
// {TORTUGA_MONSTER_MANAGER_API, openMonsterManagerAPI},
{TORTUGA_NETWORK_API, openNetworkAPI},
{TORTUGA_REGION_API, openRegionAPI},
{TORTUGA_REGION_PAGER_API, openRegionPagerAPI},
+2 -2
View File
@@ -1,5 +1,5 @@
#include directories
INCLUDES+=SDL . accounts characters clients entities monsters rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
INCLUDES+=SDL . accounts characters clients entities rooms server_utilities triggers ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
#libraries
#the order of the $(LIBS) is important, at least for MinGW
@@ -33,7 +33,7 @@ all: $(OBJ) $(OUT)
$(MAKE) -C characters
$(MAKE) -C clients
$(MAKE) -C entities
$(MAKE) -C monsters
# $(MAKE) -C monsters
$(MAKE) -C rooms
$(MAKE) -C server_utilities
$(MAKE) -C triggers
+1 -1
View File
@@ -28,7 +28,7 @@
static int setAvatar(lua_State* L) {
MonsterData* monster = static_cast<MonsterData*>(lua_touserdata(L, 1));
monster->SetAvatar(lua_tostring(L, 2));
//TODO: send an update to the clients?
//TODO: (1) send an update to the clients?
return 0;
}
+14 -1
View File
@@ -21,10 +21,23 @@
*/
#include "monster_data.hpp"
MonsterData::MonsterData(): Entity("monster") {
MonsterData::MonsterData(std::string _avatar, int _scriptRef):
Entity("monster"),
avatar(_avatar),
scriptRef(_scriptRef)
{
//EMPTY
}
void MonsterData::Update() {
Entity::Update();
//TODO: (0) call the script reference
}
//-------------------------
//accessors & mutators
//-------------------------
std::string MonsterData::SetAvatar(std::string s) {
return avatar = s;
}
+12 -1
View File
@@ -28,11 +28,22 @@
#include <string>
/* DOCS: Monster attributes, read more
* species (avatar, script)
* level
* health/mana
* permadeath/respawn
*/
class MonsterData: public Entity {
public:
MonsterData();
MonsterData(std::string avatar, int scriptRef);
~MonsterData() = default;
virtual void Update();
//accessors & mutators
std::string SetAvatar(std::string);
std::string GetAvatar();
+32 -12
View File
@@ -29,46 +29,66 @@ MonsterManager::~MonsterManager() {
UnloadAll();
}
int MonsterManager::Create(std::string) {
//TODO: (9) MonsterManager::Create()
int MonsterManager::Create(std::string avatar, int scriptRef) {
//implicitly create the new
elementMap.emplace(counter, MonsterData(avatar, scriptRef));
//TODO: do various things like saving to the database
return counter++;
}
//TODO: (1) monster load, save
void MonsterManager::Unload(int uid) {
//TODO: (9) MonsterManager::Unload()
elementMap.erase(uid);
}
void MonsterManager::UnloadAll() {
//TODO: (9) MonsterManager::UnloadAll()
elementMap.clear();
}
void MonsterManager::UnloadIf(std::function<bool(std::pair<const int, MonsterData const&>)> fn) {
//TODO: (9) MonsterManager::UnloadIf()
std::map<int, MonsterData>::iterator it = elementMap.begin();
while (it != elementMap.end()) {
if (fn(*it)) {
it = elementMap.erase(it);
}
else {
++it;
}
}
}
MonsterData* MonsterManager::Get(int uid) {
//TODO: (9) MonsterManager::Get()
std::map<int, MonsterData>::iterator it = elementMap.find(uid);
if (it == elementMap.end()) {
return nullptr;
}
return &it->second;
}
int MonsterManager::GetLoadedCount() {
//TODO: (9) MonsterManager::GetLoadedCount()
return elementMap.size();
}
std::map<int, MonsterData>* MonsterManager::GetContainer() {
//TODO: (9) MonsterManager::GetContainer()
return &elementMap;
}
lua_State* MonsterManager::SetLuaState(lua_State* L) {
//TODO: (9) MonsterManager::SetLuaState()
return lua = L;
}
lua_State* MonsterManager::GetLuaState() {
//TODO: (9) MonsterManager::GetLuaState()
return lua;
}
sqlite3* MonsterManager::SetDatabase(sqlite3* db) {
//TODO: (9) MonsterManager::SetDatabase()
return database = db;
}
sqlite3* MonsterManager::GetDatabase() {
//TODO: (9) MonsterManager::GetDatabase()
return database;
}
+2 -1
View File
@@ -37,7 +37,7 @@ public:
~MonsterManager();
//common public methods
int Create(std::string);
int Create(std::string avatar, int scriptRef);
void Unload(int uid);
void UnloadAll();
@@ -57,6 +57,7 @@ public:
private:
//members
std::map<int, MonsterData> elementMap;
int counter = 0;
lua_State* lua = nullptr;
sqlite3* database = nullptr;
};
+47
View File
@@ -23,7 +23,54 @@
#include "monster_manager.hpp"
static int create(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
int index = mgr->Create(lua_tostring(L, 2), lua_tointeger(L, 3));
MonsterData* monster = mgr->Get(index);
lua_pushlightuserdata(L, static_cast<void*>(monster));
lua_pushinteger(L, index);
return 2;
}
//TOOD: this needs to take the userdata as a parameter too
static int unload(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
mgr->Unload(lua_tointeger(L, 2));
return 0;
}
static int unloadAll(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
mgr->UnloadAll();
return 0;
}
static int unloadIf(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
//TODO: unloadIf
return 0;
}
static int get(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
MonsterData* monster = mgr->Get(lua_tointeger(L, 2));
lua_pushlightuserdata(L, static_cast<void*>(monster));
return 1;
}
static int getLoadedCount(lua_State* L) {
MonsterManager* mgr = static_cast<MonsterManager* const>(lua_touserdata(L, 1));
lua_pushinteger(L, mgr->GetLoadedCount());
return 1;
}
static const luaL_Reg monsterManagerLib[] = {
{"Create", create},
{"Unload", unload},
{"UnloadAll", unloadAll},
// {"UnloadIf", unloadIf},
{"Get", get},
{"GetLoadedCount", getLoadedCount},
{nullptr, nullptr}
};
+24 -3
View File
@@ -56,11 +56,13 @@ static int getPager(lua_State* L) {
return 1;
}
/*
static int getMonsterMgr(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->GetMonsterMgr()) );
return 1;
}
*/
static int getTriggerMgr(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
@@ -68,8 +70,6 @@ static int getTriggerMgr(lua_State* L) {
return 1;
}
//TODO: character list
static int forEachCharacter(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
//pass each character to the given function
@@ -87,6 +87,26 @@ static int forEachCharacter(lua_State* L) {
return 0;
}
/*
static int forEachMonster(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
MonsterManager* monsterMgr = room->GetMonsterMgr();
//pass each monster to the given function
for (auto& it : *monsterMgr->GetContainer()) {
lua_pushvalue(L, -1);
lua_pushlightuserdata(L, static_cast<void*>(&it.second));
//call each iteration, throwing an exception if something happened
if (lua_pcall(L, 1, 0, 0) != LUA_OK) {
std::ostringstream os;
os << "Lua error: ";
os << lua_tostring(L, -1);
throw(std::runtime_error(os.str()));
}
}
return 0;
}
*/
static int setOnTick(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
luaL_unref(L, LUA_REGISTRYINDEX, room->GetTickReference());
@@ -120,10 +140,11 @@ static const luaL_Reg roomLib[] = {
{"GetTileset", getTilesetName},
{"GetPager",getPager},
{"GetMonsterMgr",getMonsterMgr},
// {"GetMonsterMgr",getMonsterMgr},
{"GetTriggerMgr",getTriggerMgr},
{"ForEachCharacter", forEachCharacter},
// {"ForEachMonster", forEachMonster},
{"SetOnTick", setOnTick},
{"GetOnTick", getOnTick},
-6
View File
@@ -122,10 +122,6 @@ RegionPagerLua* RoomData::GetPager() {
return &pager;
}
MonsterManager* RoomData::GetMonsterMgr() {
return &monsterMgr;
}
TriggerManager* RoomData::GetTriggerMgr() {
return &triggerMgr;
}
@@ -137,7 +133,6 @@ std::list<CharacterData*>* RoomData::GetCharacterList() {
lua_State* RoomData::SetLuaState(lua_State* L) {
lua = L;
pager.SetLuaState(lua);
monsterMgr.SetLuaState(lua);
triggerMgr.SetLuaState(lua);
return lua;
}
@@ -148,7 +143,6 @@ lua_State* RoomData::GetLuaState() {
sqlite3* RoomData::SetDatabase(sqlite3* db) {
database = db;
monsterMgr.SetDatabase(database);
return database;
}
+1 -3
View File
@@ -23,11 +23,11 @@
#define ROOMDATA_HPP_
#include "character_data.hpp"
#include "monster_manager.hpp"
#include "region_pager_lua.hpp"
#include "trigger_manager.hpp"
#include "lua.hpp"
#include "sqlite3.h"
#include <list>
#include <string>
@@ -47,7 +47,6 @@ public:
std::string GetTileset();
RegionPagerLua* GetPager();
MonsterManager* GetMonsterMgr();
TriggerManager* GetTriggerMgr();
std::list<CharacterData*>* GetCharacterList();
@@ -69,7 +68,6 @@ private:
//members
RegionPagerLua pager;
MonsterManager monsterMgr;
TriggerManager triggerMgr;
std::list<CharacterData*> characterList;
-4
View File
@@ -26,7 +26,6 @@
#include "account_manager.hpp"
#include "character_manager.hpp"
#include "client_manager.hpp"
#include "monster_manager.hpp"
#include "room_manager.hpp"
//utilities
@@ -105,9 +104,6 @@ private:
void hCharacterAttack(CharacterPacket* const);
void hCharacterDamage(CharacterPacket* const);
//character management
void hMonsterDamage(MonsterPacket* const);
//chat
void hTextBroadcast(TextPacket* const);
void hTextSpeech(TextPacket* const);
-5
View File
@@ -327,11 +327,6 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) {
hCharacterDamage(static_cast<CharacterPacket*>(argPacket));
break;
//monster management
case SerialPacketType::MONSTER_DAMAGE:
hMonsterDamage(static_cast<MonsterPacket*>(argPacket));
break;
//chat
case SerialPacketType::TEXT_BROADCAST:
hTextBroadcast(static_cast<TextPacket*>(argPacket));
-26
View File
@@ -1,26 +0,0 @@
/* Copyright: (c) Kayne Ruse 2013-2015
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "server_application.hpp"
void ServerApplication::hMonsterDamage(MonsterPacket* const argPacket) {
//TODO: (9) ServerApplication::hMonsterDamage()
}
@@ -64,8 +64,13 @@ static int pumpCharacterUpdate(lua_State* L) {
return 1;
}
static int pumpMonsterUpdate(lua_State* L) {
//TODO: (0) send the info about a specific monster instance
}
static const luaL_Reg networkLib[] = {
{"PumpCharacterUpdate", pumpCharacterUpdate},
{"PumpMonsterUpdate", pumpMonsterUpdate},
{nullptr, nullptr}
};