Use MessageQueue to show whether the replay file is saved successfully

This commit is contained in:
Benau 2016-02-11 13:42:25 +08:00
parent 1278394740
commit ece95cbb81
11 changed files with 28 additions and 7 deletions

View File

@ -81,6 +81,10 @@ when the border that intersect at this corner are enabled.
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="generic-message" image="forest/generic.png"
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="forest/glassbutton.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>

View File

@ -80,6 +80,10 @@ when the border that intersect at this corner are enabled.
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="generic-message" image="ocean/generic.png"
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="ocean/glassbutton.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>

View File

@ -80,6 +80,10 @@ when the border that intersect at this corner are enabled.
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="generic-message" image="peach/generic.png"
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="peach/glassbutton.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>

View File

@ -81,6 +81,10 @@ when the border that intersect at this corner are enabled.
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="generic-message" image="ruby/generic.png"
left_border="128" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>
<element type="button" state="neutral" image="ruby/glassbutton.png"
left_border="13" right_border="13" top_border="13" bottom_border="13"
preserve_h_aspect_ratios="true" hborder_out_portion="0" vborder_out_portion="0"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
data/skins/ruby/generic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -54,6 +54,8 @@ public:
m_render_type = "achievement-message::neutral";
else if (mt==MessageQueue::MT_ERROR)
m_render_type = "error-message::neutral";
else if (mt==MessageQueue::MT_GENERIC)
m_render_type = "generic-message::neutral";
else
m_render_type = "friend-message::neutral";
} // Message

View File

@ -34,7 +34,7 @@ namespace MessageQueue
* different look. This type is used to sort the messages, so it is
* important that messages that need to be shown as early as possible
* will be listed last (i.e. have highest priority). */
enum MessageType { MT_FRIEND, MT_ACHIEVEMENT, MT_ERROR};
enum MessageType { MT_FRIEND, MT_ACHIEVEMENT, MT_ERROR, MT_GENERIC};
void add(MessageType mt, const core::stringw &message);
void updatePosition();

View File

@ -20,6 +20,7 @@
#include "config/stk_config.hpp"
#include "io/file_manager.hpp"
#include "guiengine/message_queue.hpp"
#include "karts/ghost_kart.hpp"
#include "modes/world.hpp"
#include "physics/btKart.hpp"
@ -190,23 +191,25 @@ void ReplayRecorder::save()
{
if (m_incorrect_replay || !m_complete_replay)
{
Log::warn("ReplayRecorder", "Incomplete replay file will not be saved.");
MessageQueue::add(MessageQueue::MT_ERROR,
_("Incomplete replay file will not be saved."));
return;
}
#ifdef DEBUG
printf("%d frames, %d removed because of frequency compression\n",
m_count, m_count_skipped_time);
Log::debug("ReplayRecorder", "%d frames, %d removed because of"
"frequency compression", m_count, m_count_skipped_time);
#endif
FILE *fd = openReplayFile(/*writeable*/true);
if (!fd)
{
Log::error("ReplayRecorder", "Can't open '%s' for writing - can't save replay data.",
getReplayFilename().c_str());
Log::error("ReplayRecorder", "Can't open '%s' for writing - "
"can't save replay data.", getReplayFilename().c_str());
return;
}
Log::info("ReplayRecorder", "Replay saved in '%s'.\n", getReplayFilename().c_str());
core::stringw msg = _("Replay saved in \"%s\".", getReplayFilename().c_str());
MessageQueue::add(MessageQueue::MT_GENERIC, msg);
fprintf(fd, "reverse: %d\n", (int)race_manager->getReverseTrack());
World *world = World::getWorld();