eliminate using namespace
This commit is contained in:
+59
-62
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "StaticGameData.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ItemNameIndex::ItemNameIndex(
|
||||
std::shared_ptr<const ItemParameterTable> item_parameter_table,
|
||||
std::shared_ptr<const ItemData::StackLimits> limits,
|
||||
@@ -19,17 +17,17 @@ ItemNameIndex::ItemNameIndex(
|
||||
continue;
|
||||
}
|
||||
|
||||
const string* name = nullptr;
|
||||
const std::string* name = nullptr;
|
||||
bool is_es_weapon = false;
|
||||
try {
|
||||
ItemData item = ItemData::from_primary_identifier(*this->limits, primary_identifier);
|
||||
is_es_weapon = item.is_s_rank_weapon();
|
||||
name = &name_coll.at(item_parameter_table->get_item_id(item));
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
}
|
||||
|
||||
if (name) {
|
||||
auto meta = make_shared<ItemMetadata>();
|
||||
auto meta = std::make_shared<ItemMetadata>();
|
||||
meta->primary_identifier = primary_identifier;
|
||||
meta->name = *name;
|
||||
this->primary_identifier_index.emplace(meta->primary_identifier, meta);
|
||||
@@ -44,7 +42,7 @@ ItemNameIndex::ItemNameIndex(
|
||||
static std::string s_rank_name_characters("\0ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_", 0x20);
|
||||
|
||||
// clang-format off
|
||||
static const array<const char*, 0x29> name_for_weapon_special = {
|
||||
static const std::array<const char*, 0x29> name_for_weapon_special = {
|
||||
nullptr,
|
||||
"Draw", // Type: 0001, amount: 0005
|
||||
"Drain", // Type: 0001, amount: 0009
|
||||
@@ -89,7 +87,7 @@ static const array<const char*, 0x29> name_for_weapon_special = {
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
const array<const char*, 0x11> name_for_s_rank_special = {
|
||||
const std::array<const char*, 0x11> name_for_s_rank_special = {
|
||||
nullptr,
|
||||
"Jellen",
|
||||
"Zalure",
|
||||
@@ -117,7 +115,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
return std::format("{}{} Meseta", include_color_escapes ? "$C7" : "", item.data2d);
|
||||
}
|
||||
|
||||
vector<string> ret_tokens;
|
||||
std::vector<std::string> ret_tokens;
|
||||
|
||||
// For weapons, specials appear before the weapon name
|
||||
bool is_unidentified = false;
|
||||
@@ -135,7 +133,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
if (special_id) {
|
||||
try {
|
||||
ret_tokens.emplace_back(name_for_weapon_special.at(special_id));
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
ret_tokens.emplace_back(std::format("!SP:{:02X}", special_id));
|
||||
}
|
||||
}
|
||||
@@ -143,7 +141,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
if (!name_only && (item.data1[0] == 0x00) && (item.data1[2] != 0x00) && item.is_s_rank_weapon()) {
|
||||
try {
|
||||
ret_tokens.emplace_back(name_for_s_rank_special.at(item.data1[2]));
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
ret_tokens.emplace_back(std::format("!SSP:{:02X}", item.data1[2]));
|
||||
}
|
||||
}
|
||||
@@ -160,11 +158,11 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
// Add the item name
|
||||
uint32_t primary_identifier = item.primary_identifier();
|
||||
if ((primary_identifier & 0xFFFF0000) == 0x03020000) {
|
||||
string technique_name;
|
||||
std::string technique_name;
|
||||
try {
|
||||
technique_name = tech_id_to_name.at(item.data1[4]);
|
||||
technique_name[0] = toupper(technique_name[0]);
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
technique_name = std::format("!TD:{:02X}", item.data1[4]);
|
||||
}
|
||||
// Hide the level for Reverser and Ryuker, unless the level isn't 1
|
||||
@@ -177,7 +175,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
try {
|
||||
auto meta = this->primary_identifier_index.at(primary_identifier);
|
||||
ret_tokens.emplace_back(meta->name);
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
ret_tokens.emplace_back(std::format("!ID:{:08X}", primary_identifier));
|
||||
}
|
||||
}
|
||||
@@ -208,7 +206,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
static_cast<uint8_t>(be_data1w5 & 0x1F),
|
||||
};
|
||||
|
||||
string name;
|
||||
std::string name;
|
||||
for (size_t x = 0; x < 8; x++) {
|
||||
char ch = s_rank_name_characters.at(char_indexes[x]);
|
||||
if (ch == 0) {
|
||||
@@ -306,7 +304,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
uint16_t pow = item.data1w[3];
|
||||
uint16_t dex = item.data1w[4];
|
||||
uint16_t mind = item.data1w[5];
|
||||
auto format_stat = +[](uint16_t stat) -> string {
|
||||
auto format_stat = +[](uint16_t stat) -> std::string {
|
||||
uint16_t level = stat / 100;
|
||||
uint8_t partial = stat % 100;
|
||||
if (partial == 0) {
|
||||
@@ -323,7 +321,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
|
||||
uint8_t flags = item.data2[2];
|
||||
if (flags & 7) {
|
||||
static const vector<const char*> pb_shortnames = {"F", "E", "G", "P", "L", "M&Y", "MG", "GR"};
|
||||
static const std::vector<const char*> pb_shortnames = {"F", "E", "G", "P", "L", "M&Y", "MG", "GR"};
|
||||
|
||||
const char* pb_names[3] = {nullptr, nullptr, nullptr};
|
||||
uint8_t left_pb = item.mag_photon_blast_for_slot(2);
|
||||
@@ -339,7 +337,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
pb_names[2] = pb_shortnames[right_pb];
|
||||
}
|
||||
|
||||
string token = "PB:";
|
||||
std::string token = "PB:";
|
||||
for (size_t x = 0; x < 3; x++) {
|
||||
if (pb_names[x] == nullptr) {
|
||||
continue;
|
||||
@@ -354,7 +352,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
|
||||
try {
|
||||
ret_tokens.emplace_back(std::format("({})", name_for_mag_color.at(item.data2[3])));
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
ret_tokens.emplace_back(std::format("(!CL:{:02X})", item.data2[3]));
|
||||
}
|
||||
|
||||
@@ -365,7 +363,7 @@ std::string ItemNameIndex::describe_item(const ItemData& item, uint8_t flags) co
|
||||
}
|
||||
}
|
||||
|
||||
string ret = phosg::join(ret_tokens, " ");
|
||||
std::string ret = phosg::join(ret_tokens, " ");
|
||||
if (include_color_escapes) {
|
||||
if (is_unidentified) {
|
||||
return "$C3" + ret;
|
||||
@@ -387,18 +385,18 @@ ItemData ItemNameIndex::parse_item_description(const std::string& desc) const {
|
||||
ItemData ret;
|
||||
try {
|
||||
ret = this->parse_item_description_phase(desc, false);
|
||||
} catch (const exception& e1) {
|
||||
} catch (const std::exception& e1) {
|
||||
try {
|
||||
ret = this->parse_item_description_phase(desc, true);
|
||||
} catch (const exception& e2) {
|
||||
} catch (const std::exception& e2) {
|
||||
try {
|
||||
ret = ItemData::from_data(phosg::parse_data_string(desc));
|
||||
} catch (const exception& ed) {
|
||||
} catch (const std::exception& ed) {
|
||||
if (strcmp(e1.what(), e2.what())) {
|
||||
throw runtime_error(std::format("cannot parse item description \"{}\" (as text 1: {}) (as text 2: {}) (as data: {})",
|
||||
throw std::runtime_error(std::format("cannot parse item description \"{}\" (as text 1: {}) (as text 2: {}) (as data: {})",
|
||||
desc, e1.what(), e2.what(), ed.what()));
|
||||
} else {
|
||||
throw runtime_error(std::format("cannot parse item description \"{}\" (as text: {}) (as data: {})",
|
||||
throw std::runtime_error(std::format("cannot parse item description \"{}\" (as text: {}) (as data: {})",
|
||||
desc, e1.what(), ed.what()));
|
||||
}
|
||||
}
|
||||
@@ -414,17 +412,17 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
ret.id = 0xFFFFFFFF;
|
||||
ret.data2d = 0;
|
||||
|
||||
string desc = phosg::tolower(description);
|
||||
std::string desc = phosg::tolower(description);
|
||||
if (desc.ends_with(" meseta")) {
|
||||
ret.data1[0] = 0x04;
|
||||
ret.data2d = stol(desc, nullptr, 10);
|
||||
ret.data2d = std::stol(desc, nullptr, 10);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (desc.starts_with("es ")) {
|
||||
auto parse_name = [&](const std::string& token) -> void {
|
||||
if (token.size() > 8) {
|
||||
throw runtime_error("s-rank name too long");
|
||||
throw std::runtime_error("s-rank name too long");
|
||||
}
|
||||
|
||||
uint8_t char_indexes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
@@ -432,7 +430,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
char ch = toupper(token[z]);
|
||||
size_t pos = s_rank_name_characters.find(ch);
|
||||
if (pos == std::string::npos) {
|
||||
throw runtime_error(std::format("s-rank name contains invalid character {:02X} ({})", ch, ch));
|
||||
throw std::runtime_error(std::format("s-rank name contains invalid character {:02X} ({})", ch, ch));
|
||||
}
|
||||
char_indexes[z] = pos;
|
||||
}
|
||||
@@ -538,10 +536,10 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
ret.data1[4] = tech;
|
||||
} else {
|
||||
if (tokens.size() != 2) {
|
||||
throw runtime_error("invalid tech disk format");
|
||||
throw std::runtime_error("invalid tech disk format");
|
||||
}
|
||||
if (!tokens[1].starts_with("lv.")) {
|
||||
throw runtime_error("invalid tech disk level");
|
||||
throw std::runtime_error("invalid tech disk level");
|
||||
}
|
||||
uint8_t tech = technique_for_name(tokens[0]);
|
||||
uint8_t level = stoul(tokens[1].substr(3), nullptr, 10) - 1;
|
||||
@@ -574,7 +572,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
if (!name_for_weapon_special[z]) {
|
||||
continue;
|
||||
}
|
||||
string prefix = phosg::tolower(name_for_weapon_special[z]);
|
||||
std::string prefix = phosg::tolower(name_for_weapon_special[z]);
|
||||
prefix += ' ';
|
||||
if (desc.starts_with(prefix)) {
|
||||
weapon_special = z;
|
||||
@@ -592,14 +590,14 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
if (name_it != this->name_index.end() && desc.starts_with(name_it->first)) {
|
||||
break;
|
||||
} else if (name_it == this->name_index.begin()) {
|
||||
throw runtime_error("no such item");
|
||||
throw std::runtime_error("no such item");
|
||||
} else {
|
||||
name_it--;
|
||||
lookback++;
|
||||
}
|
||||
}
|
||||
if (lookback >= 4) {
|
||||
throw runtime_error("item not found: " + desc);
|
||||
throw std::runtime_error("item not found: " + desc);
|
||||
}
|
||||
|
||||
desc = desc.substr(name_it->first.size());
|
||||
@@ -637,7 +635,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
} else {
|
||||
auto p_tokens = phosg::split(token, '/');
|
||||
if (p_tokens.size() > 5) {
|
||||
throw runtime_error("invalid bonuses token");
|
||||
throw std::runtime_error("invalid bonuses token");
|
||||
}
|
||||
uint8_t max_bonuses = this->item_parameter_table->is_unsealable_item(ret) ? 2 : 3;
|
||||
uint8_t bonus_index = 0;
|
||||
@@ -647,7 +645,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
continue;
|
||||
}
|
||||
if (bonus_index >= max_bonuses) {
|
||||
throw runtime_error("weapon has too many bonuses");
|
||||
throw std::runtime_error("weapon has too many bonuses");
|
||||
}
|
||||
ret.data1[6 + (2 * bonus_index)] = z + 1;
|
||||
ret.data1[7 + (2 * bonus_index)] = static_cast<uint8_t>(bonus_value);
|
||||
@@ -662,7 +660,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
|
||||
} else if (ret.data1[0] == 0x01) {
|
||||
if (ret.data1[1] == 0x03) { // Unit
|
||||
static const unordered_map<string, uint16_t> modifiers({
|
||||
static const std::unordered_map<std::string, uint16_t> modifiers({
|
||||
{"--", 0xFFFC},
|
||||
{"-", 0xFFFE},
|
||||
{"", 0x0000},
|
||||
@@ -698,7 +696,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
if (token.empty()) {
|
||||
continue;
|
||||
} else if (!token.starts_with("+")) {
|
||||
throw runtime_error("invalid armor/shield modifier");
|
||||
throw std::runtime_error("invalid armor/shield modifier");
|
||||
}
|
||||
if (token.ends_with("def")) {
|
||||
ret.data1w[3] = static_cast<uint16_t>(stol(token.substr(1, token.size() - 4), nullptr, 10));
|
||||
@@ -721,9 +719,9 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
} else if (token.starts_with("pb:")) { // Photon blasts
|
||||
auto pb_tokens = phosg::split(token.substr(3), ',');
|
||||
if (pb_tokens.size() > 3) {
|
||||
throw runtime_error("too many photon blasts specified");
|
||||
throw std::runtime_error("too many photon blasts specified");
|
||||
}
|
||||
static const unordered_map<string, uint8_t> name_to_pb_num(
|
||||
static const std::unordered_map<std::string, uint8_t> name_to_pb_num(
|
||||
{{"f", 0}, {"e", 1}, {"g", 2}, {"p", 3}, {"l", 4}, {"m", 5}, {"my", 5}, {"m&y", 5}});
|
||||
for (const auto& pb_token : pb_tokens) {
|
||||
ret.add_mag_photon_blast(name_to_pb_num.at(pb_token));
|
||||
@@ -735,12 +733,12 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
} else if (!token.empty() && isdigit(token[0])) { // Stats
|
||||
auto s_tokens = phosg::split(token, '/');
|
||||
if (s_tokens.size() != 4) {
|
||||
throw runtime_error("incorrect stat count");
|
||||
throw std::runtime_error("incorrect stat count");
|
||||
}
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto n_tokens = phosg::split(s_tokens[z], '.');
|
||||
if (n_tokens.size() == 0 || n_tokens.size() > 2) {
|
||||
throw logic_error("incorrect stats argument format");
|
||||
throw std::logic_error("incorrect stats argument format");
|
||||
} else if ((n_tokens.size() == 1) || (n_tokens[1].size() == 0)) {
|
||||
ret.data1w[z + 2] = stoul(n_tokens[0], nullptr, 10) * 100;
|
||||
} else if (n_tokens[1].size() == 1) {
|
||||
@@ -748,7 +746,7 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
} else if (n_tokens[1].size() == 2) {
|
||||
ret.data1w[z + 2] = stoul(n_tokens[0], nullptr, 10) * 100 + stoul(n_tokens[1], nullptr, 10);
|
||||
} else {
|
||||
throw runtime_error("incorrect stat format");
|
||||
throw std::runtime_error("incorrect stat format");
|
||||
}
|
||||
}
|
||||
ret.data1[2] = ret.compute_mag_level();
|
||||
@@ -768,18 +766,18 @@ ItemData ItemNameIndex::parse_item_description_phase(const std::string& descript
|
||||
ret.data1[5] = 1;
|
||||
}
|
||||
} else if (!desc.empty()) {
|
||||
throw runtime_error("item cannot be stacked");
|
||||
throw std::runtime_error("item cannot be stacked");
|
||||
}
|
||||
|
||||
if (is_wrapped) {
|
||||
if (ret.is_stackable(*this->limits)) {
|
||||
throw runtime_error("stackable items cannot be wrapped");
|
||||
throw std::runtime_error("stackable items cannot be wrapped");
|
||||
} else {
|
||||
ret.data1[3] |= 0x40;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw logic_error("invalid item class");
|
||||
throw std::logic_error("invalid item class");
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -793,7 +791,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
for (size_t data1_1 = 0; data1_1 < pmt->num_weapon_classes(); data1_1++) {
|
||||
uint8_t weapon_class = pmt->get_weapon_kind(data1_1);
|
||||
float sale_divisor = pmt->get_sale_divisor(0x00, data1_1);
|
||||
string divisor_str = std::format("{:g}", sale_divisor);
|
||||
std::string divisor_str = std::format("{:g}", sale_divisor);
|
||||
divisor_str.resize(13, ' ');
|
||||
|
||||
size_t data1_2_limit = pmt->num_weapons_in_class(data1_1);
|
||||
@@ -806,11 +804,11 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
item.data1[0] = 0x00;
|
||||
item.data1[1] = data1_1;
|
||||
item.data1[2] = data1_2;
|
||||
string name = this->describe_item(item);
|
||||
std::string name = this->describe_item(item);
|
||||
|
||||
const auto& stat_boost = pmt->get_stat_boost(w.stat_boost_entry_index);
|
||||
|
||||
string tech_boost_str;
|
||||
std::string tech_boost_str;
|
||||
if (w.tech_boost_entry_index < pmt->num_tech_boosts()) {
|
||||
const auto& tech_boost = pmt->get_tech_boost(w.tech_boost_entry_index);
|
||||
tech_boost_str = std::format("({:02X}:{:02X}:{:g},{:02X}:{:02X}:{:g},{:02X}:{:02X}:{:g})",
|
||||
@@ -874,7 +872,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
phosg::fwrite_fmt(stream, " CODE => ---ID--- TYPE SKIN POINTS -DFP- -EVP- BP BE FLAG LVL EFR ETH EIC EDK ELT DFR EVR SB(S1:AMT1,S2:AMT2) TB(TN:FL:AMOUNT, ... ) FT A4 ST* ---DIVISOR--- NAME\n");
|
||||
for (size_t data1_1 = 1; data1_1 < 3; data1_1++) {
|
||||
float sale_divisor = pmt->get_sale_divisor(0x01, data1_1);
|
||||
string divisor_str = std::format("{:g}", sale_divisor);
|
||||
std::string divisor_str = std::format("{:g}", sale_divisor);
|
||||
divisor_str.resize(13, ' ');
|
||||
|
||||
size_t data1_2_limit = pmt->num_armors_or_shields_in_class(data1_1);
|
||||
@@ -886,11 +884,11 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
item.data1[0] = 0x01;
|
||||
item.data1[1] = data1_1;
|
||||
item.data1[2] = data1_2;
|
||||
string name = this->describe_item(item);
|
||||
std::string name = this->describe_item(item);
|
||||
|
||||
auto& stat_boost = pmt->get_stat_boost(a.stat_boost_entry_index);
|
||||
|
||||
string tech_boost_str;
|
||||
std::string tech_boost_str;
|
||||
if (a.tech_boost_entry_index < pmt->num_tech_boosts()) {
|
||||
const auto& tech_boost = pmt->get_tech_boost(a.tech_boost_entry_index);
|
||||
tech_boost_str = std::format("({:02X}:{:02X}:{:g},{:02X}:{:02X}:{:g},{:02X}:{:02X}:{:g})",
|
||||
@@ -938,7 +936,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
phosg::fwrite_fmt(stream, " CODE => ---ID--- TYPE SKIN POINTS STAT COUNT ST-MOD ST* ---DIVISOR--- NAME\n");
|
||||
{
|
||||
float sale_divisor = pmt->get_sale_divisor(0x01, 0x03);
|
||||
string divisor_str = std::format("{:g}", sale_divisor);
|
||||
std::string divisor_str = std::format("{:g}", sale_divisor);
|
||||
divisor_str.resize(13, ' ');
|
||||
|
||||
size_t data1_2_limit = pmt->num_units();
|
||||
@@ -950,7 +948,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
item.data1[0] = 0x01;
|
||||
item.data1[1] = 0x03;
|
||||
item.data1[2] = data1_2;
|
||||
string name = this->describe_item(item);
|
||||
std::string name = this->describe_item(item);
|
||||
|
||||
phosg::fwrite_fmt(stream, " 0103{:02X} => {:08X} {:04X} {:04X} {:6} {:04X} {:5} {:6} {:2}* {} {}\n",
|
||||
data1_2,
|
||||
@@ -975,14 +973,14 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
const auto& m = pmt->get_mag(data1_1);
|
||||
|
||||
float sale_divisor = pmt->get_sale_divisor(0x02, data1_1);
|
||||
string divisor_str = std::format("{:g}", sale_divisor);
|
||||
std::string divisor_str = std::format("{:g}", sale_divisor);
|
||||
divisor_str.resize(13, ' ');
|
||||
|
||||
ItemData item;
|
||||
item.data1[0] = 0x02;
|
||||
item.data1[1] = data1_1;
|
||||
item.data1[2] = 0x00;
|
||||
string name = this->describe_item(item);
|
||||
std::string name = this->describe_item(item);
|
||||
|
||||
phosg::fwrite_fmt(stream, " 02{:02X}00 => {:08X} {:04X} {:04X} {:6} {:04X} {:02X} {:02X} {:02X} {:02X} {:02X} {:02X} {:02X} {:02X} {:02X} {:02X} {:04X} {} {}\n",
|
||||
data1_1,
|
||||
@@ -1011,7 +1009,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
phosg::fwrite_fmt(stream, " CODE => ---ID--- TYPE SKIN POINTS COUNT TECH -COST- ITEMFLAG ---DIVISOR--- NAME\n");
|
||||
for (size_t data1_1 = 0; data1_1 < pmt->num_tool_classes(); data1_1++) {
|
||||
float sale_divisor = pmt->get_sale_divisor(0x03, data1_1);
|
||||
string divisor_str = std::format("{:g}", sale_divisor);
|
||||
std::string divisor_str = std::format("{:g}", sale_divisor);
|
||||
divisor_str.resize(13, ' ');
|
||||
|
||||
size_t data1_2_limit = pmt->num_tools_in_class(data1_1);
|
||||
@@ -1023,7 +1021,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
item.data1[1] = data1_1;
|
||||
item.data1[(data1_1 == 0x02) ? 4 : 2] = data1_2;
|
||||
item.set_tool_item_amount(*this->limits, 1);
|
||||
string name = this->describe_item(item);
|
||||
std::string name = this->describe_item(item);
|
||||
|
||||
phosg::fwrite_fmt(stream, " 03{:02X}{:02X} => {:08X} {:04X} {:04X} {:6} {:5} {:04X} {:6} {:08X} {} {}\n",
|
||||
data1_1,
|
||||
@@ -1078,7 +1076,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
if (index) {
|
||||
try {
|
||||
name = name_for_weapon_special.at(index);
|
||||
} catch (const out_of_range&) {
|
||||
} catch (const std::out_of_range&) {
|
||||
}
|
||||
}
|
||||
phosg::fwrite_fmt(stream, " {:02X} => {:04X} {:5} {:2}* {}\n", index, sp.type, sp.amount, stars, name);
|
||||
@@ -1191,7 +1189,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
static constexpr std::array<const char*, 0x10> stat_names{
|
||||
"ATP+", "ATA+", "EVP+", "DFP+", "MST+", "HP+", "LCK+", "ALL+",
|
||||
"ATP-", "ATA-", "EVP-", "DFP-", "MST-", "HP-", "LCK-", "ALL-"};
|
||||
string s;
|
||||
std::string s;
|
||||
if (sb.stat1 > 0x10) {
|
||||
s = std::format("[{:02X}:{:04X}]", sb.stat1, sb.amount1);
|
||||
} else if (sb.stat1 > 0) {
|
||||
@@ -1244,7 +1242,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
phosg::fwrite_fmt(stream, " ## => BOOSTS\n");
|
||||
for (size_t z = 0; z < pmt->num_tech_boosts(); z++) {
|
||||
const auto& tb = pmt->get_tech_boost(z);
|
||||
string s;
|
||||
std::string s;
|
||||
if (tb.amount1) {
|
||||
s += std::format("{:02X}:{:02X}:{:g}", tb.tech_num1, tb.flags1, tb.amount1);
|
||||
}
|
||||
@@ -1269,8 +1267,7 @@ void ItemNameIndex::print_table(FILE* stream) const {
|
||||
item.data1[0] = item_code >> 16;
|
||||
item.data1[1] = item_code >> 8;
|
||||
item.data1[2] = item_code;
|
||||
string name = this->describe_item(item);
|
||||
phosg::fwrite_fmt(stream, " {:06X} {}\n", item_code, name);
|
||||
phosg::fwrite_fmt(stream, " {:06X} {}\n", item_code, this->describe_item(item));
|
||||
}
|
||||
|
||||
phosg::fwrite_fmt(stream, "RANGED SPECIALS\n");
|
||||
|
||||
Reference in New Issue
Block a user