UtBS: Use $amount instead of %d in the teaching ability

Part of #4436
This commit is contained in:
Steve Cotton 2021-04-20 14:08:06 +02:00 committed by Steve Cotton
parent ed92ba75fe
commit 93cd645205

View file

@ -52,9 +52,10 @@
-- having a message that tells you that the unit gained 0 XP is simply obnoxious
if xp_to_add > 0 then
student.experience = student.experience + xp_to_add
-- performance-wise, string concatenation is slower than string interpolation
-- but it's way more readable than two nested interpolations...
wesnoth.interface.float_label(student.x, student.y, "<span color='cyan'>" .. tostring(_ "+%d XP"):format(xp_to_add) .. "</span>")
-- po: Floating text shown when Garak's teaching ability transfers experience points
local xp_string = _ "+$amount XP"
xp_string = xp_string:vformat{amount = xp_to_add}
wesnoth.interface.float_label(student.x, student.y, "<span color='cyan'>" .. xp_string .. "</span>")
if student.experience >= student.max_experience then
-- advance unit, animate and fire events
student:advance(true, true)