summaryrefslogtreecommitdiff
path: root/src/gui/char_select.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r--src/gui/char_select.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index ec4dad2e..4c4b99e5 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -48,7 +48,7 @@ class CharDeleteConfirm : public ConfirmDialog
{
public:
CharDeleteConfirm(CharSelectDialog *master);
- void action(const std::string &eventId, gcn::Widget *widget);
+ void action(const gcn::ActionEvent &event);
private:
CharSelectDialog *master;
};
@@ -60,13 +60,13 @@ CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m):
{
}
-void CharDeleteConfirm::action(const std::string &eventId, gcn::Widget *widget)
+void CharDeleteConfirm::action(const gcn::ActionEvent &event)
{
- //ConfirmDialog::action(eventId);
- if (eventId == "yes") {
+ //ConfirmDialog::action(event);
+ if (event.getId() == "yes") {
master->attemptCharDelete();
}
- ConfirmDialog::action(eventId, widget);
+ ConfirmDialog::action(event);
}
CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo):
@@ -122,9 +122,9 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo):
updatePlayerInfo();
}
-void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
+void CharSelectDialog::action(const gcn::ActionEvent &event)
{
- if (eventId == "ok" && n_character > 0)
+ if (event.getId() == "ok" && n_character > 0)
{
// Start game
mNewCharButton->setEnabled(false);
@@ -136,11 +136,11 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
Net::AccountServer::Account::selectCharacter(mCharInfo->getPos());
mCharInfo->lock();
}
- else if (eventId == "cancel")
+ else if (event.getId() == "cancel")
{
state = STATE_EXIT;
}
- else if (eventId == "new")
+ else if (event.getId() == "new")
{
if (n_character < MAX_SLOT + 1)
{
@@ -150,7 +150,7 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
mCharInfo->unlock();
}
}
- else if (eventId == "delete")
+ else if (event.getId() == "delete")
{
// Delete character
if (mCharInfo->getEntry())
@@ -158,11 +158,11 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
new CharDeleteConfirm(this);
}
}
- else if (eventId == "previous")
+ else if (event.getId() == "previous")
{
mCharInfo->prev();
}
- else if (eventId == "next")
+ else if (event.getId() == "next")
{
mCharInfo->next();
}
@@ -253,7 +253,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot):
mCancelButton = new Button("Cancel", "cancel", this);
mPlayerBox = new PlayerBox(mPlayer);
- mNameField->setEventId("create");
+ mNameField->setActionEventId("create");
int w = 200;
int h = 150;
@@ -298,9 +298,9 @@ CharCreateDialog::~CharCreateDialog()
delete mPlayer;
}
-void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget)
+void CharCreateDialog::action(const gcn::ActionEvent &event)
{
- if (eventId == "create") {
+ if (event.getId() == "create") {
if (getName().length() >= 4) {
// Attempt to create the character
mCreateButton->setEnabled(false);
@@ -322,20 +322,20 @@ void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget)
"Your name needs to be at least 4 characters.", this);
}
}
- else if (eventId == "cancel") {
+ else if (event.getId() == "cancel") {
scheduleDelete();
}
- else if (eventId == "nextcolor") {
+ else if (event.getId() == "nextcolor") {
mPlayer->setHairColor((mPlayer->getHairColor() + 1) % NR_HAIR_COLORS);
}
- else if (eventId == "prevcolor") {
+ else if (event.getId() == "prevcolor") {
int prevColor = mPlayer->getHairColor() + NR_HAIR_COLORS - 1;
mPlayer->setHairColor(prevColor % NR_HAIR_COLORS);
}
- else if (eventId == "nextstyle") {
+ else if (event.getId() == "nextstyle") {
mPlayer->setHairStyle((mPlayer->getHairStyle() + 1) % NR_HAIR_STYLES);
}
- else if (eventId == "prevstyle") {
+ else if (event.getId() == "prevstyle") {
int prevStyle = mPlayer->getHairStyle() + NR_HAIR_STYLES - 1;
mPlayer->setHairStyle(prevStyle % NR_HAIR_STYLES);
}