MCPcopy Create free account
hub / github.com/TurningWheel/Barony / featherChangeChargeEvent

Function featherChangeChargeEvent

src/interface/interface.cpp:21142–21198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21140}
21141
21142void featherChangeChargeEvent(const int player, int chargeAmount, int realCharge)
21143{
21144 auto& featherGUI = GenericGUI[player].featherGUI;
21145 {
21146 bool addedToCurrentTotal = false;
21147 bool isAnimatingValue = ((ticks - featherGUI.animChargeStartTicks) > TICKS_PER_SECOND);
21148 if ( chargeAmount < 0 )
21149 {
21150 if ( featherGUI.changeFeatherCharge < 0
21151 && !isAnimatingValue
21152 && abs(chargeAmount) > 0 )
21153 {
21154 addedToCurrentTotal = true;
21155 if ( realCharge + chargeAmount < 0 )
21156 {
21157 featherGUI.changeFeatherCharge -= realCharge;
21158 }
21159 else
21160 {
21161 featherGUI.changeFeatherCharge += chargeAmount;
21162 }
21163 }
21164 else
21165 {
21166 if ( realCharge + chargeAmount < 0 )
21167 {
21168 featherGUI.changeFeatherCharge = -realCharge;
21169 }
21170 else
21171 {
21172 featherGUI.changeFeatherCharge = chargeAmount;
21173 }
21174 }
21175 }
21176 else
21177 {
21178 if ( featherGUI.changeFeatherCharge > 0
21179 && !isAnimatingValue
21180 && abs(chargeAmount) > 0 )
21181 {
21182 addedToCurrentTotal = true;
21183 featherGUI.changeFeatherCharge += chargeAmount;
21184 }
21185 else
21186 {
21187 featherGUI.changeFeatherCharge = chargeAmount;
21188 }
21189 }
21190 featherGUI.animChargeStartTicks = ticks;
21191 featherGUI.animCharge = 0.0;
21192 featherGUI.animQtyChange = 1.0;
21193 if ( !addedToCurrentTotal )
21194 {
21195 featherGUI.currentFeatherCharge = realCharge;
21196 }
21197 }
21198}
21199

Callers 1

updateFeatherMenuMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected