BattleData can hold a limited number of characters

This commit is contained in:
2016-08-29 19:05:41 +10:00
parent b2aecc933a
commit 4cce98dba4
7 changed files with 93 additions and 22 deletions
+7
View File
@@ -67,6 +67,12 @@ static int setRoom(lua_State* L) {
return 0;
}
static int getIndex(lua_State* L) {
CharacterData* character = static_cast<CharacterData*>(lua_touserdata(L, 1));
lua_pushinteger(L, character->GetIndex());
return 1;
}
static int getOwner(lua_State* L) {
CharacterData* character = static_cast<CharacterData*>(lua_touserdata(L, 1));
lua_pushinteger(L, character->GetOwner());
@@ -87,6 +93,7 @@ static int getAvatar(lua_State* L) {
static const luaL_Reg characterLib[] = {
{"SetRoom", setRoom},
{"GetIndex", getIndex},
// {"GetOwner", getOwner}, //unusable without account API
{"GetHandle", getHandle},
{"GetAvatar", getAvatar},
+4
View File
@@ -30,6 +30,10 @@ CharacterData::CharacterData(): Entity("character") {
});
}
//-------------------------
//database stuff
//-------------------------
int CharacterData::GetIndex() {
return index;
}
+1
View File
@@ -45,6 +45,7 @@ public:
private:
friend class CharacterManager;
//database stuff
int index = -1;
int owner = -1;
std::string handle;