* Get unit's name. * An aliens name is the translation of it's race and rank. * hence the language pointer needed. * @param lang Pointer to language. * @param debugAppendId Append unit ID to name for debug purposes. * @return name Widecharstring of the unit's name. */
| 2117 | * @return name Widecharstring of the unit's name. |
| 2118 | */ |
| 2119 | std::wstring BattleUnit::getName(Language *lang, bool debugAppendId) const |
| 2120 | { |
| 2121 | if (_type != "SOLDIER" && lang != 0) |
| 2122 | { |
| 2123 | std::wstring ret; |
| 2124 | |
| 2125 | if (_type.find("STR_") != std::string::npos) |
| 2126 | ret = lang->getString(_type); |
| 2127 | else |
| 2128 | ret = lang->getString(_race); |
| 2129 | |
| 2130 | if (debugAppendId) |
| 2131 | { |
| 2132 | std::wostringstream ss; |
| 2133 | ss << ret << L" " << _id; |
| 2134 | ret = ss.str(); |
| 2135 | } |
| 2136 | return ret; |
| 2137 | } |
| 2138 | |
| 2139 | return _name; |
| 2140 | } |
| 2141 | /** |
| 2142 | * Gets pointer to the unit's stats. |
| 2143 | * @return stats Pointer to the unit's stats. |