mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
simplified conversion
This commit is contained in:
parent
6499139a49
commit
cf70881370
@ -5890,7 +5890,7 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
std::string nOtherPlayerID;
|
||||
std::string selection;
|
||||
uint32_t messageLength;
|
||||
int32_t reporterID;
|
||||
int32_t reporterID = 0;
|
||||
|
||||
//Reading:
|
||||
inStream->Read(messageLength);
|
||||
@ -5920,18 +5920,9 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
nOtherPlayerID.push_back(character);
|
||||
}
|
||||
// Convert other player id from LWOOBJID to the database id.
|
||||
std::istringstream iss(nOtherPlayerID);
|
||||
LWOOBJID nOtherPlayerLWOOBJID;
|
||||
iss >> nOtherPlayerLWOOBJID;
|
||||
if (nOtherPlayerLWOOBJID != LWOOBJID_EMPTY) {
|
||||
auto otherPlayer = EntityManager::Instance()->GetEntity(nOtherPlayerLWOOBJID);
|
||||
if (otherPlayer) {
|
||||
auto character = otherPlayer->GetCharacter();
|
||||
if (character) {
|
||||
nOtherPlayerID = std::to_string(character->GetID());
|
||||
}
|
||||
}
|
||||
}
|
||||
uint32_t otherPlayer = LWOOBJID_EMPTY;
|
||||
if (nOtherPlayerID != "") otherPlayer = std::atoi(nOtherPlayerID.c_str());
|
||||
|
||||
uint32_t selectionLength;
|
||||
inStream->Read(selectionLength);
|
||||
for (unsigned int k = 0; k < selectionLength; k++) {
|
||||
@ -5944,14 +5935,14 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
sql::PreparedStatement* insertBug = Database::CreatePreppedStmt("INSERT INTO `bug_reports`(body, client_version, other_player_id, selection, reporter_id) VALUES (?, ?, ?, ?, ?)");
|
||||
insertBug->setString(1, GeneralUtils::UTF16ToWTF8(body));
|
||||
insertBug->setString(2, clientVersion);
|
||||
insertBug->setString(3, nOtherPlayerID);
|
||||
insertBug->setString(3, std::to_string(otherPlayer));
|
||||
insertBug->setString(4, selection);
|
||||
insertBug->setInt(5, reporterID);
|
||||
insertBug->execute();
|
||||
delete insertBug;
|
||||
}
|
||||
catch (sql::SQLException& e) {
|
||||
Game::logger->Log("HandleReportBug", "Couldn't save bug report!\n");
|
||||
Game::logger->Log("HandleReportBug", "Couldn't save bug report! (%s)\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user