refactor(zones): use ZoneNames constants instead of strings

Replace hardcoded zone name strings with ZoneNames::* constants
for existing zones. This improves maintainability and type safety.

Zones converted:
- "hand" -> ZoneNames::HAND
- "deck" -> ZoneNames::DECK
- "grave" -> ZoneNames::GRAVE
- "rfg" -> ZoneNames::EXILE
- "sb" -> ZoneNames::SIDEBOARD
This commit is contained in:
DawnFire42 2026-02-26 15:49:03 -05:00
parent fe162025f1
commit 408fc2f14a

View file

@ -4,6 +4,7 @@
#include "../../player/player.h"
#include "../../player/player_actions.h"
#include "../view_zone.h"
#include "../zone_names.h"
#include "view_zone_logic.h"
#include <QAction>
@ -172,9 +173,9 @@ void CardZoneLogic::clearContents()
QString CardZoneLogic::getTranslatedName(bool theirOwn, GrammaticalCase gc) const
{
QString ownerName = player->getPlayerInfo()->getName();
if (name == "hand")
if (name == ZoneNames::HAND)
return (theirOwn ? tr("their hand", "nominative") : tr("%1's hand", "nominative").arg(ownerName));
else if (name == "deck")
else if (name == ZoneNames::DECK)
switch (gc) {
case CaseLookAtZone:
return (theirOwn ? tr("their library", "look at zone")
@ -190,11 +191,11 @@ QString CardZoneLogic::getTranslatedName(bool theirOwn, GrammaticalCase gc) cons
default:
return (theirOwn ? tr("their library", "nominative") : tr("%1's library", "nominative").arg(ownerName));
}
else if (name == "grave")
else if (name == ZoneNames::GRAVE)
return (theirOwn ? tr("their graveyard", "nominative") : tr("%1's graveyard", "nominative").arg(ownerName));
else if (name == "rfg")
else if (name == ZoneNames::EXILE)
return (theirOwn ? tr("their exile", "nominative") : tr("%1's exile", "nominative").arg(ownerName));
else if (name == "sb")
else if (name == ZoneNames::SIDEBOARD)
switch (gc) {
case CaseLookAtZone:
return (theirOwn ? tr("their sideboard", "look at zone")