allow creating items by name instead of by data

This commit is contained in:
Martin Michelsen
2023-06-18 22:45:10 -07:00
parent f333a88aaf
commit 10ab688207
8 changed files with 473 additions and 86 deletions
+103
View File
@@ -545,3 +545,106 @@ uint8_t technique_for_name(const string& name) {
uint8_t technique_for_name(const u16string& name) {
return technique_for_name(encode_sjis(name));
}
const vector<const char*> name_for_mag_color({
/* 00 */ "red",
/* 01 */ "blue",
/* 02 */ "yellow",
/* 03 */ "green",
/* 04 */ "purple",
/* 05 */ "black",
/* 06 */ "white",
/* 07 */ "cyan",
/* 08 */ "brown",
/* 09 */ "orange",
/* 0A */ "light-blue",
/* 0B */ "olive",
/* 0C */ "light-cyan",
/* 0D */ "dark-purple",
/* 0E */ "grey",
/* 0F */ "light-grey",
/* 10 */ "pink",
/* 11 */ "dark-cyan",
/* 12 */ "costume",
});
const unordered_map<string, uint8_t> mag_color_for_name({
{"red", 0x00},
{"blue", 0x01},
{"yellow", 0x02},
{"green", 0x03},
{"purple", 0x04},
{"black", 0x05},
{"white", 0x06},
{"cyan", 0x07},
{"brown", 0x08},
{"orange", 0x09},
{"light-blue", 0x0A},
{"olive", 0x0B},
{"light-cyan", 0x0C},
{"dark-purple", 0x0D},
{"grey", 0x0E},
{"light-grey", 0x0F},
{"pink", 0x10},
{"dark-cyan", 0x11},
{"costume-color", 0x12},
});
uint8_t drop_area_for_name(const std::string& name) {
static const unordered_map<string, uint8_t> areas({
{"forest1", 0},
{"forest2", 1},
{"dragon", 2},
{"caves1", 2},
{"cave1", 2},
{"caves2", 3},
{"cave2", 3},
{"caves3", 4},
{"cave3", 4},
{"derolle", 5},
{"mines1", 5},
{"mine1", 5},
{"mines2", 6},
{"mine2", 6},
{"volopt", 7},
{"ruins1", 7},
{"ruin1", 7},
{"ruins2", 8},
{"ruin2", 8},
{"ruins3", 9},
{"ruin3", 9},
{"darkfalz", 9},
{"vrtemplealpha", 0},
{"vrtemplebeta", 1},
{"barbaray", 2},
{"vrspaceshipalpha", 2},
{"vrspaceshipbeta", 3},
{"goldragon", 5},
{"centralcontrolarea", 4},
{"cca", 4},
{"jungleareanorth", 5},
{"junglenorth", 5},
{"jungleareaeast", 5},
{"jungleeast", 5},
{"mountain", 6},
{"seaside", 7},
{"galgryphon", 8},
{"seabedupper", 8},
{"seabedlower", 9},
{"olgaflow", 9},
{"seasidenight", 7},
{"tower", 9},
{"cratereast", 2},
{"craterwest", 3},
{"cratersouth", 4},
{"craternorth", 5},
{"craterinterior", 6},
{"subdesert1", 7},
{"subdesert2", 8},
{"subdesert3", 9},
{"saintmillion", 9},
});
return areas.at(tolower(name));
}