Skip to content

Commit

Permalink
attempt#2 to fix masterwork/exceptional/decorated symbols
Browse files Browse the repository at this point in the history
this time we're using a couple of `static_cast<char>(...)` thingies
  • Loading branch information
TaxiService authored Mar 31, 2023
1 parent 38d4eea commit 18f1b5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/modules/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,13 +720,13 @@ df::coord Items::getPosition(df::item *item)
return item->pos;
}

static char quality_table[] = { 0, '-', '+', '*', '=', '@' };
static int quality_table[] = { 0, 45, 43, 42, 240, 15 };

static void addQuality(std::string &tmp, int quality)
{
if (quality > 0 && quality <= 5) {
char c = quality_table[quality];
tmp = c + tmp + c;
int c = quality_table[quality];
tmp = static_cast<char>(c) + tmp + static_cast<char>(c);
}
}

Expand Down Expand Up @@ -825,7 +825,7 @@ std::string Items::getDescription(df::item *item, int type, bool decorate)
addQuality(tmp, item->getQuality());

if (item->isImproved()) {
tmp = "<" + tmp + ">";
tmp = static_cast<char>(174) + tmp + static_cast<char>(175);
addQuality(tmp, item->getImprovementQuality());
}
}
Expand Down

0 comments on commit 18f1b5c

Please sign in to comment.