Creatures are nearly ready

This commit is contained in:
2016-03-27 14:06:47 +11:00
parent cbf8538c24
commit 42b37be6f5
9 changed files with 87 additions and 41 deletions
+10 -1
View File
@@ -109,7 +109,8 @@ void RoomData::RunFrame() {
for (auto& it : creatureList) {
CreaturePacket packet;
copyCreatureToPacket(&packet, it.second, it.first);
//TODO: send
packet.type = SerialPacketType::CREATURE_UPDATE;
pumpPacketProximity(reinterpret_cast<SerialPacket*>(&packet), roomIndex, it.second->GetOrigin(), 320);
}
//TODO: creature/character collisions
@@ -131,6 +132,14 @@ std::string RoomData::GetTileset() {
return tilesetName;
}
int RoomData::SetRoomIndex(int i) {
return roomIndex = i;
}
int RoomData::GetRoomIndex() {
return roomIndex;
}
std::list<CharacterData*>* RoomData::GetCharacterList() {
return &characterList;
}
+4
View File
@@ -48,6 +48,9 @@ public:
std::string SetTileset(std::string);
std::string GetTileset();
int SetRoomIndex(int i);
int GetRoomIndex();
std::list<CharacterData*>* GetCharacterList();
CreatureManager* GetCreatureMgr();
RegionPagerLua* GetPager();
@@ -70,6 +73,7 @@ private:
std::string tilesetName;
//members
int roomIndex = 0;
std::list<CharacterData*> characterList;
CreatureManager creatureMgr;
RegionPagerLua pager;
+1
View File
@@ -34,6 +34,7 @@ int RoomManager::Create(std::string roomName, std::string tileset) {
RoomData* newRoom = &elementMap[counter]; //implicitly constructs the element
newRoom->SetName(roomName);
newRoom->SetTileset(tileset);
newRoom->SetRoomIndex(counter);
newRoom->SetLuaState(lua);
newRoom->SetDatabase(database);