* Returns the soldier's full name (and, optionally, statString). * @param statstring Add stat string? * @param maxLength Restrict length to a certain value. * @return Soldier name. */
| 172 | * @return Soldier name. |
| 173 | */ |
| 174 | std::wstring Soldier::getName(bool statstring, unsigned int maxLength) const |
| 175 | { |
| 176 | if (statstring && !_statString.empty()) |
| 177 | { |
| 178 | if (_name.length() + _statString.length() > maxLength) |
| 179 | { |
| 180 | return _name.substr(0, maxLength - _statString.length()) + L"/" + _statString; |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | return _name + L"/" + _statString; |
| 185 | } |
| 186 | } |
| 187 | else |
| 188 | { |
| 189 | return _name; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Changes the soldier's full name. |