Merge lp:~widelands-dev/widelands/bug-1304638-firstfix into lp:widelands

Proposed by Teppo Mäenpää
Status: Merged
Merged at revision: 6943
Proposed branch: lp:~widelands-dev/widelands/bug-1304638-firstfix
Merge into: lp:widelands
Diff against target: 73 lines (+8/-7)
3 files modified
src/sound/sound_handler.cc (+2/-2)
src/ui_basic/panel.cc (+2/-2)
src/wui/gamechatpanel.cc (+4/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1304638-firstfix
Reviewer Review Type Date Requested Status
Tino Approve
SirVer Approve
Review via email: mp+215932@code.launchpad.net

Description of the change

This fixes the bug 1304638. I think.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

Code looks good to me. I will also change the globbing though.

review: Approve
Revision history for this message
Tino (tino79) wrote :

Sounds good to me ;).
Compiles on win32, will merge

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'sound/message_chat_00.ogg' => 'sound/lobby_chat_00.ogg'
2=== renamed file 'sound/message_freshmen_00.ogg' => 'sound/lobby_freshmen_00.ogg'
3=== modified file 'src/sound/sound_handler.cc'
4--- src/sound/sound_handler.cc 2014-03-27 06:29:50 +0000
5+++ src/sound/sound_handler.cc 2014-04-15 18:36:03 +0000
6@@ -215,8 +215,8 @@
7 load_fx_if_needed("sound", "message", "sound/message");
8 load_fx_if_needed("sound/military", "under_attack", "sound/military/under_attack");
9 load_fx_if_needed("sound/military", "site_occupied", "sound/military/site_occupied");
10- load_fx_if_needed("sound", "message_chat", "sound/message_chat");
11- load_fx_if_needed("sound", "message_freshmen", "sound/message_freshmen");
12+ load_fx_if_needed("sound", "lobby_chat", "sound/lobby_chat");
13+ load_fx_if_needed("sound", "lobby_freshmen", "sound/lobby_freshmen");
14 }
15
16 /** Load a sound effect. One sound effect can consist of several audio files
17
18=== modified file 'src/ui_basic/panel.cc'
19--- src/ui_basic/panel.cc 2014-03-09 10:28:39 +0000
20+++ src/ui_basic/panel.cc 2014-04-15 18:36:03 +0000
21@@ -843,11 +843,11 @@
22 }
23 void Panel::play_new_chat_message()
24 {
25- g_sound_handler.play_fx("sound/message_chat", 128, PRIO_ALWAYS_PLAY);
26+ g_sound_handler.play_fx("sound/lobby_chat", 128, PRIO_ALWAYS_PLAY);
27 }
28 void Panel::play_new_chat_member()
29 {
30- g_sound_handler.play_fx("sound/message_freshmen", 128, PRIO_ALWAYS_PLAY);
31+ g_sound_handler.play_fx("sound/lobby_freshmen", 128, PRIO_ALWAYS_PLAY);
32 }
33
34
35
36=== modified file 'src/wui/gamechatpanel.cc'
37--- src/wui/gamechatpanel.cc 2014-04-07 01:51:56 +0000
38+++ src/wui/gamechatpanel.cc 2014-04-15 18:36:03 +0000
39@@ -19,6 +19,7 @@
40
41 #include "wui/gamechatpanel.h"
42
43+#include <cstdint>
44
45 /**
46 * Create a game chat panel
47@@ -32,7 +33,7 @@
48 m_chat (chat),
49 chatbox (this, 0, 0, w, h - 25, "", UI::Align_Left, 1),
50 editbox (this, 0, h - 20, w, 20),
51- chat_message_counter(0)
52+ chat_message_counter(UINT32_MAX)
53 {
54 chatbox.set_scrollmode(UI::Multiline_Textarea::ScrollLog);
55 editbox.ok.connect(boost::bind(&GameChatPanel::keyEnter, this));
56@@ -65,7 +66,7 @@
57 chatbox.set_text(str);
58
59 // If there are new messages, play a sound
60- if (msgs.size() != chat_message_counter)
61+ if (0 < msgs.size() && msgs.size() != chat_message_counter)
62 {
63 // computer generated ones are ignored
64 // Note: if many messages arrive simultaneously,
65@@ -74,7 +75,7 @@
66 if (!msgs.back().sender.empty() && !m_chat.sound_off())
67 {
68 // The latest message is not a system message
69- if (std::string::npos == msgs.back().sender.find("(IRC)"))
70+ if (std::string::npos == msgs.back().sender.find("(IRC)") && chat_message_counter < msgs.size())
71 {
72 // The latest message was not relayed from IRC.
73 // The above built-in string constant should match

Subscribers

People subscribed via source and target branches

to status/vote changes: