Merge pull request #65 from AttorneyOnline/char-select-fix
Fix character select menu being bugged on Akashi
This commit is contained in:
commit
036c2907a1
@ -321,7 +321,7 @@ class AOClient : public QObject {
|
||||
*
|
||||
* @param char_id The character ID of the client's new character.
|
||||
*/
|
||||
void changeCharacter(int char_id);
|
||||
bool changeCharacter(int char_id);
|
||||
|
||||
/**
|
||||
* @brief Changes the client's in-character position.
|
||||
|
@ -134,22 +134,22 @@ void AOClient::changeArea(int new_area)
|
||||
sendServerMessage("Area " + server->area_names[current_area] + " is spectate-only; to chat IC you will need to be invited by the CM.");
|
||||
}
|
||||
|
||||
void AOClient::changeCharacter(int char_id)
|
||||
bool AOClient::changeCharacter(int char_id)
|
||||
{
|
||||
AreaData* area = server->areas[current_area];
|
||||
|
||||
if (current_char != "") {
|
||||
area->characters_taken.removeAll(server->getCharID(current_char));
|
||||
}
|
||||
|
||||
if(char_id >= server->characters.length())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (char_id >= 0) {
|
||||
QString char_selected = server->characters[char_id];
|
||||
bool taken = area->characters_taken.contains(char_id);
|
||||
if (taken || char_selected == "")
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (current_char != "") {
|
||||
area->characters_taken.removeAll(server->getCharID(current_char));
|
||||
}
|
||||
|
||||
area->characters_taken.append(char_id);
|
||||
current_char = char_selected;
|
||||
@ -162,6 +162,7 @@ void AOClient::changeCharacter(int char_id)
|
||||
|
||||
server->updateCharsTaken(area);
|
||||
sendPacket("PV", {QString::number(id), "CID", QString::number(char_id)});
|
||||
return true;
|
||||
}
|
||||
|
||||
void AOClient::changePosition(QString new_pos)
|
||||
|
@ -143,13 +143,14 @@ void AOClient::pktCharPassword(AreaData* area, int argc, QStringList argv, AOPac
|
||||
void AOClient::pktSelectChar(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||
{
|
||||
bool argument_ok;
|
||||
char_id = argv[1].toInt(&argument_ok);
|
||||
int selected_char_id = argv[1].toInt(&argument_ok);
|
||||
if (!argument_ok) {
|
||||
char_id = -1;
|
||||
selected_char_id = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
changeCharacter(char_id);
|
||||
if (changeCharacter(selected_char_id))
|
||||
char_id = selected_char_id;
|
||||
}
|
||||
|
||||
void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||
|
Loading…
Reference in New Issue
Block a user