Пример #1
0
/**
 * Returns to the previous screen.
 * @param action Pointer to an action.
 */
void CraftInfoState::btnOkClick(Action *)
{
    Craft *c = _base->getCrafts()->at(_craft);
    if (c->getName(_game->getLanguage()) != _edtCraft->getText())
    {
        c->setName(_edtCraft->getText());
    }
    _game->popState();
}
Пример #2
0
/**
 * Changes the Craft name.
 * @param action Pointer to an action.
 */
void CraftInfoState::edtCraftKeyPress(Action *action)
{
    if (action->getDetails()->key.keysym.sym == SDLK_RETURN ||
            action->getDetails()->key.keysym.sym == SDLK_KP_ENTER)
    {
        Craft *c = _base->getCrafts()->at(_craft);
        if (c->getName(_game->getLanguage()) != _edtCraft->getText())
        {
            c->setName(_edtCraft->getText());
            _edtCraft->setText(c->getName(_game->getLanguage()));
        }
    }
}