Update structures

develop
Quietust 2022-07-16 10:17:46 -06:00 committed by Myk
parent c2f07778b9
commit a20612b0a8
2 changed files with 43 additions and 173 deletions

@ -1 +1 @@
Subproject commit 2196764977011991127244b28ff13b90cef19af3 Subproject commit df19b880fb3cbaa1a31a12b058acf9936d7ddada

@ -153,55 +153,19 @@ void selectWord (const df::language_word_table &table, int32_t &word, df::part_o
} }
} }
void generateName(df::language_name &output, int language, df::language_name_type mode, const df::language_word_table &table1, const df::language_word_table &table2) void generateName(df::language_name &output, int language, const df::language_word_table &table1, const df::language_word_table &table2)
{ {
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{
if (mode != 8 && mode != 9)
{ {
output = df::language_name(); output = df::language_name();
if (language == -1) if (language == -1)
language = rng.df_trandom(world->raws.language.translations.size()); language = rng.df_trandom(world->raws.language.translations.size());
output.type = mode; output.type = language_name_type::Artifact;
output.language = language; output.language = language;
}
output.has_name = 1; output.has_name = 1;
if (output.language == -1) if (output.language == -1)
output.language = rng.df_trandom(world->raws.language.translations.size()); output.language = rng.df_trandom(world->raws.language.translations.size());
int r, r2, r3; int r, r2, r3;
switch (mode)
{
case language_name_type::Figure:
case language_name_type::FigureNoFirst:
case language_name_type::FigureFirstOnly:
if (mode != 9)
{
int32_t word; df::part_of_speech part;
output.first_name.clear();
selectWord(table1, word, part, 2);
if (word >= 0 && size_t(word) < world->raws.language.words.size())
output.first_name = *world->raws.language.translations[language]->words[word];
}
if (mode != 10)
{
case language_name_type::Site:
case language_name_type::Monument:
if (rng.df_trandom(2))
{
selectWord(table2, output.words[0], output.parts_of_speech[0], 0);
selectWord(table1, output.words[1], output.parts_of_speech[1], 1);
}
else
{
selectWord(table1, output.words[0], output.parts_of_speech[0], 0);
selectWord(table2, output.words[1], output.parts_of_speech[1], 1);
}
}
break;
case language_name_type::Artifact:
case language_name_type::Unk13:
case language_name_type::River:
r = rng.df_trandom(3); r = rng.df_trandom(3);
if (r == 0 || r == 1) if (r == 0 || r == 1)
{ {
@ -218,9 +182,6 @@ void generateName(df::language_name &output, int language, df::language_name_typ
} }
if (r == 1 || r == 2) if (r == 1 || r == 2)
{ {
case language_name_type::Squad:
case language_name_type::LegendaryFigure:
case language_name_type::ArtImage: // this is not a typo either
r2 = rng.df_trandom(2); r2 = rng.df_trandom(2);
if (r2) if (r2)
selectWord(table1, output.words[5], output.parts_of_speech[5], 2); selectWord(table1, output.words[5], output.parts_of_speech[5], 2);
@ -259,97 +220,6 @@ void generateName(df::language_name &output, int language, df::language_name_typ
else else
selectWord(table2, output.words[4], output.parts_of_speech[4], 4); selectWord(table2, output.words[4], output.parts_of_speech[4], 4);
} }
if ((mode == 3) && (output.parts_of_speech[5] == part_of_speech::Noun) && (output.words[5] != -1) && (world->raws.language.words[output.words[5]]->forms[1].length()))
output.parts_of_speech[5] = part_of_speech::NounPlural;
break;
case language_name_type::Civilization:
case language_name_type::World:
case language_name_type::Region:
case language_name_type::AdventuringGroup:
case language_name_type::SiteGovernment:
case language_name_type::NomadicGroup:
case language_name_type::Vessel:
case language_name_type::MilitaryUnit:
case language_name_type::Religion:
case language_name_type::MountainPeak:
case language_name_type::Temple:
case language_name_type::Keep:
case language_name_type::MeadHall:
case language_name_type::Unk24:
case language_name_type::Unk25:
case language_name_type::Unk26:
case language_name_type::Market:
case language_name_type::Tavern:
case language_name_type::War:
case language_name_type::Battle:
case language_name_type::Siege:
case language_name_type::Road:
case language_name_type::Wall:
case language_name_type::Bridge:
case language_name_type::Tunnel:
case language_name_type::PretentiousEntityPosition:
case language_name_type::Tomb:
case language_name_type::OutcastGroup:
selectWord(table1, output.words[5], output.parts_of_speech[5], 2);
r3 = rng.df_trandom(3);
if (rng.df_trandom(50))
r3 = rng.df_trandom(2);
switch (r3)
{
case 0:
case 2:
selectWord(table2, output.words[6], output.parts_of_speech[6], 5);
if (r3 == 0)
break;
case 1:
selectWord(table2, output.words[2], output.parts_of_speech[2], 3);
if (!(rng.df_trandom(100)))
selectWord(table2, output.words[3], output.parts_of_speech[3], 3);
break;
}
if (rng.df_trandom(100))
selectWord(table2, output.words[4], output.parts_of_speech[4], 4);
break;
case language_name_type::Dungeon:
r = rng.df_trandom(3);
if (r == 0 || r == 1)
{
selectWord(table2, output.words[0], output.parts_of_speech[0], 0);
selectWord(table1, output.words[1], output.parts_of_speech[1], 1);
}
if (r == 1 || r == 2)
{
r2 = rng.df_trandom(2);
if (r == 2 || r2 == 1)
selectWord(table1, output.words[5], output.parts_of_speech[5], 2);
else
selectWord(table2, output.words[5], output.parts_of_speech[5], 2);
r3 = rng.df_trandom(3);
if (rng.df_trandom(50))
r3 = rng.df_trandom(2);
switch (r3)
{
case 0:
case 2:
selectWord(table1, output.words[6], output.parts_of_speech[6], 5);
if (r3 == 0)
break;
case 1:
selectWord(table2, output.words[2], output.parts_of_speech[2], 3);
if (!(rng.df_trandom(100)))
selectWord(table2, output.words[3], output.parts_of_speech[3], 3);
break;
}
}
if (rng.df_trandom(100))
selectWord(table2, output.words[4], output.parts_of_speech[4], 4);
break;
default:
// not handled yet
break;
}
if (output.words[2] != -1 && output.words[3] != -1 && if (output.words[2] != -1 && output.words[3] != -1 &&
world->raws.language.words[output.words[3]]->adj_dist < world->raws.language.words[output.words[2]]->adj_dist) world->raws.language.words[output.words[3]]->adj_dist < world->raws.language.words[output.words[2]]->adj_dist)
{ {
@ -1351,10 +1221,10 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
// Generate the artifact's name // Generate the artifact's name
if (type == mood_type::Fell || type == mood_type::Macabre) if (type == mood_type::Fell || type == mood_type::Macabre)
generateName(unit->status.artifact_name, unit->name.language, language_name_type::Artifact, world->raws.language.word_table[0][2], world->raws.language.word_table[1][2]); generateName(unit->status.artifact_name, unit->name.language, world->raws.language.word_table[0][2], world->raws.language.word_table[1][2]);
else else
{ {
generateName(unit->status.artifact_name, unit->name.language, language_name_type::Artifact, world->raws.language.word_table[0][1], world->raws.language.word_table[1][1]); generateName(unit->status.artifact_name, unit->name.language, world->raws.language.word_table[0][1], world->raws.language.word_table[1][1]);
if (!rng.df_trandom(100)) if (!rng.df_trandom(100))
unit->status.artifact_name = unit->name; unit->status.artifact_name = unit->name;
} }