Prevent additive text between different characters.

This commit is contained in:
MangosArentLiterature 2021-04-06 23:45:47 -05:00
parent eeab77c136
commit ea131504e7
3 changed files with 15 additions and 1 deletions

View File

@ -272,6 +272,11 @@ class AreaData : public QObject {
*/ */
EvidenceMod evi_mod; EvidenceMod evi_mod;
QMap<QString, QString> notecards; QMap<QString, QString> notecards;
/**
* @brief The last IC packet sent in an area.
*/
QStringList last_ic_message;
}; };
#endif // AREA_DATA_H #endif // AREA_DATA_H

View File

@ -24,7 +24,8 @@ AreaData::AreaData(QString p_name, int p_index) :
locked(FREE), locked(FREE),
document("No document."), document("No document."),
def_hp(10), def_hp(10),
pro_hp(10) pro_hp(10),
last_ic_message()
{ {
QStringList name_split = p_name.split(":"); QStringList name_split = p_name.split(":");
name_split.removeFirst(); name_split.removeFirst();

View File

@ -168,6 +168,8 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa
area->logger->logIC(this, &validated_packet); area->logger->logIC(this, &validated_packet);
server->broadcast(validated_packet, current_area); server->broadcast(validated_packet, current_area);
area->last_ic_message.clear();
area->last_ic_message.append(validated_packet.contents);
} }
void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet) void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet)
@ -601,6 +603,12 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
int additive = incoming_args[24].toInt(); int additive = incoming_args[24].toInt();
if (additive != 0 && additive != 1) if (additive != 0 && additive != 1)
return invalid; return invalid;
else if (area->last_ic_message.isEmpty()){
additive = 0;
}
else if (!(char_id == area->last_ic_message[8].toInt())) {
additive = 0;
}
else if (additive == 1) { else if (additive == 1) {
args[4].insert(0, " "); args[4].insert(0, " ");
} }