summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/passwordfield.cpp3
-rw-r--r--src/gui/widgets/passwordfield.h2
-rw-r--r--src/gui/windows/charcreatedialog.cpp14
3 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp
index b85eff686..d6d310616 100644
--- a/src/gui/widgets/passwordfield.cpp
+++ b/src/gui/widgets/passwordfield.cpp
@@ -29,7 +29,8 @@
PasswordField::PasswordField(const Widget2 *const widget,
const std::string &text) :
TextField(widget, text),
- mPasswordChar(mSkin ? mSkin->getOption("passwordChar", 42) : 42)
+ mPasswordChar(mSkin ? static_cast<unsigned char>(
+ mSkin->getOption("passwordChar", 42)) : 42U)
{
}
diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h
index 4c05afd40..f9f677d0d 100644
--- a/src/gui/widgets/passwordfield.h
+++ b/src/gui/widgets/passwordfield.h
@@ -47,7 +47,7 @@ class PasswordField final : public TextField
void draw(Graphics *graphics) override final;
protected:
- char mPasswordChar;
+ unsigned char mPasswordChar;
};
#endif // GUI_WIDGETS_PASSWORDFIELD_H
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 02ff66354..ddd6ac873 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -166,13 +166,23 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
maxHairStyle = mPlayer->getNumOfHairstyles();
if (maxHairStyle)
- mHairStyle = (rand() % maxHairStyle) + minHairStyle;
+ {
+ mHairStyle = (static_cast<unsigned int>(rand())
+ % maxHairStyle) + minHairStyle;
+ }
else
+ {
mHairStyle = 0;
+ }
if (maxHairColor)
- mHairColor = (rand() % maxHairColor) + minHairColor;
+ {
+ mHairColor = (static_cast<unsigned int>(rand())
+ % maxHairColor) + minHairColor;
+ }
else
+ {
mHairColor = 0;
+ }
mNameField->setMaximum(24);