From 408fc2f14a9fa62364fb50c5de93f2a58bf73fe8 Mon Sep 17 00:00:00 2001 From: DawnFire42 Date: Thu, 26 Feb 2026 15:49:03 -0500 Subject: [PATCH] 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 --- cockatrice/src/game/zones/logic/card_zone_logic.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cockatrice/src/game/zones/logic/card_zone_logic.cpp b/cockatrice/src/game/zones/logic/card_zone_logic.cpp index bd32eab3e..c7149c307 100644 --- a/cockatrice/src/game/zones/logic/card_zone_logic.cpp +++ b/cockatrice/src/game/zones/logic/card_zone_logic.cpp @@ -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 @@ -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")