From e07ef9be934e11bff80e4451777533914fa31374 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Fri, 28 Mar 2008 16:56:07 +0100 Subject: [PATCH] Seems like a change, but is just a global extra tab in the M_DONE case. --- UnsignedByte/Core/EditorNewCharacter.cpp | 108 +++++++++++++++---------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/UnsignedByte/Core/EditorNewCharacter.cpp b/UnsignedByte/Core/EditorNewCharacter.cpp index f5092da..b23ec8b 100644 --- a/UnsignedByte/Core/EditorNewCharacter.cpp +++ b/UnsignedByte/Core/EditorNewCharacter.cpp @@ -146,67 +146,67 @@ void EditorNewCharacter::OnLine(const std::string &line) } case M_DONE: - { - if(line.size() != 0) { - m_sock->Send("Please hit enter to continue.\n"); - return; - } + if(line.size() != 0) + { + m_sock->Send("Please hit enter to continue.\n"); + return; + } - KeysPtr keys(new Keys(db::TableImpls::Get()->ROOMS)); - KeyValuePtr key(new KeyValue(db::RoomsFields::Get()->ROOMID, 1)); - keys->addKey(key); - - if(DatabaseMgr::Get()->CountSavable(db::TableImpls::Get()->ROOMS, keys) <= 0) - { - m_sock->Sendf("Could not fetch room 1!\n"); - m_sock->Send("Closing your connection now.\n"); - m_sock->SetCloseAndDelete(); - return; - } + KeysPtr keys(new Keys(db::TableImpls::Get()->ROOMS)); + KeyValuePtr key(new KeyValue(db::RoomsFields::Get()->ROOMID, 1)); + keys->addKey(key); + + if(DatabaseMgr::Get()->CountSavable(db::TableImpls::Get()->ROOMS, keys) <= 0) + { + m_sock->Sendf("Could not fetch room 1!\n"); + m_sock->Send("Closing your connection now.\n"); + m_sock->SetCloseAndDelete(); + return; + } - mud::AccountPtr account = m_sock->GetAccount(); + mud::AccountPtr account = m_sock->GetAccount(); - KeysPtr newchkeys = mud::CharacterManager::Get()->Add(); - value_type id = newchkeys->first()->getValue(); - - if(id <= 0) - { - m_sock->Send("For some reason your characters newly inserted id is <= 0.\n"); - m_sock->Send("Disconnecting you now.\n"); - m_sock->SetCloseAndDelete(); - return; - } + KeysPtr newchkeys = mud::CharacterManager::Get()->Add(); + value_type id = newchkeys->first()->getValue(); + + if(id <= 0) + { + m_sock->Send("For some reason your characters newly inserted id is <= 0.\n"); + m_sock->Send("Disconnecting you now.\n"); + m_sock->SetCloseAndDelete(); + return; + } - mud::CharacterPtr character = mud::CharacterManager::Get()->GetByKey(id); - if(!character) - { - m_sock->Send("For some reason your new characters could not be retreived.\n"); - m_sock->Send("Disconnecting you now.\n"); - m_sock->SetCloseAndDelete(); + mud::CharacterPtr character = mud::CharacterManager::Get()->GetByKey(id); + if(!character) + { + m_sock->Send("For some reason your new characters could not be retreived.\n"); + m_sock->Send("Disconnecting you now.\n"); + m_sock->SetCloseAndDelete(); + return; + } + + character->setName(m_name); + character->setRace(m_raceid); + character->setRoom(1); + character->Save(); + character.reset(); + + mud::PCharacterPtr Ch = mud::PCharacterManager::Get()->LoadByKey(m_sock, id); + + Assert(m_sock->hasAccount()); + value_type accountid = m_sock->GetAccount()->getID(); + + RelationPtr relation(new Relation(db::TableImpls::Get()->CHARACTERACCOUNT)); + relation->addKey(db::CharacterAccountFields::Get()->FKACCOUNTS, accountid); + relation->addKey(db::CharacterAccountFields::Get()->FKENTITIES, id); + relation->save(); + + m_sock->Sendf("Character %s created, enjoy!\n", m_name.c_str()); + m_sock->SetEditor(new EditorPlaying(m_sock, Ch), true); return; } - - character->setName(m_name); - character->setRace(m_raceid); - character->setRoom(1); - character->Save(); - character.reset(); - - mud::PCharacterPtr Ch = mud::PCharacterManager::Get()->LoadByKey(m_sock, id); - - Assert(m_sock->hasAccount()); - value_type accountid = m_sock->GetAccount()->getID(); - - RelationPtr relation(new Relation(db::TableImpls::Get()->CHARACTERACCOUNT)); - relation->addKey(db::CharacterAccountFields::Get()->FKACCOUNTS, accountid); - relation->addKey(db::CharacterAccountFields::Get()->FKENTITIES, id); - relation->save(); - - m_sock->Sendf("Character %s created, enjoy!\n", m_name.c_str()); - m_sock->SetEditor(new EditorPlaying(m_sock, Ch), true); - return; - } } } -- 2.11.4.GIT