Commit d552e276 authored by Chen Bill's avatar Chen Bill Committed by GitHub

Use const references for formatting (#2923)

parent a5ce265b
......@@ -1307,8 +1307,8 @@ void Game::DrawDeckBd() {
else
myswprintf(adBuffer, L"%d/-", ptr->second.attack);
}
auto attribute = dataManager.FormatAttribute(ptr->second.attribute);
auto race = dataManager.FormatRace(ptr->second.race);
const auto& attribute = dataManager.FormatAttribute(ptr->second.attribute);
const auto& race = dataManager.FormatRace(ptr->second.race);
myswprintf(textBuffer, L"%ls/%ls %ls%d", attribute.c_str(), race.c_str(), form, ptr->second.level);
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
if(ptr->second.type & TYPE_PENDULUM) {
......@@ -1319,7 +1319,7 @@ void Game::DrawDeckBd() {
} else {
myswprintf(textBuffer, L"%ls", dataManager.GetName(ptr->first));
DrawShadowText(textFont, textBuffer, Resize(860, 165 + i * 66, 955, 185 + i * 66), Resize(1, 1, 0, 0));
auto type = dataManager.FormatType(ptr->second.type);
const auto& type = dataManager.FormatType(ptr->second.type);
myswprintf(textBuffer, L"%ls", type.c_str());
DrawShadowText(textFont, textBuffer, Resize(860, 187 + i * 66, 955, 207 + i * 66), Resize(1, 1, 0, 0));
myswprintf(textBuffer, L"%ls", availBuffer);
......
......@@ -1116,7 +1116,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break;
}
case HINT_RACE: {
auto race = dataManager.FormatRace(data);
const auto& race = dataManager.FormatRace(data);
myswprintf(textBuffer, dataManager.GetSysString(1511), race.c_str());
mainGame->AddLog(textBuffer);
mainGame->gMutex.lock();
......@@ -1127,7 +1127,7 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break;
}
case HINT_ATTRIB: {
auto attribute = dataManager.FormatAttribute(data);
const auto& attribute = dataManager.FormatAttribute(data);
myswprintf(textBuffer, dataManager.GetSysString(1511), attribute.c_str());
mainGame->AddLog(textBuffer);
mainGame->gMutex.lock();
......
......@@ -1597,8 +1597,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf(formatBuffer, L"\nLINK-%d", mcard->link);
str.append(formatBuffer);
}
auto race = dataManager.FormatRace(mcard->race);
auto attribute = dataManager.FormatAttribute(mcard->attribute);
const auto& race = dataManager.FormatRace(mcard->race);
const auto& attribute = dataManager.FormatAttribute(mcard->attribute);
myswprintf(formatBuffer, L" %ls/%ls", race.c_str(), attribute.c_str());
str.append(formatBuffer);
if(mcard->location == LOCATION_HAND && (mcard->type & TYPE_PENDULUM)) {
......@@ -1625,11 +1625,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else if(mcard->cHint == CHINT_CARD)
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(212), dataManager.GetName(mcard->chValue));
else if(mcard->cHint == CHINT_RACE) {
auto race = dataManager.FormatRace(mcard->chValue);
const auto& race = dataManager.FormatRace(mcard->chValue);
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(213), race.c_str());
}
else if(mcard->cHint == CHINT_ATTRIBUTE) {
auto attribute = dataManager.FormatAttribute(mcard->chValue);
const auto& attribute = dataManager.FormatAttribute(mcard->chValue);
myswprintf(formatBuffer, L"\n%ls%ls", dataManager.GetSysString(214), attribute.c_str());
}
else if(mcard->cHint == CHINT_NUMBER)
......
......@@ -1564,7 +1564,7 @@ void Game::ShowCardInfo(int code, bool resize) {
}
if (target->second.setcode[0]) {
offset = 23;// *yScale;
auto setname = dataManager.FormatSetName(target->second.setcode);
const auto& setname = dataManager.FormatSetName(target->second.setcode);
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), setname.c_str());
stSetName->setText(formatBuffer);
}
......@@ -1576,9 +1576,9 @@ void Game::ShowCardInfo(int code, bool resize) {
}
if(is_valid && cit->second.type & TYPE_MONSTER) {
auto& cd = cit->second;
auto type = dataManager.FormatType(cd.type);
auto race = dataManager.FormatRace(cd.race);
auto attribute = dataManager.FormatAttribute(cd.attribute);
const auto& type = dataManager.FormatType(cd.type);
const auto& race = dataManager.FormatRace(cd.race);
const auto& attribute = dataManager.FormatAttribute(cd.attribute);
myswprintf(formatBuffer, L"[%ls] %ls/%ls", type.c_str(), race.c_str(), attribute.c_str());
stInfo->setText(formatBuffer);
int offset_info = 0;
......@@ -1601,7 +1601,7 @@ void Game::ShowCardInfo(int code, bool resize) {
myswprintf(adBuffer, L"%d/%d", cd.attack, cd.defense);
} else {
form = L"LINK-";
auto link_marker = dataManager.FormatLinkMarker(cd.link_marker);
const auto& link_marker = dataManager.FormatLinkMarker(cd.link_marker);
if(cd.attack < 0)
myswprintf(adBuffer, L"?/- %ls", link_marker.c_str());
else
......@@ -1624,7 +1624,7 @@ void Game::ShowCardInfo(int code, bool resize) {
}
else {
if (is_valid) {
auto type = dataManager.FormatType(cit->second.type);
const auto& type = dataManager.FormatType(cit->second.type);
myswprintf(formatBuffer, L"[%ls]", type.c_str());
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment