| 291 | ////////////////////////////////////////////////////////////////////////// |
| 292 | |
| 293 | void InventoryUtilities::UpdateWeight(CUIStatic& wnd, bool withPrefix) |
| 294 | { |
| 295 | CInventoryOwner* pInvOwner = smart_cast<CInventoryOwner*>(Level().CurrentEntity()); |
| 296 | R_ASSERT(pInvOwner); |
| 297 | string128 buf{}; |
| 298 | |
| 299 | float total = pInvOwner->inventory().CalcTotalWeight(); |
| 300 | float max = pInvOwner->MaxCarryWeight(); |
| 301 | |
| 302 | string16 cl{}; |
| 303 | |
| 304 | if (total > max) |
| 305 | { |
| 306 | strcpy_s(cl, "%c[red]"); |
| 307 | } |
| 308 | else |
| 309 | { |
| 310 | strcpy_s(cl, "%c[UI_orange]"); |
| 311 | } |
| 312 | |
| 313 | string32 prefix{}; |
| 314 | |
| 315 | if (withPrefix) |
| 316 | { |
| 317 | sprintf_s(prefix, "%%c[default]%s ", *CStringTable().translate("ui_inv_weight")); |
| 318 | } |
| 319 | else |
| 320 | { |
| 321 | strcpy_s(prefix, ""); |
| 322 | } |
| 323 | |
| 324 | sprintf_s(buf, "%s%s%3.1f %s/%5.1f", prefix, cl, total, "%c[UI_orange]", max); |
| 325 | wnd.SetText(buf); |
| 326 | // UIStaticWeight.ClipperOff(); |
| 327 | } |
| 328 | |
| 329 | ////////////////////////////////////////////////////////////////////////// |
| 330 |
nothing calls this directly
no test coverage detected