make client gender neutral

This commit is contained in:
Lee Matos 2016-04-19 18:38:57 -04:00
parent 2e3966afce
commit c01d526161
12 changed files with 185 additions and 515 deletions

View file

@ -37,111 +37,70 @@ void CardZone::clearContents()
const QList<CardItem *> &attachedCards = cards[i]->getAttachedCards();
for (int j = 0; j < attachedCards.size(); ++j)
attachedCards[j]->setParentItem(attachedCards[j]->getZone());
player->deleteCard(cards.at(i));
}
cards.clear();
emit cardCountChanged();
}
QString CardZone::getTranslatedName(bool hisOwn, GrammaticalCase gc) const
QString CardZone::getTranslatedName(bool theirOwn, GrammaticalCase gc) const
{
QString ownerName = player->getName();
bool female = player->getUserInfo()->gender() == ServerInfo_User::Female;
if (name == "hand")
return female
? (hisOwn
? tr("her hand", "nominative, female owner")
: tr("%1's hand", "nominative, female owner").arg(ownerName)
) : (hisOwn
? tr("his hand", "nominative, male owner")
: tr("%1's hand", "nominative, male owner").arg(ownerName)
return (theirOwn
? tr("their hand", "nominative")
: tr("%1's hand", "nominative").arg(ownerName)
);
else if (name == "deck")
switch (gc) {
case CaseLookAtZone:
return female
? (hisOwn
? tr("her library", "look at zone, female owner")
: tr("%1's library", "look at zone, female owner").arg(ownerName)
) : (hisOwn
? tr("his library", "look at zone, male owner")
: tr("%1's library", "look at zone, male owner").arg(ownerName)
return (theirOwn
? tr("their library", "look at zone")
: tr("%1's library", "look at zone").arg(ownerName)
);
case CaseTopCardsOfZone:
return female
? (hisOwn
? tr("of her library", "top cards of zone, female owner")
: tr("of %1's library", "top cards of zone, female owner").arg(ownerName)
) : (hisOwn
? tr("of his library", "top cards of zone, male owner")
: tr("of %1's library", "top cards of zone, male owner").arg(ownerName)
return (theirOwn
? tr("of their library", "top cards of zone,")
: tr("of %1's library", "top cards of zone").arg(ownerName)
);
case CaseRevealZone:
return female
? (hisOwn
? tr("her library", "reveal zone, female owner")
: tr("%1's library", "reveal zone, female owner").arg(ownerName)
) : (hisOwn
? tr("his library", "reveal zone, male owner")
: tr("%1's library", "reveal zone, male owner").arg(ownerName)
return (theirOwn
? tr("their library", "reveal zone")
: tr("%1's library", "reveal zone").arg(ownerName)
);
case CaseShuffleZone:
return female
? (hisOwn
? tr("her library", "shuffle, female owner")
: tr("%1's library", "shuffle, female owner").arg(ownerName)
) : (hisOwn
? tr("his library", "shuffle, male owner")
: tr("%1's library", "shuffle, male owner").arg(ownerName)
return (theirOwn
? tr("their library", "shuffle")
: tr("%1's library", "shuffle").arg(ownerName)
);
default:
return female
? (hisOwn
? tr("her library", "nominative, female owner")
: tr("%1's library", "nominative, female owner").arg(ownerName)
) : (hisOwn
? tr("his library", "nominative, male owner")
: tr("%1's library", "nominative, male owner").arg(ownerName)
return (theirOwn
? tr("their library", "nominative")
: tr("%1's library", "nominative").arg(ownerName)
);
}
else if (name == "grave")
return female
? (hisOwn
? tr("her graveyard", "nominative, female owner")
: tr("%1's graveyard", "nominative, female owner").arg(ownerName)
) : (hisOwn
? tr("his graveyard", "nominative, male owner")
: tr("%1's graveyard", "nominative, male owner").arg(ownerName)
return (theirOwn
? tr("their graveyard", "nominative")
: tr("%1's graveyard", "nominative").arg(ownerName)
);
else if (name == "rfg")
return female
? (hisOwn
? tr("her exile", "nominative, female owner")
: tr("%1's exile", "nominative, female owner").arg(ownerName)
) : (hisOwn
? tr("his exile", "nominative, male owner")
: tr("%1's exile", "nominative, male owner").arg(ownerName)
return (theirOwn
? tr("their exile", "nominative")
: tr("%1's exile", "nominative").arg(ownerName)
);
else if (name == "sb")
switch (gc) {
case CaseLookAtZone:
return female
? (hisOwn
? tr("her sideboard", "look at zone, female owner")
: tr("%1's sideboard", "look at zone, female owner").arg(ownerName)
) : (hisOwn
? tr("his sideboard", "look at zone, male owner")
: tr("%1's sideboard", "look at zone, male owner").arg(ownerName)
return (theirOwn
? tr("their sideboard", "look at zone")
: tr("%1's sideboard", "look at zone").arg(ownerName)
);
case CaseNominative:
return female
? (hisOwn
? tr("her sideboard", "nominative, female owner")
: tr("%1's sideboard", "nominative, female owner").arg(ownerName)
) : (hisOwn
? tr("his sideboard", "nominative, male owner")
: tr("%1's sideboard", "nominative, male owner").arg(ownerName)
return (theirOwn
? tr("their sideboard", "nominative")
: tr("%1's sideboard", "nominative").arg(ownerName)
);
default: break;
}
@ -185,7 +144,7 @@ void CardZone::addCard(CardItem *card, bool reorganize, int x, int y)
if (reorganize)
reorganizeCards();
emit cardCountChanged();
}
@ -247,16 +206,16 @@ void CardZone::moveAllToZone()
QList<QVariant> data = static_cast<QAction *>(sender())->data().toList();
QString targetZone = data[0].toString();
int targetX = data[1].toInt();
Command_MoveCard cmd;
cmd.set_start_zone(getName().toStdString());
cmd.set_target_player_id(player->getId());
cmd.set_target_zone(targetZone.toStdString());
cmd.set_x(targetX);
for (int i = 0; i < cards.size(); ++i)
cmd.mutable_cards_to_move()->add_card()->set_card_id(cards[i]->getId());
player->sendGameCommand(cmd);
}