Use ntstring for hudmsg

This commit is contained in:
Kp 2015-01-29 04:27:36 +00:00
parent d4117871a1
commit 035c99029e

View file

@ -41,11 +41,12 @@
struct hudmsg struct hudmsg
{ {
fix time; fix time;
char message[HUD_MESSAGE_LENGTH+1]; ntstring<HUD_MESSAGE_LENGTH> message;
hudmsg(const fix& t, const char *m) : template <typename M>
hudmsg(const fix& t, M &&m) :
time(t) time(t)
{ {
snprintf(message, sizeof(message), "%s", m); message.copy_if(m);
} }
}; };
@ -64,7 +65,6 @@ void HUD_clear_messages()
HUD_color = -1; HUD_color = -1;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Writes a message on the HUD and checks its timer. // Writes a message on the HUD and checks its timer.
void HUD_render_message_frame() void HUD_render_message_frame()
@ -184,7 +184,7 @@ static int HUD_init_message_literal_worth_showing(int class_flag, const char *me
if (HUD_messages.count() >= HUD_MAX_NUM_STOR) if (HUD_messages.count() >= HUD_MAX_NUM_STOR)
{ {
std::copy(HUD_messages.begin() + 1, HUD_messages.end(), HUD_messages.begin()); std::move(HUD_messages.begin() + 1, HUD_messages.end(), HUD_messages.begin());
HUD_messages.pop_back(); HUD_messages.pop_back();
} }
fix t; fix t;