fix some weird uses of the part of speech enum

develop
Ben Lubar 2020-02-18 16:39:39 -06:00
parent c43c9de477
commit 0d36e62d81
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
3 changed files with 7 additions and 7 deletions

@ -484,7 +484,7 @@ namespace df
template<class T> template<class T>
enum_field(enum_field<EnumType,T> ev) : value(IntType(ev.value)) {} enum_field(enum_field<EnumType,T> ev) : value(IntType(ev.value)) {}
operator EnumType () { return EnumType(value); } operator EnumType () const { return EnumType(value); }
enum_field<EnumType,IntType> &operator=(EnumType ev) { enum_field<EnumType,IntType> &operator=(EnumType ev) {
value = IntType(ev); return *this; value = IntType(ev); return *this;
} }

@ -201,9 +201,9 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish
{ {
word.clear(); word.clear();
if (name->words[0] >= 0) if (name->words[0] >= 0)
word.append(world->raws.language.words[name->words[0]]->forms[name->parts_of_speech[0].value]); word.append(world->raws.language.words[name->words[0]]->forms[name->parts_of_speech[0]]);
if (name->words[1] >= 0) if (name->words[1] >= 0)
word.append(world->raws.language.words[name->words[1]]->forms[name->parts_of_speech[1].value]); word.append(world->raws.language.words[name->words[1]]->forms[name->parts_of_speech[1]]);
addNameWord(out, word); addNameWord(out, word);
} }
if (name->words[5] >= 0) if (name->words[5] >= 0)
@ -216,7 +216,7 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish
for (int i = 2; i <= 5; i++) for (int i = 2; i <= 5; i++)
{ {
if (name->words[i] >= 0) if (name->words[i] >= 0)
addNameWord(out, world->raws.language.words[name->words[i]]->forms[name->parts_of_speech[i].value]); addNameWord(out, world->raws.language.words[name->words[i]]->forms[name->parts_of_speech[i]]);
} }
} }
if (name->words[6] >= 0) if (name->words[6] >= 0)
@ -226,7 +226,7 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish
else else
out.append("Of"); out.append("Of");
addNameWord(out, world->raws.language.words[name->words[6]]->forms[name->parts_of_speech[6].value]); addNameWord(out, world->raws.language.words[name->words[6]]->forms[name->parts_of_speech[6]]);
} }
} }

@ -137,7 +137,7 @@ int getCreatedMetalBars (int32_t idx)
return 0; return 0;
} }
void selectWord (const df::language_word_table &table, int32_t &word, df::enum_field<df::part_of_speech,int16_t> &part, int mode) void selectWord (const df::language_word_table &table, int32_t &word, df::part_of_speech &part, int mode)
{ {
if (table.parts[mode].size()) if (table.parts[mode].size())
{ {
@ -174,7 +174,7 @@ void generateName(df::language_name &output, int language, int mode, const df::l
case 0: case 9: case 10: case 0: case 9: case 10:
if (mode != 9) if (mode != 9)
{ {
int32_t word; df::enum_field<df::part_of_speech,int16_t> part; int32_t word; df::part_of_speech part;
output.first_name.clear(); output.first_name.clear();
selectWord(table1, word, part, 2); selectWord(table1, word, part, 2);
if (word >= 0 && size_t(word) < world->raws.language.words.size()) if (word >= 0 && size_t(word) < world->raws.language.words.size())