MCPcopy Create free account
hub / github.com/DFHack/dfhack / setNickname

Method setNickname

library/modules/Translation.cpp:111–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void Translation::setNickname(df::language_name *name, std::string nick)
112{
113 CHECK_NULL_POINTER(name);
114
115 if (!name->has_name)
116 {
117 if (nick.empty())
118 return;
119
120 *name = df::language_name();
121
122 name->language = 0;
123 name->has_name = true;
124 }
125
126 name->nickname = nick;
127
128 // If the nick is empty, check if this made the whole name empty
129 if (name->nickname.empty() && name->first_name.empty())
130 {
131 bool has_words = false;
132 for (int i = 0; i < 7; i++)
133 if (name->words[i] >= 0)
134 has_words = true;
135
136 if (!has_words)
137 name->has_name = false;
138 }
139}
140
141static string translate_word(const df::language_name * name, size_t word_idx) {
142 CHECK_NULL_POINTER(name);

Callers

nothing calls this directly

Calls 2

language_nameClass · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected