Implemented client-side character delete; untested

This commit is contained in:
Kayne Ruse
2014-12-19 14:21:05 +11:00
parent 4d1bb17382
commit 7962692641
2 changed files with 26 additions and 9 deletions
+25 -8
View File
@@ -427,22 +427,39 @@ void InWorld::HandleCharacterCreate(CharacterPacket* const argPacket) {
} }
//implicity create and retrieve the entity //implicity create and retrieve the entity
BaseCharacter& character = characterMap[argPacket->characterIndex]; BaseCharacter* character = &characterMap[argPacket->characterIndex];
//fill the character's info //fill the character's info
character.SetOrigin({0, 0}); character->SetOrigin({0, 0});
character.SetMotion({0, 0}); character->SetMotion({0, 0});
character.SetBounds({CHARACTER_BOUNDS_X, CHARACTER_BOUNDS_Y, CHARACTER_BOUNDS_WIDTH, CHARACTER_BOUNDS_HEIGHT}); character->SetBounds({CHARACTER_BOUNDS_X, CHARACTER_BOUNDS_Y, CHARACTER_BOUNDS_WIDTH, CHARACTER_BOUNDS_HEIGHT});
character.SetHandle(argPacket->handle); character->SetHandle(argPacket->handle);
character.SetAvatar(argPacket->avatar); character->SetAvatar(argPacket->avatar);
//TODO: check for this player's character
//TODO: setup the camera
//debug //debug
std::cout << "Create, total: " << characterMap.size() << std::endl; std::cout << "Create, total: " << characterMap.size() << std::endl;
} }
void InWorld::HandleCharacterDelete(CharacterPacket* const argPacket) { void InWorld::HandleCharacterDelete(CharacterPacket* const argPacket) {
//TODO: HandleCharacterDelete() //ignore if this character doesn't exist
std::cout << "HandleCharacterDelete" << std::endl; std::map<int, BaseCharacter>::iterator characterIt = characterMap.find(argPacket->characterIndex);
if (characterIt == characterMap.end()) {
//debug
std::cout << "Ignoring character deletion" << std::endl;
return;
}
//TODO: check for this player's character
//remove this character
characterMap.erase(characterIt);
//debug
std::cout << "Delete, total: " << characterMap.size() << std::endl;
} }
void InWorld::HandleCharacterQueryExists(CharacterPacket* const argPacket) { void InWorld::HandleCharacterQueryExists(CharacterPacket* const argPacket) {
+1 -1
View File
@@ -50,7 +50,7 @@ void ServerApplication::PumpPacket(SerialPacket* const argPacket) {
//find that account's client //find that account's client
//send the packet to that client //send the packet to that client
//NOTE: this is perhaps too complex; I write it if I need it //NOTE: this is perhaps too complex; I write it if I need it
*/} }*/
//------------------------- //-------------------------
//common copy methods //common copy methods