Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 30 additions & 10 deletions Server/Components/Dialogs/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class DialogsComponent final : public IDialogsComponent, public PlayerConnectEve
return false;
}

if (sendDialogResponse.Response < 0 || sendDialogResponse.Response > 1)
if (sendDialogResponse.Response < DialogResponse_Right || sendDialogResponse.Response > DialogResponse_Left)
{
return false;
}
Expand All @@ -167,22 +167,42 @@ class DialogsComponent final : public IDialogsComponent, public PlayerConnectEve

if ((data->style_ == DialogStyle_LIST || data->style_ == DialogStyle_TABLIST || data->style_ == DialogStyle_TABLIST_HEADERS) && data->body_.length() > 0)
{
unsigned int lines = 0;
int count = -1;
std::string temp;

for (unsigned int i = 0; i < data->body_.length() - 1; i++)
std::remove_copy(data->body_.begin(), data->body_.end(), std::back_inserter(temp), '\n');

if (!temp.empty())
{
if (data->body_[i] == '\n')
struct duplicateEndLine
{
bool operator()(char first, char second) const
{
return first == second && first == '\n';
}
};

data->body_.erase(std::unique(data->body_.begin(), data->body_.end(), duplicateEndLine()), data->body_.end());

if (data->body_[0] == '\n')
{
lines++;
data->body_.erase(0, 1);
}
}

if (data->style_ == DialogStyle_TABLIST_HEADERS && lines > 0)
{
lines--;
if (data->body_[data->body_.length() - 1] == '\n')
{
data->body_.erase(std::prev(data->body_.end()));
}

count = std::count(data->body_.begin(), data->body_.end(), '\n');

if (data->style_ == DialogStyle_TABLIST_HEADERS)
{
count--;
}
}

if (sendDialogResponse.ListItem < 0 || sendDialogResponse.ListItem > lines)
if (sendDialogResponse.ListItem < 0 || sendDialogResponse.ListItem > count)
{
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion Shared/NetCode/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,9 @@ namespace RPC

bs.writeUINT16(PlayerID);
bs.writeUINT32(Skin);
bs.writeUINT32(CustomSkin);

if (isDL)
bs.writeUINT32(CustomSkin);
}
};

Expand Down