MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ShowCostOrIncomeAnimation

Function ShowCostOrIncomeAnimation

src/misc_gui.cpp:513–526  ·  view source on GitHub ↗

* Display animated income or costs on the map. Does nothing if cost is zero. * @param x World X position of the animation location. * @param y World Y position of the animation location. * @param z World Z position of the animation location. * @param cost Estimated cost (or income if negative). */

Source from the content-addressed store, hash-verified

511 * @param cost Estimated cost (or income if negative).
512 */
513void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost)
514{
515 if (cost == 0) {
516 return;
517 }
518 Point pt = RemapCoords(x, y, z);
519 StringID msg = STR_INCOME_FLOAT_COST;
520
521 if (cost < 0) {
522 cost = -cost;
523 msg = STR_INCOME_FLOAT_INCOME;
524 }
525 AddTextEffect(GetEncodedString(msg, cost), pt.x, pt.y, Ticks::DAY_TICKS, TE_RISING);
526}
527
528/**
529 * Display animated feeder income.

Callers 5

CmdChangeBankBalanceFunction · 0.85
InternalPostResultMethod · 0.85
CallVehicleTicksFunction · 0.85
VehicleEnterDepotFunction · 0.85
~CargoPaymentMethod · 0.85

Calls 3

RemapCoordsFunction · 0.85
AddTextEffectFunction · 0.85
GetEncodedStringFunction · 0.70

Tested by

no test coverage detected