From b908c4df2da79adb0108d9d6243a83633eec1cc2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 23 Feb 2012 02:54:43 +0300 Subject: Fix GPL license. Add missing manaplus copyright. --- src/net/beinghandler.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index bc1491ada..66ea6fe17 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -16,8 +16,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program. If not, see . */ #ifndef BEINGHANDLER_H -- cgit v1.2.3-70-g09d2 From a5926417dad1f91966ccacfc5572369d309c59be Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 24 Feb 2012 00:26:56 +0300 Subject: More copyright fixes. --- src/dropshortcut.cpp | 2 +- src/dropshortcut.h | 2 +- src/effectmanager.cpp | 1 + src/effectmanager.h | 1 + src/emoteshortcut.cpp | 1 + src/emoteshortcut.h | 1 + src/gui/botcheckerwindow.cpp | 2 +- src/gui/botcheckerwindow.h | 2 +- src/gui/editdialog.cpp | 2 +- src/gui/editdialog.h | 2 +- src/gui/killstats.cpp | 2 +- src/gui/killstats.h | 2 +- src/gui/setup_keyboard.h | 3 +++ src/gui/setup_theme.cpp | 4 ++-- src/gui/setup_theme.h | 2 +- src/gui/spellpopup.cpp | 2 +- src/gui/spellpopup.h | 2 +- src/gui/statuspopup.cpp | 2 +- src/gui/statuspopup.h | 2 +- src/gui/textcommandeditor.cpp | 2 +- src/gui/textcommandeditor.h | 2 +- src/gui/whoisonline.cpp | 2 +- src/gui/whoisonline.h | 2 +- src/gui/widgets/desktop.cpp | 1 + src/gui/widgets/desktop.h | 1 + src/gui/widgets/dropshortcutcontainer.cpp | 2 +- src/gui/widgets/dropshortcutcontainer.h | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 1 + src/gui/widgets/emoteshortcutcontainer.h | 1 + src/gui/widgets/label.cpp | 1 + src/gui/widgets/label.h | 1 + src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.h | 2 +- src/keyboardconfig.cpp | 2 ++ src/keyboardconfig.h | 2 ++ src/net/beinghandler.h | 2 +- src/net/ea/partyhandler.cpp | 1 + src/net/ea/partyhandler.h | 1 + src/net/tmwa/partyhandler.cpp | 1 + src/net/tmwa/partyhandler.h | 1 + src/resources/emotedb.cpp | 1 + src/resources/emotedb.h | 1 + src/spellmanager.cpp | 2 +- src/spellmanager.h | 2 +- src/spellshortcut.cpp | 2 +- src/spellshortcut.h | 2 +- src/textcommand.cpp | 1 + src/textcommand.h | 2 +- src/textmanager.cpp | 1 + src/textmanager.h | 1 + src/utils/copynpaste.cpp | 2 +- src/utils/copynpaste.h | 2 +- 52 files changed, 57 insertions(+), 31 deletions(-) (limited to 'src/net') diff --git a/src/dropshortcut.cpp b/src/dropshortcut.cpp index f6fd0bc93..410af8739 100644 --- a/src/dropshortcut.cpp +++ b/src/dropshortcut.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/dropshortcut.h b/src/dropshortcut.h index f11123b1b..6a0ef49e9 100644 --- a/src/dropshortcut.h +++ b/src/dropshortcut.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index de12ecaa5..b52d2ac22 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -2,6 +2,7 @@ * An effects manager * Copyright (C) 2008 Fate * Copyright (C) 2008 Chuck Miller + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/effectmanager.h b/src/effectmanager.h index f8babd2f5..7b71069fe 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -2,6 +2,7 @@ * An effects manager * Copyright (C) 2008 Fate * Copyright (C) 2008 Chuck Miller + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/emoteshortcut.cpp b/src/emoteshortcut.cpp index 352c373b5..d0b5d9be5 100644 --- a/src/emoteshortcut.cpp +++ b/src/emoteshortcut.cpp @@ -1,6 +1,7 @@ /* * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h index d7f1e7b79..c47569738 100644 --- a/src/emoteshortcut.h +++ b/src/emoteshortcut.h @@ -1,6 +1,7 @@ /* * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 3ed93e875..2739978cb 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2012 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/botcheckerwindow.h b/src/gui/botcheckerwindow.h index 82b29770f..b1075686f 100644 --- a/src/gui/botcheckerwindow.h +++ b/src/gui/botcheckerwindow.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2012 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp index 178eef970..1bd3ccbf5 100644 --- a/src/gui/editdialog.cpp +++ b/src/gui/editdialog.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h index f3a1d90dd..206a45079 100644 --- a/src/gui/editdialog.h +++ b/src/gui/editdialog.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 1334e1f95..e563b8c7c 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 60438b4d3..67c2967e3 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h index bffa13cf6..5970a7735 100644 --- a/src/gui/setup_keyboard.h +++ b/src/gui/setup_keyboard.h @@ -1,6 +1,9 @@ /* * Custom keyboard shortcuts configuration * Copyright (C) 2007 Joshua Langley + * Copyright (C) 2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index fc83bfac2..d4a1d5652 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -1,8 +1,8 @@ /* * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h index c14957388..496ba2aca 100644 --- a/src/gui/setup_theme.h +++ b/src/gui/setup_theme.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index 06e60604c..9446f7515 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/spellpopup.h b/src/gui/spellpopup.h index 643a14079..e64b510fc 100644 --- a/src/gui/spellpopup.h +++ b/src/gui/spellpopup.h @@ -3,7 +3,7 @@ * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp index 0646fcdda..2d9cc69b6 100644 --- a/src/gui/statuspopup.cpp +++ b/src/gui/statuspopup.cpp @@ -3,7 +3,7 @@ * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h index 9ff1af4c7..e867f0fa9 100644 --- a/src/gui/statuspopup.h +++ b/src/gui/statuspopup.h @@ -3,7 +3,7 @@ * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 10cd7968f..7b9442318 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/textcommandeditor.h b/src/gui/textcommandeditor.h index dd9bfd0ca..39952f353 100644 --- a/src/gui/textcommandeditor.h +++ b/src/gui/textcommandeditor.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 2aec28360..15c8a42c4 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index 49851837e..46fe74f62 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index b40558c78..6352c300f 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -1,6 +1,7 @@ /* * Desktop widget * Copyright (c) 2009-2010 The Mana World Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index b1f059ffe..e4edc8857 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -1,6 +1,7 @@ /* * Desktop widget * Copyright (c) 2009-2010 The Mana World Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 47060cdfb..8c6aec68a 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 3f1af0329..91e436836 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 794357275..8d828a87e 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -1,6 +1,7 @@ /* * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 743ca4e87..f509798bb 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -1,6 +1,7 @@ /* * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 67e8bd12b..640010c62 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (c) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index 775eda18c..f2048c94a 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (c) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 130b245fb..07ecbfaf0 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index c5dacea80..72fec758f 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index ea04a0e89..fc676dab0 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -1,6 +1,8 @@ /* * Custom keyboard shortcuts configuration * Copyright (C) 2007 Joshua Langley + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 1610c1ecd..1c91159ac 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -1,6 +1,8 @@ /* * Custom keyboard shortcuts configuration * Copyright (C) 2007 Joshua Langley + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 66ea6fe17..49ce3a01c 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -1,7 +1,7 @@ /* * The ManaPlus Client * Copyright (C) 2004 The Mana World Development Team - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 556e72c8d..68d712db1 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (C) 2008 Lloyd Bryant + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h index 596fda4f7..f08930e8c 100644 --- a/src/net/ea/partyhandler.h +++ b/src/net/ea/partyhandler.h @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (C) 2008 Lloyd Bryant + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 7f942a206..b8f3a07e1 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (C) 2008 Lloyd Bryant + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 4d727a986..eb3f68a70 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -1,6 +1,7 @@ /* * The ManaPlus Client * Copyright (C) 2008 Lloyd Bryant + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index d6c01af6d..4fe036528 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -1,6 +1,7 @@ /* * Emote database * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index 94d97a872..f739b1ed0 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -1,6 +1,7 @@ /* * Emote database * Copyright (C) 2009 Aethyra Development Team + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 144881a43..1e4c43f1f 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/spellmanager.h b/src/spellmanager.h index cf7e18e85..ae928ee7a 100644 --- a/src/spellmanager.h +++ b/src/spellmanager.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/spellshortcut.cpp b/src/spellshortcut.cpp index bf4a62a98..27ccc1646 100644 --- a/src/spellshortcut.cpp +++ b/src/spellshortcut.cpp @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers. + * Copyright (C) 2011-2012 The ManaPlus developers. * * This file is part of The ManaPlus Client. * diff --git a/src/spellshortcut.h b/src/spellshortcut.h index e0e722524..f3e5611e4 100644 --- a/src/spellshortcut.h +++ b/src/spellshortcut.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/textcommand.cpp b/src/textcommand.cpp index 48dc86dab..ec9e97f61 100644 --- a/src/textcommand.cpp +++ b/src/textcommand.cpp @@ -2,6 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/textcommand.h b/src/textcommand.h index 12f7e0760..7cab06317 100644 --- a/src/textcommand.h +++ b/src/textcommand.h @@ -2,7 +2,7 @@ * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 ManaPlus developers + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/textmanager.cpp b/src/textmanager.cpp index 6c73d00b4..3cd36e449 100644 --- a/src/textmanager.cpp +++ b/src/textmanager.cpp @@ -1,6 +1,7 @@ /* * Support for non-overlapping floating text * Copyright (C) 2008 Douglas Boffey + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/textmanager.h b/src/textmanager.h index 1ed88883a..220f30da3 100644 --- a/src/textmanager.h +++ b/src/textmanager.h @@ -1,6 +1,7 @@ /* * Support for non-overlapping floating text * Copyright (C) 2008 Douglas Boffey + * Copyright (C) 2011-2012 The ManaPlus developers * * This file is part of The ManaPlus Client. * diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 49934c7be..90e0c5c93 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -1,7 +1,7 @@ /* * Retrieve string pasted depending on OS mechanisms. * Copyright (C) 2001-2010 Wormux Team - * Copyright (C) 2011-2012 ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * diff --git a/src/utils/copynpaste.h b/src/utils/copynpaste.h index e2bd0558c..5e95a1152 100644 --- a/src/utils/copynpaste.h +++ b/src/utils/copynpaste.h @@ -1,7 +1,7 @@ /* * Retrieve string pasted depending on OS mechanisms. * Copyright (C) 2001-2010 Wormux Team - * Copyright (C) 2011-2012 ManaPlus Developers + * Copyright (C) 2011-2012 The ManaPlus Developers * * This file is part of The ManaPlus Client. * -- cgit v1.2.3-70-g09d2 From 490a93a1d7a347ab586637bf9d8163e114285a02 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 24 Feb 2012 22:21:02 +0300 Subject: Add safe error string reporting function. --- src/client.cpp | 4 ++-- src/gui/setup_video.cpp | 2 +- src/logger.cpp | 30 +++++++++++++++++++++++++++++- src/logger.h | 7 +++++++ src/net/manaserv/network.cpp | 8 ++++---- src/net/tmwa/network.cpp | 2 +- 6 files changed, 44 insertions(+), 9 deletions(-) (limited to 'src/net') diff --git a/src/client.cpp b/src/client.cpp index 242bb2f21..978c58eef 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -363,7 +363,7 @@ void Client::gameInit() logger->log1("Initializing SDL..."); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { - logger->error(strprintf("Could not initialize SDL: %s", + logger->safeError(strprintf("Could not initialize SDL: %s", SDL_GetError())); } atexit(SDL_Quit); @@ -555,7 +555,7 @@ void Client::gameInit() if (!mainGraphics->setVideoMode(oldWidth, oldHeight, bpp, oldFullscreen, hwaccel, enableResize, noFrame)) { - logger->error(strprintf("Couldn't restore %dx%dx%d " + logger->safeError(strprintf("Couldn't restore %dx%dx%d " "video mode: %s", oldWidth, oldHeight, bpp, SDL_GetError())); } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index ae7e7a9cc..eff04614d 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -383,7 +383,7 @@ void Setup_Video::apply() " and restoration of old mode also " "failed!") << std::endl; } - logger->error(errorMsg.str()); + logger->safeError(errorMsg.str()); } } #if defined(WIN32) || defined(__APPLE__) diff --git a/src/logger.cpp b/src/logger.cpp index 8eba8fdb9..3c439136b 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -189,6 +189,34 @@ void Logger::log(const char *log_text, ...) delete [] buf; } +// here string must be safe for any usage +void Logger::safeError(const std::string &error_text) +{ + log("Error: %s", error_text.c_str()); +#ifdef WIN32 + MessageBox(nullptr, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); +#elif defined __APPLE__ +// Str255 msg; +// CFStringRef error; +// error = CFStringCreateWithCString(nullptr, +// error_text.c_str(), +// kCFStringEncodingMacRoman); +// CFStringGetPascalString(error, msg, 255, kCFStringEncodingMacRoman); +// StandardAlert(kAlertStopAlert, +// (const unsigned char*)"\pError", +// (ConstStr255Param) msg, nullptr, nullptr); +#elif defined __linux__ || __linux + std::cerr << "Error: " << error_text << std::endl; + std::string msg = "xmessage \"" + error_text + "\""; + if (system(msg.c_str()) == -1) + std::cerr << "Error: " << error_text << std::endl; +#else + std::cerr << "Error: " << error_text << std::endl; +#endif + exit(1); +} + +// here string can be unsafe strings void Logger::error(const std::string &error_text) { log("Error: %s", error_text.c_str()); @@ -206,7 +234,7 @@ void Logger::error(const std::string &error_text) // (ConstStr255Param) msg, nullptr, nullptr); #elif defined __linux__ || __linux std::cerr << "Error: " << error_text << std::endl; - std::string msg = "xmessage \"Error happand. Please see log file for more information.\""; + std::string msg = "xmessage \"Error happend. Please see log file for more information.\""; if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; #else diff --git a/src/logger.h b/src/logger.h index db618b275..3dc24420d 100644 --- a/src/logger.h +++ b/src/logger.h @@ -98,6 +98,13 @@ class Logger */ void error(const std::string &error_text) __attribute__ ((noreturn)); + /** + * Log an error and quit. The error will pop-up on Windows and Mac, and + * will be printed to standard error everywhere else. + */ + void safeError(const std::string &error_text) + __attribute__ ((noreturn)); + private: std::ofstream mLogFile; bool mLogToStandardOut; diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index 84e71eaf3..a75da3643 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -54,7 +54,7 @@ void initialize() { if (enet_initialize()) { - logger->error("Failed to initialize ENet."); + logger->safeError("Failed to initialize ENet."); } #if defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF @@ -65,7 +65,7 @@ void initialize() if (!client) { - logger->error("Failed to create the local host."); + logger->safeError("Failed to create the local host."); } } @@ -76,7 +76,7 @@ void finalize() if (connections) { - logger->error("Tried to shutdown the network subsystem while there " + logger->safeError("Tried to shutdown the network subsystem while there " "are network connections left!"); } @@ -88,7 +88,7 @@ Connection *getConnection() { if (!client) { - logger->error("Tried to instantiate a network object before " + logger->safeError("Tried to instantiate a network object before " "initializing the network subsystem!"); } diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 6e9e367c0..b8ba7554e 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -236,7 +236,7 @@ void Network::dispatchMessages() MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); if (msg.getLength() == 0) - logger->error("Zero length packet received. Exiting."); + logger->safeError("Zero length packet received. Exiting."); if (iter != mMessageHandlers.end()) { -- cgit v1.2.3-70-g09d2 From 6317f3e0c1e2c6d2e88dd99443e7f45f7bb77f44 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 25 Feb 2012 19:35:14 +0300 Subject: Fix code style. --- src/guichan/include/guichan/sdl/sdlpixel.hpp | 3 ++- src/logger.cpp | 3 ++- src/net/manaserv/network.cpp | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/net') diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp index bfd08341b..f56100b4a 100644 --- a/src/guichan/include/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp @@ -124,7 +124,8 @@ namespace gcn SDL_LockSurface(surface); - Uint8 *p = static_cast(surface->pixels) + y * surface->pitch + x * bpp; + Uint8 *p = static_cast(surface->pixels) + + y * surface->pitch + x * bpp; Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b); diff --git a/src/logger.cpp b/src/logger.cpp index 3c439136b..9c9c6efef 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -234,7 +234,8 @@ void Logger::error(const std::string &error_text) // (ConstStr255Param) msg, nullptr, nullptr); #elif defined __linux__ || __linux std::cerr << "Error: " << error_text << std::endl; - std::string msg = "xmessage \"Error happend. Please see log file for more information.\""; + std::string msg = "xmessage \"Error happend. " + "Please see log file for more information.\""; if (system(msg.c_str()) == -1) std::cerr << "Error: " << error_text << std::endl; #else diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index a75da3643..05041c56a 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -76,8 +76,8 @@ void finalize() if (connections) { - logger->safeError("Tried to shutdown the network subsystem while there " - "are network connections left!"); + logger->safeError("Tried to shutdown the network subsystem " + "while there are network connections left!"); } clearNetworkHandlers(); -- cgit v1.2.3-70-g09d2 From 81db0022e50e25d922ac7d67d9ec6017b8856f13 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 25 Feb 2012 21:28:51 +0300 Subject: Fix old casts. --- src/being.cpp | 2 +- src/configuration.cpp | 3 ++- src/graphics.cpp | 23 +++++++++++++-------- src/gui/charcreatedialog.cpp | 10 +++++++-- src/gui/debugwindow.cpp | 2 +- src/gui/editserverdialog.cpp | 3 ++- src/gui/equipmentwindow.cpp | 10 +++++++-- src/gui/itempopup.cpp | 2 +- src/gui/outfitwindow.cpp | 2 +- src/gui/popupmenu.cpp | 2 +- src/gui/serverdialog.cpp | 4 ++-- src/gui/setup_relations.cpp | 2 +- src/gui/updaterwindow.cpp | 4 ++-- src/gui/viewport.cpp | 3 ++- src/gui/widgets/browserbox.cpp | 22 ++++++++++---------- src/gui/widgets/guitable.cpp | 9 ++++---- src/gui/widgets/setupitem.cpp | 4 ++-- src/gui/widgets/textfield.cpp | 2 +- src/guichan/include/guichan/sdl/sdlpixel.hpp | 4 ++-- src/guichan/sdl/sdlgraphics.cpp | 23 ++++++++++++++------- src/guichan/sdl/sdlimage.cpp | 4 ++-- src/guichan/widgets/scrollarea.cpp | 8 +++---- src/guichan/widgets/slider.cpp | 4 ++-- src/guichan/widgets/tabbedarea.cpp | 2 +- src/guichan/widgets/textbox.cpp | 31 ++++++++++++++-------------- src/guichan/widgets/window.cpp | 2 +- src/guildmanager.cpp | 6 +++--- src/localplayer.cpp | 2 +- src/net/messagein.cpp | 2 +- src/net/tmwa/playerhandler.cpp | 4 ++-- src/opengl1graphics.cpp | 6 ++++-- src/openglgraphics.cpp | 10 +++++---- src/utils/copynpaste.cpp | 10 +++++++-- src/utils/langs.cpp | 8 +++---- src/utils/physfsrwops.cpp | 22 ++++++++++---------- src/utils/process.cpp | 6 +++--- src/utils/stringutils.cpp | 6 +++--- 37 files changed, 153 insertions(+), 116 deletions(-) (limited to 'src/net') diff --git a/src/being.cpp b/src/being.cpp index e1cb9b0ae..b5f55592f 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2320,7 +2320,7 @@ void Being::recalcSpritesOrder() int val = slotRemap.at(slot); int id = 0; - if ((int)mSpriteIDs.size() > val) + if (static_cast(mSpriteIDs.size()) > val) id = mSpriteIDs[val]; int idx = -1; diff --git a/src/configuration.cpp b/src/configuration.cpp index 694f94e78..97540c385 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -572,7 +572,8 @@ void ConfigurationObject::writeToXML(XmlTextWriterPtr writer) elt_it != it->second.end(); ++elt_it) { xmlTextWriterStartElement(writer, BAD_CAST name); - (*elt_it)->writeToXML(writer); + if (*elt_it) + (*elt_it)->writeToXML(writer); xmlTextWriterEndElement(writer); } diff --git a/src/graphics.cpp b/src/graphics.cpp index 5241bbcc6..e6841fa5c 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -845,7 +845,8 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 1: for (y = y1; y < y2; y++) { - Uint8 *p = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p = static_cast(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) *(p + x) = pixel; } @@ -853,12 +854,14 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 2: for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 2; - *(Uint16 *)p = gcn::SDLAlpha16( - pixel, *(Uint32 *)p, mColor.a, mTarget->format); + *reinterpret_cast(p) = gcn::SDLAlpha16( + pixel, *reinterpret_cast(p), + mColor.a, mTarget->format); } } break; @@ -871,7 +874,8 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 3; @@ -896,18 +900,19 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) const unsigned a1 = (255 - mColor.a); for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 4; - Uint32 dst = *(Uint32 *)p; + Uint32 dst = *reinterpret_cast(p); const unsigned int b = (pb + (dst & 0xff) * a1) >> 8; const unsigned int g = (pg + (dst & 0xff00) * a1) >> 8; const unsigned int r = (pr + (dst & 0xff0000) * a1) >> 8; - *(Uint32 *)p = ((b & 0xff) | (g & 0xff00) - | (r & 0xff0000)); + *reinterpret_cast(p) = ((b & 0xff) + | (g & 0xff00) | (r & 0xff0000)); } } break; diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 8d4767a15..9f7436ad8 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -474,8 +474,11 @@ void CharCreateDialog::updateHair() mHairStyle %= Being::getNumOfHairstyles(); if (mHairStyle < 0) mHairStyle += Being::getNumOfHairstyles(); - if (mHairStyle < (signed)minHairStyle || mHairStyle > (signed)maxHairStyle) + if (mHairStyle < static_cast(minHairStyle) + || mHairStyle > static_cast(maxHairStyle)) + { mHairStyle = minHairStyle; + } const ItemInfo &item = ItemDB::get(-mHairStyle); mHairStyleNameLabel->setCaption(item.getName()); mHairStyleNameLabel->adjustSize(); @@ -483,8 +486,11 @@ void CharCreateDialog::updateHair() mHairColor %= ColorDB::getHairSize(); if (mHairColor < 0) mHairColor += ColorDB::getHairSize(); - if (mHairColor < (signed)minHairColor || mHairColor > (signed)maxHairColor) + if (mHairColor < static_cast(minHairColor) + || mHairColor > static_cast(maxHairColor)) + { mHairColor = minHairColor; + } mHairColorNameLabel->setCaption(ColorDB::getHairColorName(mHairColor)); mHairColorNameLabel->adjustSize(); diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index b65068dc5..fa01b5aa8 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -390,7 +390,7 @@ void NetDebugTab::logic() if (player_node && player_node->getPingTime() != 0) { mPingLabel->setCaption(strprintf(_("Ping: %s ms"), - toString((int)player_node->getPingTime()).c_str())); + toString(static_cast(player_node->getPingTime())).c_str())); } else { diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index 8a4a9579d..53e31c3c8 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -184,7 +184,8 @@ void EditServerDialog::action(const gcn::ActionEvent &event) mServer.name = mNameField->getText(); mServer.description = mDescriptionField->getText(); mServer.hostname = mServerAddressField->getText(); - mServer.port = (short) atoi(mPortField->getText().c_str()); + mServer.port = static_cast(atoi( + mPortField->getText().c_str())); if (mTypeField) { diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 275bf19bb..89063c3dc 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -407,8 +407,11 @@ void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset) const int imageIndex = XML::getProperty(slotNode, "image", -1); Image *image = nullptr; - if (imageset && imageIndex >= 0 && imageIndex < (signed)imageset->size()) + if (imageset && imageIndex >= 0 && imageIndex + < static_cast(imageset->size())) + { image = imageset->get(imageIndex); + } if (mBoxes[slot]) { @@ -510,8 +513,11 @@ void EquipmentWindow::addBox(int idx, int x, int y, int imageIndex) { Image *image = nullptr; - if (mImageSet && imageIndex >= 0 && imageIndex < (signed)mImageSet->size()) + if (mImageSet && imageIndex >= 0 && imageIndex + < static_cast(mImageSet->size())) + { image = mImageSet->get(imageIndex); + } mBoxes[idx] = new EquipmentBox(x + getPadding(), y + getTitleBarHeight(), image); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index d96aa564f..f33f77e83 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -123,7 +123,7 @@ void ItemPopup::setItem(const Item *item, bool showImage) } mItemName->adjustSize(); unsigned minWidth = mItemName->getWidth() + 8; - if ((unsigned)getWidth() < minWidth) + if (static_cast(getWidth()) < minWidth) setWidth(minWidth); } } diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 73484f1d5..6eaa2ac4e 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -190,7 +190,7 @@ void OutfitWindow::save() outfitStr += toString(res); if (i < OUTFIT_ITEM_COUNT - 1) outfitStr += " "; - outfitColorsStr += toString((int)mItemColors[o][i]); + outfitColorsStr += toString(static_cast(mItemColors[o][i])); if (i < OUTFIT_ITEM_COUNT - 1) outfitColorsStr += " "; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c987843d3..933d2c7cd 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -2205,7 +2205,7 @@ void PlayerListener::action(const gcn::ActionEvent &event) { std::string comment = mDialog->getText(); Being* being = actorSpriteManager->findBeingByName( - mNick, (ActorSprite::Type)mType); + mNick, static_cast(mType)); if (being) being->setComment(comment); Being::saveComment(mNick, comment, mType); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index da61e105b..ed9696892 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -125,7 +125,7 @@ std::string ServersListModel::getElementAt(int elementIndex) void ServersListModel::setVersionString(int index, const std::string &version) { - if (index >= (int)mVersionStrings.size()) + if (index >= static_cast(mVersionStrings.size())) return; if (version.empty()) @@ -632,7 +632,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, // Make sure the current server is mentioned first if (currentServer.isValid()) { - if (index >= 0 && (unsigned)index < mServers.size()) + if (index >= 0 && static_cast(index) < mServers.size()) { mServers[index] = currentServer; } diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 47d53620c..f3b664c9b 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -194,7 +194,7 @@ public: std::string getPlayerAt(int index) const { - if (index < 0 || index >= (signed)mPlayers->size()) + if (index < 0 || index >= static_cast(mPlayers->size())) return ""; return (*mPlayers)[index]; } diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 3aaf93557..fe26d42eb 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -554,8 +554,8 @@ void UpdaterWindow::logic() if (mUpdateFiles.size() && mUpdateIndex <= mUpdateFiles.size()) { mProgressBar->setText(strprintf("%d/%d", mUpdateIndex - + mUpdateIndexOffset + 1, (int)mUpdateFiles.size() - + (int)mTempUpdateFiles.size() + 1)); + + mUpdateIndexOffset + 1, static_cast(mUpdateFiles.size()) + + static_cast(mTempUpdateFiles.size()) + 1)); } else { diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index d4c188bfb..0c0f0d3d9 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -199,7 +199,8 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // if (debugChatTab) // debugChatTab->chatLog("incorrect player position!"); logger->log("incorrect player position: %d, %d, %d, %d", - player_x, player_y, (int)mPixelViewX, (int)mPixelViewY); + player_x, player_y, static_cast(mPixelViewX), + static_cast(mPixelViewY)); if (player_node) { logger->log("tile position: %d, %d", diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 5856a91b1..47c5616b6 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -232,15 +232,17 @@ void BrowserBox::addRow(const std::string &row, bool atTop) tempRow.substr(nextChar, (nextSpacePos - nextChar))); - if ((x + nextWordWidth + 10) > (unsigned)getWidth()) + if ((x + nextWordWidth + 10) + > static_cast(getWidth())) { x = 15; // Ident in new line y += 1; - j++; + j ++; } } // Wrapping looong lines (brutal force) - else if ((x + 2 * hyphenWidth) > (unsigned)getWidth()) + else if ((x + 2 * hyphenWidth) + > static_cast(getWidth())) { x = 15; // Ident in new line y += 1; @@ -249,7 +251,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop) } setHeight(font->getHeight() * (static_cast( - mTextRows.size()) + y)); + mTextRows.size()) + y)); } else { @@ -423,7 +425,7 @@ int BrowserBox::calcHeight() if (row.find("---", 0) == 0) { const int dashWidth = fontWidthMinus; - for (x = 0; x < (unsigned)getWidth(); x++) + for (x = 0; x < static_cast(getWidth()); x ++) { mLineParts.push_back(LinePart(x, y, selColor, "-", false)); x += dashWidth - 2; @@ -557,9 +559,8 @@ int BrowserBox::calcHeight() width = font->getWidth(part); // Auto wrap mode - if (mMode == AUTO_WRAP && getWidth() > 0 - && width > 0 - && (x + width + 10) > (unsigned)getWidth()) + if (mMode == AUTO_WRAP && getWidth() > 0 && width > 0 + && (x + width + 10) > static_cast(getWidth())) { bool forced = false; @@ -592,9 +593,8 @@ int BrowserBox::calcHeight() else width = font->getWidth(part); } - while (end > start && width > 0 - && (x + width + 10) - > (unsigned)getWidth()); + while (end > start && width > 0 && (x + width + 10) + > static_cast(getWidth())); if (forced) { diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index d620cbb8d..6434f5453 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -348,14 +348,15 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mSelectedRow > 0) { - if (mLinewiseMode && r == (unsigned)mSelectedRow && c == 0) + if (mLinewiseMode && r == static_cast( + mSelectedRow) && c == 0) { graphics->fillRectangle(gcn::Rectangle(0, y_offset, - getWidth(), height)); + getWidth(), height)); } else if (!mLinewiseMode && mSelectedColumn > 0 - && c == (unsigned)mSelectedColumn - && r == (unsigned)mSelectedRow) + && c == static_cast(mSelectedColumn) + && r == static_cast(mSelectedRow)) { graphics->fillRectangle(gcn::Rectangle( x_offset, y_offset, width, height)); diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 490c046c3..8987719da 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -830,8 +830,8 @@ void SetupItemSlider2::updateLabel() int val = mSlider->getValue() - mMin; if (val < 0) val = 0; - else if (val >= (signed)mValues->size()) - val = (signed)mValues->size() - 1; + else if (val >= static_cast(mValues->size())) + val = static_cast(mValues->size()) - 1; std::string str = mValues->at(val); mLabel2->setCaption(str); } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index e207b0613..a90712340 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -183,7 +183,7 @@ int TextField::getValue() const if (value < mMinimum) return mMinimum; - if (value > (signed)mMaximum) + if (value > static_cast(mMaximum)) return mMaximum; return value; diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp index f56100b4a..23298ef37 100644 --- a/src/guichan/include/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp @@ -244,8 +244,8 @@ namespace gcn break; case 2: - *reinterpret_cast(p) = SDLAlpha16(pixel, *(Uint32 *)p, - color.a, surface->format); + *reinterpret_cast(p) = SDLAlpha16(pixel, + *reinterpret_cast(p), color.a, surface->format); break; case 3: diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index c8cec6370..ae61a0432 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -283,7 +283,8 @@ namespace gcn SDL_LockSurface(mTarget); - Uint8 *p = (Uint8 *)mTarget->pixels + y * mTarget->pitch + x1 * bpp; + Uint8 *p = static_cast(mTarget->pixels) + + y * mTarget->pitch + x1 * bpp; Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, @@ -298,7 +299,7 @@ namespace gcn case 2: { - Uint16* q = (Uint16*)p; + Uint16* q = reinterpret_cast(p); for (; x1 <= x2; ++x1) *(q++) = pixel; break; @@ -329,7 +330,7 @@ namespace gcn case 4: { - Uint32* q = (Uint32*)p; + Uint32 *q = reinterpret_cast(p); for (; x1 <= x2; ++x1) { if (mAlpha) @@ -395,7 +396,8 @@ namespace gcn SDL_LockSurface(mTarget); - Uint8 *p = (Uint8 *)mTarget->pixels + y1 * mTarget->pitch + x * bpp; + Uint8 *p = static_cast(mTarget->pixels) + + y1 * mTarget->pitch + x * bpp; Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); @@ -411,9 +413,9 @@ namespace gcn break; case 2: - for (; y1 <= y2; ++y1) + for (; y1 <= y2; ++ y1) { - *(Uint16*)p = pixel; + *reinterpret_cast(p) = pixel; p += mTarget->pitch; } break; @@ -445,9 +447,14 @@ namespace gcn for (; y1 <= y2; ++y1) { if (mAlpha) - *(Uint32*)p = SDLAlpha32(pixel, *(Uint32*)p, mColor.a); + { + *reinterpret_cast(p) = SDLAlpha32(pixel, + *reinterpret_cast(p), mColor.a); + } else - *(Uint32*)p = pixel; + { + *reinterpret_cast(p) = pixel; + } p += mTarget->pitch; } break; diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp index 4f9b9565c..cf8505c4e 100644 --- a/src/guichan/sdl/sdlimage.cpp +++ b/src/guichan/sdl/sdlimage.cpp @@ -142,8 +142,8 @@ namespace gcn { Uint8 r, g, b, a; - SDL_GetRGBA(((unsigned int*)mSurface->pixels)[i], mSurface->format, - &r, &g, &b, &a); + SDL_GetRGBA((static_cast(mSurface->pixels)[i]), + mSurface->format, &r, &g, &b, &a); if (a != 255) { diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp index 451288c77..21f7b5930 100644 --- a/src/guichan/widgets/scrollarea.cpp +++ b/src/guichan/widgets/scrollarea.cpp @@ -325,12 +325,12 @@ namespace gcn if (y < getVerticalMarkerDimension().y) { setVerticalScrollAmount(getVerticalScrollAmount() - - (int)(getChildrenArea().height * 0.95)); + - static_cast(getChildrenArea().height * 0.95)); } else { setVerticalScrollAmount(getVerticalScrollAmount() - + (int)(getChildrenArea().height * 0.95)); + + static_cast(getChildrenArea().height * 0.95)); } } else if (getHorizontalMarkerDimension().isPointInRect(x, y)) @@ -345,12 +345,12 @@ namespace gcn if (x < getHorizontalMarkerDimension().x) { setHorizontalScrollAmount(getHorizontalScrollAmount() - - (int)(getChildrenArea().width * 0.95)); + - static_cast(getChildrenArea().width * 0.95)); } else { setHorizontalScrollAmount(getHorizontalScrollAmount() - + (int)(getChildrenArea().width * 0.95)); + + static_cast(getChildrenArea().width * 0.95)); } } } diff --git a/src/guichan/widgets/slider.cpp b/src/guichan/widgets/slider.cpp index 16f7cd8be..36f067eab 100644 --- a/src/guichan/widgets/slider.cpp +++ b/src/guichan/widgets/slider.cpp @@ -245,7 +245,7 @@ namespace gcn else w = getHeight(); - double pos = v / ((double)w - getMarkerLength()); + double pos = v / (static_cast(w) - getMarkerLength()); return (1.0 - pos) * getScaleStart() + pos * getScaleEnd(); } @@ -257,7 +257,7 @@ namespace gcn else v = getHeight(); - int w = (int)((v - getMarkerLength()) + int w = static_cast((v - getMarkerLength()) * (value - getScaleStart()) / (getScaleEnd() - getScaleStart())); diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp index 7af00c4c4..3e7178548 100644 --- a/src/guichan/widgets/tabbedarea.cpp +++ b/src/guichan/widgets/tabbedarea.cpp @@ -320,7 +320,7 @@ namespace gcn int index = getSelectedTabIndex(); index++; - if (index >= (int)mTabs.size()) + if (index >= static_cast(mTabs.size())) return; else setSelectedTab(mTabs[index].first); diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp index e78ea91a3..c2cd5586f 100644 --- a/src/guichan/widgets/textbox.cpp +++ b/src/guichan/widgets/textbox.cpp @@ -155,7 +155,7 @@ namespace gcn { mCaretRow = mouseEvent.getY() / getFont()->getHeight(); - if (mCaretRow >= (int)mTextRows.size()) + if (mCaretRow >= static_cast(mTextRows.size())) mCaretRow = mTextRows.size() - 1; mCaretColumn = getFont()->getStringIndexAt( @@ -193,11 +193,11 @@ namespace gcn else if (key.getValue() == Key::RIGHT) { ++mCaretColumn; - if (mCaretColumn > (int)mTextRows[mCaretRow].size()) + if (mCaretColumn > static_cast(mTextRows[mCaretRow].size())) { - ++mCaretRow; + ++ mCaretRow; - if (mCaretRow >= (int)mTextRows.size()) + if (mCaretRow >= static_cast(mTextRows.size())) { mCaretRow = mTextRows.size() - 1; if (mCaretRow < 0) @@ -254,14 +254,15 @@ namespace gcn --mCaretRow; } else if (key.getValue() == Key::DELETE - && mCaretColumn < (int)mTextRows[mCaretRow].size() - && mEditable) + && mCaretColumn < static_cast( + mTextRows[mCaretRow].size()) && mEditable) { mTextRows[mCaretRow].erase(mCaretColumn, 1); } else if (key.getValue() == Key::DELETE - && mCaretColumn == (int)mTextRows[mCaretRow].size() - && mCaretRow < ((int)mTextRows.size() - 1) + && mCaretColumn == static_cast( + mTextRows[mCaretRow].size()) + && mCaretRow < (static_cast(mTextRows.size()) - 1) && mEditable) { mTextRows[mCaretRow] += mTextRows[mCaretRow + 1]; @@ -291,7 +292,7 @@ namespace gcn / getFont()->getHeight(); mCaretRow += rowsPerPage; - if (mCaretRow >= (int)mTextRows.size()) + if (mCaretRow >= static_cast(mTextRows.size())) mCaretRow = mTextRows.size() - 1; } } @@ -305,7 +306,7 @@ namespace gcn && mEditable) { mTextRows[mCaretRow].insert(mCaretColumn, - std::string(1, (char)key.getValue())); + std::string(1, static_cast(key.getValue()))); ++ mCaretColumn; } @@ -332,9 +333,7 @@ namespace gcn void TextBox::setCaretPosition(unsigned int position) { - int row; - - for (row = 0; row < (int)mTextRows.size(); row++) + for (int row = 0; row < static_cast(mTextRows.size()); row ++) { if (position <= mTextRows[row].size()) { @@ -373,7 +372,7 @@ namespace gcn { mCaretRow = row; - if (mCaretRow >= (int)mTextRows.size()) + if (mCaretRow >= static_cast(mTextRows.size())) mCaretRow = mTextRows.size() - 1; if (mCaretRow < 0) @@ -391,7 +390,7 @@ namespace gcn { mCaretColumn = column; - if (mCaretColumn > (int)mTextRows[mCaretRow].size()) + if (mCaretColumn > static_cast(mTextRows[mCaretRow].size())) mCaretColumn = mTextRows[mCaretRow].size(); if (mCaretColumn < 0) @@ -431,7 +430,7 @@ namespace gcn int i; std::string text; - for (i = 0; i < (int)mTextRows.size() - 1; ++i) + for (i = 0; i < static_cast(mTextRows.size()) - 1; ++ i) text = text + mTextRows[i] + "\n"; text = text + mTextRows[i]; diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp index d7c5809e6..c7ed8a69e 100644 --- a/src/guichan/widgets/window.cpp +++ b/src/guichan/widgets/window.cpp @@ -137,7 +137,7 @@ namespace gcn mDragOffsetX = mouseEvent.getX(); mDragOffsetY = mouseEvent.getY(); - mMoved = mouseEvent.getY() <= (int)mTitleBarHeight; + mMoved = mouseEvent.getY() <= static_cast(mTitleBarHeight); } void Window::mouseReleased(MouseEvent& mouseEvent A_UNUSED) diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 9dc9d7b73..08af3b2c7 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -274,7 +274,7 @@ bool GuildManager::process(std::string msg) return false; // logger->log("welcome message: %s", msg.c_str()); int pos = msg.find("! ("); - if (pos == (int)std::string::npos) + if (pos == static_cast(std::string::npos)) return false; msg = msg.substr(0, pos); guild->setName(msg); @@ -299,7 +299,7 @@ bool GuildManager::process(std::string msg) return false; pos = msg.find(", Guild:"); - if (pos == (int)std::string::npos) + if (pos == static_cast(std::string::npos)) return false; int level = atoi(msg.substr(0, pos).c_str()); @@ -310,7 +310,7 @@ bool GuildManager::process(std::string msg) msg = msg.substr(pos + strlen(", Guild:")); pos = msg.find(", No. Of Online Players: "); - if (pos == (int)std::string::npos) + if (pos == static_cast(std::string::npos)) return false; msg = msg.substr(0, pos); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index b07511196..5114f868c 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2064,7 +2064,7 @@ std::string LocalPlayer::getQuickDropCounterString() void LocalPlayer::setQuickDropCounter(int n) { - if (n < 1 || n >= (signed)quickDropCounterSize) + if (n < 1 || n >= static_cast(quickDropCounterSize)) return; mQuickDropCounter = n; config.setValue("quickDropCounter", mQuickDropCounter); diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 0547ed337..5d15d26ac 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -265,7 +265,7 @@ unsigned char *MessageIn::readBytes(int length) #ifdef ENABLEDEBUGLOG std::string str; for (int f = 0; f < length; f ++) - str += strprintf ("%02x", (unsigned)buf[f]); + str += strprintf ("%02x", static_cast(buf[f])); str += " "; for (int f = 0; f < length; f ++) { diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index bfe9eea42..a63af770a 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -229,7 +229,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) return; } - char *start = (char*)msg.readBytes(size); + char *start = reinterpret_cast(msg.readBytes(size)); if (!start) return; @@ -265,7 +265,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) gender = GENDER_FEMALE; } } - arr.push_back(new OnlinePlayer((char*)buf, + arr.push_back(new OnlinePlayer(static_cast(buf), status, level, gender, ver)); buf += strlen(buf) + 1; } diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index 34e9fcda3..ea4d5e6f3 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -393,8 +393,10 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y, // Draw a set of textured rectangles glBegin(GL_QUADS); - const float scaleFactorW = (float) scaledWidth / image->getWidth(); - const float scaleFactorH = (float) scaledHeight / image->getHeight(); + const float scaleFactorW = static_cast(scaledWidth) + / image->getWidth(); + const float scaleFactorH = static_cast(scaledHeight) + / image->getHeight(); for (int py = 0; py < h; py += ih) { diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index bcf46e18b..d972a738f 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -554,8 +554,10 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, { int width = (px + scaledWidth >= w) ? w - px : scaledWidth; int dstX = x + px; - const float visibleFractionW = (float) width / scaledWidth; - const float visibleFractionH = (float) height / scaledHeight; + const float visibleFractionW = static_cast(width) + / scaledWidth; + const float visibleFractionH = static_cast(height) + / scaledHeight; const float texX2 = texX1 + tFractionW * visibleFractionW; const float texY2 = texY1 + tFractionH * visibleFractionH; @@ -597,8 +599,8 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, } else { - const float scaleFactorW = (float) scaledWidth / iw; - const float scaleFactorH = (float) scaledHeight / ih; + const float scaleFactorW = static_cast(scaledWidth) / iw; + const float scaleFactorH = static_cast(scaledHeight) / ih; for (int py = 0; py < h; py += scaledHeight) { diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 90e0c5c93..763b579d0 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -442,9 +442,15 @@ bool runxsel(std::string& text, const char *p1, const char *p2) close(fd[0]); } if (p2) - execl("/usr/bin/xsel", "xsel", p1, p2, (char *)nullptr); + { + execl("/usr/bin/xsel", "xsel", p1, p2, + static_cast(nullptr)); + } else - execl("/usr/bin/xsel", "xsel", p1, (char *)nullptr); + { + execl("/usr/bin/xsel", "xsel", p1, + static_cast(nullptr)); + } exit(1); } diff --git a/src/utils/langs.cpp b/src/utils/langs.cpp index 2efbd781a..c1f9f7ecf 100644 --- a/src/utils/langs.cpp +++ b/src/utils/langs.cpp @@ -44,11 +44,11 @@ std::vector getLang() } int dot = lang.find("."); - if (dot != (signed)std::string::npos) + if (dot != static_cast(std::string::npos)) lang = lang.substr(0, dot); langs.push_back(lang); dot = lang.find("_"); - if (dot != (signed)std::string::npos) + if (dot != static_cast(std::string::npos)) langs.push_back(lang.substr(0, dot)); return langs; } @@ -78,10 +78,10 @@ std::string getLangShort() } int dot = lang.find("."); - if (dot != (signed)std::string::npos) + if (dot != static_cast(std::string::npos)) lang = lang.substr(0, dot); dot = lang.find("_"); - if (dot != (signed)std::string::npos) + if (dot != static_cast(std::string::npos)) return lang.substr(0, dot); return lang; } diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index 1960f0dee..2675b89ae 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -29,7 +29,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence) { - PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1; + PHYSFS_file *handle = static_cast(rw->hidden.unknown.data1); int pos = 0; if (whence == SEEK_SET) @@ -46,8 +46,8 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence) return -1; } /* if */ - pos = (int)current; - if (((PHYSFS_sint64)pos) != current) + pos = static_cast(current); + if (static_cast(pos) != current) { SDL_SetError("Can't fit current file position in an int!"); return -1; @@ -67,8 +67,8 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence) return -1; } /* if */ - pos = (int)len; - if (((PHYSFS_sint64)pos) != len) + pos = static_cast(len); + if (static_cast(pos) != len) { SDL_SetError("Can't fit end-of-file position in an int!"); return -1; @@ -88,7 +88,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence) return -1; } /* if */ - if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos)) + if (!PHYSFS_seek(handle, static_cast(pos))) { SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); return -1; @@ -99,7 +99,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence) static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum) { - PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1; + PHYSFS_file *handle = static_cast(rw->hidden.unknown.data1); PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum); if (rc != maxnum) { @@ -107,22 +107,22 @@ static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum) SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); } /* if */ - return (int)rc; + return static_cast(rc); } /* physfsrwops_read */ static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num) { - PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1; + PHYSFS_file *handle = static_cast(rw->hidden.unknown.data1); PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num); if (rc != num) SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); - return (int) rc; + return static_cast(rc); } /* physfsrwops_write */ static int physfsrwops_close(SDL_RWops *rw) { - PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1; + PHYSFS_file *handle = static_cast(rw->hidden.unknown.data1); if (!PHYSFS_close(handle)) { SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError()); diff --git a/src/utils/process.cpp b/src/utils/process.cpp index fd0ec0fa8..0106c597d 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -112,12 +112,12 @@ int execFile(std::string pathName, std::string name, if (arg2.empty()) { execl(pathName.c_str(), name.c_str(), - arg1.c_str(), (char *)nullptr); + arg1.c_str(), static_cast(nullptr)); } else { - execl(pathName.c_str(), name.c_str(), - arg1.c_str(), arg2.c_str(), (char *)nullptr); + execl(pathName.c_str(), name.c_str(), arg1.c_str(), + arg2.c_str(), static_cast(nullptr)); } exit(-1); } diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 2f478a909..5a7ea87fd 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -522,9 +522,9 @@ std::string stringToHexPath(const std::string &str) if (str.empty()) return ""; - std::string hex = strprintf("%%%2x/", (int)str[0]); + std::string hex = strprintf("%%%2x/", static_cast(str[0])); for (unsigned f = 1; f < str.size(); f ++) - hex += strprintf("%%%2x", (int)str[f]); + hex += strprintf("%%%2x", static_cast(str[f])); return hex; } @@ -600,7 +600,7 @@ bool findCutFirst(std::string &str1, std::string str2) std::string &removeProtocol(std::string &url) { int i = url.find("://"); - if (i != (int)std::string::npos) + if (i != static_cast(std::string::npos)) url = url.substr(i + 3); return url; } -- cgit v1.2.3-70-g09d2 From c85d939d9b3f6c10288dc86ffa7811408e349657 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2012 02:14:15 +0300 Subject: Add different sound effects for different events. Can be configured in audio tab in settings. --- data/sfx/system/CMakeLists.txt | 16 ++++++++++++ data/sfx/system/Makefile.am | 18 +++++++++++++- data/sfx/system/attention.ogg | Bin 0 -> 10439 bytes data/sfx/system/chat1.ogg | Bin 0 -> 8270 bytes data/sfx/system/chat2.ogg | Bin 0 -> 6341 bytes data/sfx/system/complete.ogg | Bin 0 -> 13971 bytes data/sfx/system/email.ogg | Bin 0 -> 21002 bytes data/sfx/system/error.ogg | Bin 0 -> 7192 bytes data/sfx/system/finish.ogg | Bin 0 -> 12576 bytes data/sfx/system/incoming.ogg | Bin 0 -> 15903 bytes data/sfx/system/move.ogg | Bin 0 -> 6443 bytes data/sfx/system/notify.ogg | Bin 0 -> 9485 bytes data/sfx/system/offline.ogg | Bin 0 -> 7119 bytes data/sfx/system/online.ogg | Bin 0 -> 7883 bytes data/sfx/system/reminder.ogg | Bin 0 -> 7279 bytes data/sfx/system/send.ogg | Bin 0 -> 8205 bytes data/sfx/system/start.ogg | Bin 0 -> 8597 bytes data/sfx/system/watcher.ogg | Bin 0 -> 8919 bytes src/client.cpp | 15 +++++++----- src/defaults.cpp | 7 ++++++ src/game.cpp | 6 ++--- src/gui/changeemaildialog.cpp | 3 ++- src/gui/changepassworddialog.cpp | 3 ++- src/gui/charcreatedialog.cpp | 4 +-- src/gui/charselectdialog.cpp | 2 +- src/gui/confirmdialog.cpp | 2 +- src/gui/editserverdialog.cpp | 2 +- src/gui/okdialog.cpp | 10 +++++++- src/gui/okdialog.h | 11 +++++++-- src/gui/register.cpp | 2 +- src/gui/setup_audio.cpp | 50 ++++++++++++++++++++++++++++++++++++++ src/gui/setup_audio.h | 5 ++++ src/gui/setup_keyboard.cpp | 2 +- src/gui/setup_theme.cpp | 4 +-- src/gui/setup_video.cpp | 16 +++++++----- src/gui/shopwindow.cpp | 2 +- src/gui/socialwindow.cpp | 6 ++--- src/gui/unregisterdialog.cpp | 3 ++- src/gui/widgets/chattab.cpp | 2 +- src/gui/widgets/setupitem.cpp | 40 ++++++++++++++++++++++++++++-- src/gui/widgets/setupitem.h | 21 +++++++++++++++- src/gui/widgets/sliderlist.h | 3 +++ src/localplayer.cpp | 5 ++-- src/net/ea/charserverhandler.cpp | 4 +-- src/net/ea/gamehandler.cpp | 2 +- src/net/ea/playerhandler.cpp | 7 +++--- src/net/manaserv/beinghandler.cpp | 3 ++- src/net/manaserv/charhandler.cpp | 4 +-- src/sound.cpp | 6 +++++ src/sound.h | 2 ++ 50 files changed, 237 insertions(+), 51 deletions(-) create mode 100644 data/sfx/system/attention.ogg create mode 100644 data/sfx/system/chat1.ogg create mode 100644 data/sfx/system/chat2.ogg create mode 100644 data/sfx/system/complete.ogg create mode 100644 data/sfx/system/email.ogg create mode 100644 data/sfx/system/error.ogg create mode 100644 data/sfx/system/finish.ogg create mode 100644 data/sfx/system/incoming.ogg create mode 100644 data/sfx/system/move.ogg create mode 100644 data/sfx/system/notify.ogg create mode 100644 data/sfx/system/offline.ogg create mode 100644 data/sfx/system/online.ogg create mode 100644 data/sfx/system/reminder.ogg create mode 100644 data/sfx/system/send.ogg create mode 100644 data/sfx/system/start.ogg create mode 100644 data/sfx/system/watcher.ogg (limited to 'src/net') diff --git a/data/sfx/system/CMakeLists.txt b/data/sfx/system/CMakeLists.txt index bf6f0f0f3..0fa325a45 100644 --- a/data/sfx/system/CMakeLists.txt +++ b/data/sfx/system/CMakeLists.txt @@ -1,5 +1,21 @@ SET (FILES + attention.ogg + chat1.ogg + chat2.ogg + complete.ogg + email.ogg + error.ogg + finish.ogg + incoming.ogg + move.ogg + notify.ogg newmessage.ogg + offline.ogg + online.ogg + reminder.ogg + send.ogg + start.ogg + watcher.ogg ) INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/sfx/system) diff --git a/data/sfx/system/Makefile.am b/data/sfx/system/Makefile.am index e744932c3..d46934461 100644 --- a/data/sfx/system/Makefile.am +++ b/data/sfx/system/Makefile.am @@ -1,7 +1,23 @@ systemdir = $(pkgdatadir)/data/sfx/system system_DATA = \ - newmessage.ogg + attention.ogg \ + chat1.ogg \ + chat2.ogg \ + complete.ogg \ + email.ogg \ + error.ogg \ + finish.ogg \ + incoming.ogg \ + move.ogg \ + newmessage.ogg \ + notify.ogg \ + offline.ogg \ + online.ogg \ + reminder.ogg \ + send.ogg \ + start.ogg \ + watcher.ogg EXTRA_DIST = \ $(system_DATA) \ diff --git a/data/sfx/system/attention.ogg b/data/sfx/system/attention.ogg new file mode 100644 index 000000000..929265775 Binary files /dev/null and b/data/sfx/system/attention.ogg differ diff --git a/data/sfx/system/chat1.ogg b/data/sfx/system/chat1.ogg new file mode 100644 index 000000000..ad6c52a1d Binary files /dev/null and b/data/sfx/system/chat1.ogg differ diff --git a/data/sfx/system/chat2.ogg b/data/sfx/system/chat2.ogg new file mode 100644 index 000000000..155b15e1f Binary files /dev/null and b/data/sfx/system/chat2.ogg differ diff --git a/data/sfx/system/complete.ogg b/data/sfx/system/complete.ogg new file mode 100644 index 000000000..0975ff7c8 Binary files /dev/null and b/data/sfx/system/complete.ogg differ diff --git a/data/sfx/system/email.ogg b/data/sfx/system/email.ogg new file mode 100644 index 000000000..afb25909f Binary files /dev/null and b/data/sfx/system/email.ogg differ diff --git a/data/sfx/system/error.ogg b/data/sfx/system/error.ogg new file mode 100644 index 000000000..69dccfe7c Binary files /dev/null and b/data/sfx/system/error.ogg differ diff --git a/data/sfx/system/finish.ogg b/data/sfx/system/finish.ogg new file mode 100644 index 000000000..d8dbbf80f Binary files /dev/null and b/data/sfx/system/finish.ogg differ diff --git a/data/sfx/system/incoming.ogg b/data/sfx/system/incoming.ogg new file mode 100644 index 000000000..a8ff86676 Binary files /dev/null and b/data/sfx/system/incoming.ogg differ diff --git a/data/sfx/system/move.ogg b/data/sfx/system/move.ogg new file mode 100644 index 000000000..e5c703bbf Binary files /dev/null and b/data/sfx/system/move.ogg differ diff --git a/data/sfx/system/notify.ogg b/data/sfx/system/notify.ogg new file mode 100644 index 000000000..95d8fed4a Binary files /dev/null and b/data/sfx/system/notify.ogg differ diff --git a/data/sfx/system/offline.ogg b/data/sfx/system/offline.ogg new file mode 100644 index 000000000..cc1b8e938 Binary files /dev/null and b/data/sfx/system/offline.ogg differ diff --git a/data/sfx/system/online.ogg b/data/sfx/system/online.ogg new file mode 100644 index 000000000..3e55793fd Binary files /dev/null and b/data/sfx/system/online.ogg differ diff --git a/data/sfx/system/reminder.ogg b/data/sfx/system/reminder.ogg new file mode 100644 index 000000000..d7beeed6f Binary files /dev/null and b/data/sfx/system/reminder.ogg differ diff --git a/data/sfx/system/send.ogg b/data/sfx/system/send.ogg new file mode 100644 index 000000000..b5941323d Binary files /dev/null and b/data/sfx/system/send.ogg differ diff --git a/data/sfx/system/start.ogg b/data/sfx/system/start.ogg new file mode 100644 index 000000000..0b1f85643 Binary files /dev/null and b/data/sfx/system/start.ogg differ diff --git a/data/sfx/system/watcher.ogg b/data/sfx/system/watcher.ogg new file mode 100644 index 000000000..9a0dd1af2 Binary files /dev/null and b/data/sfx/system/watcher.ogg differ diff --git a/src/client.cpp b/src/client.cpp index 978c58eef..5f79176c7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1327,14 +1327,16 @@ int Client::gameExec() case STATE_LOGIN_ERROR: logger->log1("State: LOGIN ERROR"); - mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog = new OkDialog(_("Error"), + errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&loginListener); mCurrentDialog = nullptr; // OkDialog deletes itself break; case STATE_ACCOUNTCHANGE_ERROR: logger->log1("State: ACCOUNT CHANGE ERROR"); - mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog = new OkDialog(_("Error"), + errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); mCurrentDialog = nullptr; // OkDialog deletes itself break; @@ -1370,7 +1372,7 @@ int Client::gameExec() case STATE_CHANGEPASSWORD_SUCCESS: logger->log1("State: CHANGE PASSWORD SUCCESS"); mCurrentDialog = new OkDialog(_("Password Change"), - _("Password changed successfully!")); + _("Password changed successfully!"), DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); mCurrentDialog = nullptr; // OkDialog deletes itself loginData.password = loginData.newPassword; @@ -1390,7 +1392,7 @@ int Client::gameExec() case STATE_CHANGEEMAIL_SUCCESS: logger->log1("State: CHANGE EMAIL SUCCESS"); mCurrentDialog = new OkDialog(_("Email Change"), - _("Email changed successfully!")); + _("Email changed successfully!"), DIALOG_ERROR); mCurrentDialog->addActionListener(&accountListener); mCurrentDialog = nullptr; // OkDialog deletes itself break; @@ -1411,7 +1413,7 @@ int Client::gameExec() Net::getLoginHandler()->disconnect(); mCurrentDialog = new OkDialog(_("Unregister Successful"), - _("Farewell, come back any time...")); + _("Farewell, come back any time..."), DIALOG_ERROR); loginData.clear(); //The errorlistener sets the state to STATE_CHOOSE_SERVER mCurrentDialog->addActionListener(&errorListener); @@ -1468,7 +1470,8 @@ int Client::gameExec() case STATE_ERROR: logger->log1("State: ERROR"); logger->log("Error: %s\n", errorMessage.c_str()); - mCurrentDialog = new OkDialog(_("Error"), errorMessage); + mCurrentDialog = new OkDialog(_("Error"), + errorMessage, DIALOG_ERROR); mCurrentDialog->addActionListener(&errorListener); mCurrentDialog = nullptr; // OkDialog deletes itself Net::getGameHandler()->disconnect(); diff --git a/src/defaults.cpp b/src/defaults.cpp index 01907bfe8..cd2911192 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -229,6 +229,13 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "grabinput", false); AddDEF(configData, "gamma", 1); AddDEF(configData, "vsync", 0); + AddDEF(configData, "soundwhisper", "newmessage"); + AddDEF(configData, "soundhighlight", "reminder"); + AddDEF(configData, "soundglobal", "email"); + AddDEF(configData, "sounderror", "error"); + AddDEF(configData, "soundtrade", "start"); + AddDEF(configData, "soundinfo", "notify"); + AddDEF(configData, "soundrequest", "attention"); return configData; } diff --git a/src/game.cpp b/src/game.cpp index e016d02ff..ae8682972 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -561,7 +561,7 @@ void Game::logic() { errorMessage = _("The connection to the server was lost."); disconnectedDialog = new OkDialog(_("Network Error"), - errorMessage, false); + errorMessage, DIALOG_ERROR, false); disconnectedDialog->addActionListener(&errorListener); disconnectedDialog->requestMoveToTop(); } @@ -1796,8 +1796,8 @@ void Game::changeMap(const std::string &mapPath) if (!newMap) { logger->log("Error while loading %s", fullMap.c_str()); - new OkDialog(_("Could Not Load Map"), - strprintf(_("Error while loading %s"), fullMap.c_str())); + new OkDialog(_("Could Not Load Map"), strprintf( + _("Error while loading %s"), fullMap.c_str()), DIALOG_ERROR); } if (mCurrentMap) diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 518ed3da1..1a468d44f 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -154,7 +154,8 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) else if (error == 2) mWrongDataNoticeListener->setTarget(this->mSecondEmailField); - OkDialog *dlg = new OkDialog(_("Error"), errorMsg.str()); + OkDialog *dlg = new OkDialog(_("Error"), + errorMsg.str(), DIALOG_ERROR); if (dlg) dlg->addActionListener(mWrongDataNoticeListener); } diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 8082b8d58..a58d8616b 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -144,7 +144,8 @@ void ChangePasswordDialog::action(const gcn::ActionEvent &event) else if (error == 3) mWrongDataNoticeListener->setTarget(this->mSecondPassField); - OkDialog *dlg = new OkDialog(_("Error"), errorMsg.str()); + OkDialog *dlg = new OkDialog(_("Error"), + errorMsg.str(), DIALOG_ERROR); dlg->addActionListener(mWrongDataNoticeListener); } else diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 9f7436ad8..124476f1c 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -270,8 +270,8 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) else { new OkDialog(_("Error"), - _("Your name needs to be at least 4 characters."), - true, this); + _("Your name needs to be at least 4 characters."), + DIALOG_ERROR, true, this); } } else if (id == "cancel") diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index d2b74a632..b1b8009a4 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -253,7 +253,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) } else { - new OkDialog(_("Error"), _("Incorrect password")); + new OkDialog(_("Error"), _("Incorrect password"), DIALOG_ERROR); } mDeleteIndex = -1; } diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index 22acf5116..b6645db3c 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -97,7 +97,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, } setVisible(true); yesButton->requestFocus(); - sound.playGuiSfx("system/newmessage.ogg"); + sound.playGuiSound("soundrequest"); } void ConfirmDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp index 53e31c3c8..ca1afeaba 100644 --- a/src/gui/editserverdialog.cpp +++ b/src/gui/editserverdialog.cpp @@ -173,7 +173,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event) { OkDialog *dlg = new OkDialog(_("Error"), _("Please at least type both the address and the port " - "of the server.")); + "of the server."), DIALOG_ERROR); dlg->addActionListener(this); } else diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index 4a3bdf731..fe22cf008 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -22,6 +22,8 @@ #include "gui/okdialog.h" +#include "sound.h" + #include "gui/gui.h" #include "gui/widgets/button.h" @@ -34,7 +36,8 @@ #include "debug.h" OkDialog::OkDialog(const std::string &title, const std::string &msg, - bool modal, bool showCenter, Window *parent): + int soundEvent, bool modal, bool showCenter, + Window *parent): Window(title, modal, parent, "ok.xml") { mTextBox = new TextBox; @@ -71,6 +74,11 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, centerHorisontally(); setVisible(true); okButton->requestFocus(); + + if (soundEvent == DIALOG_OK) + sound.playGuiSound("soundinfo"); + else if (soundEvent == DIALOG_ERROR) + sound.playGuiSound("sounderror"); } void OkDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/okdialog.h b/src/gui/okdialog.h index 5705be568..b6f17480b 100644 --- a/src/gui/okdialog.h +++ b/src/gui/okdialog.h @@ -31,6 +31,13 @@ class TextBox; +enum +{ + DIALOG_OK = 0, + DIALOG_ERROR, + DIALOG_SILENCE +}; + /** * An 'Ok' button dialog. * @@ -45,8 +52,8 @@ class OkDialog : public Window, public gcn::ActionListener * @see Window::Window */ OkDialog(const std::string &title, const std::string &msg, - bool modal = true, bool showCenter = true, - Window *parent = nullptr); + int soundEvent = DIALOG_OK, bool modal = true, + bool showCenter = true, Window *parent = nullptr); /** * Called when receiving actions from the widgets. diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 2122e0d6b..bf0cb299e 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -225,7 +225,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) mWrongDataNoticeListener->setTarget(this->mPasswordField); } - OkDialog *dlg = new OkDialog(_("Error"), errorMsg); + OkDialog *dlg = new OkDialog(_("Error"), errorMsg, DIALOG_ERROR); dlg->addActionListener(mWrongDataNoticeListener); } else diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 1f7db484c..a4c3110d9 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -25,9 +25,11 @@ #include "configuration.h" #include "sound.h" +#include "gui/theme.h" #include "gui/viewport.h" #include "gui/widgets/layouthelper.h" +#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" @@ -35,6 +37,19 @@ #include "debug.h" +class SoundsModel : public NamesModel +{ +public: + SoundsModel() + { + mNames.push_back(gettext("(no sound)")); + Theme::fillSoundsList(mNames); + } + + virtual ~SoundsModel() + { } +}; + Setup_Audio::Setup_Audio() { setName(_("Audio")); @@ -44,6 +59,10 @@ Setup_Audio::Setup_Audio() ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, mScroll, 10, 10); + mSoundModel = new SoundsModel(); + + new SetupItemLabel(_("Basic settings"), "", this); + new SetupItemCheckBox(_("Enable Audio"), "", "sound", this, "soundEvent"); new SetupItemCheckBox(_("Enable music"), "", @@ -61,6 +80,31 @@ Setup_Audio::Setup_Audio() new SetupItemSlider(_("Music volume"), "", "musicVolume", this, "musicVolumeEvent", 0, sound.getMaxVolume(), 150, true); + new SetupItemLabel(_("Sound effects"), "", this); + + new SetupItemSound(_("Information dialog sound"), "", + "soundinfo", this, "soundinfoEvent", mSoundModel); + + new SetupItemSound(_("Request dialog sound"), "", + "soundrequest", this, "soundrequestEvent", mSoundModel); + + new SetupItemSound(_("Whisper message sound"), "", + "soundwhisper", this, "soundwhisperEvent", mSoundModel); + + new SetupItemSound(_("Highlight message sound"), "", + "soundhighlight", this, "soundhighlightEvent", mSoundModel); + + new SetupItemSound(_("Global message sound"), "", + "soundglobal", this, "soundglobalEvent", mSoundModel); + + new SetupItemSound(_("Error message sound"), "", + "sounderror", this, "sounderrorEvent", mSoundModel); + + new SetupItemSound(_("Trade request sound"), "", + "soundtrade", this, "soundtradeEvent", mSoundModel); + + new SetupItemLabel(_("Other"), "", this); + new SetupItemCheckBox(_("Enable mumble voice chat"), "", "enableMumble", this, "enableMumbleEvent"); @@ -70,6 +114,12 @@ Setup_Audio::Setup_Audio() setDimension(gcn::Rectangle(0, 0, 550, 350)); } +Setup_Audio::~Setup_Audio() +{ + delete mSoundModel; + mSoundModel = nullptr; +} + void Setup_Audio::apply() { SetupTabScroll::apply(); diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index c08c49c7a..21b661bcb 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.h @@ -34,7 +34,12 @@ class Setup_Audio : public SetupTabScroll public: Setup_Audio(); + ~Setup_Audio(); + void apply(); + + private: + gcn::ListModel *mSoundModel; }; #endif diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index bdd7c2083..ef024c5d9 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -131,7 +131,7 @@ void Setup_Keyboard::apply() if (keyboard.hasConflicts()) { new OkDialog(_("Key Conflict(s) Detected."), - keyboard.getBindError()); + keyboard.getBindError(), DIALOG_ERROR); } keyboard.setEnabled(true); keyboard.store(); diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index d3b9d0e3c..7386f496a 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -349,8 +349,8 @@ void Setup_Theme::apply() if (config.getValue("theme", config.getValue("selectedSkin", "")) != mTheme) { - new OkDialog(_("Theme Changed"), - _("Restart your client for the change to take effect.")); + new OkDialog(_("Theme Changed"), _("Restart your client for " + "the change to take effect.")); } config.setValue("selectedSkin", ""); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 6690f1452..24d42c83d 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -393,7 +393,7 @@ void Setup_Video::apply() else { new OkDialog(_("Switching to Full Screen"), - _("Restart needed for changes to take effect.")); + _("Restart needed for changes to take effect.")); } #endif config.setValue("screen", fullscreen); @@ -406,7 +406,7 @@ void Setup_Video::apply() // OpenGL can currently only be changed by restarting, notify user. new OkDialog(_("Changing to OpenGL"), - _("Applying change to OpenGL requires restart.")); + _("Applying change to OpenGL requires restart.")); } mFps = mFpsCheckBox->isSelected() ? @@ -498,13 +498,17 @@ void Setup_Video::action(const gcn::ActionEvent &event) { #if defined(_WIN32) if (width < mainGraphics->mWidth || height < mainGraphics->mHeight) + { new OkDialog(_("Screen Resolution Changed"), - _("Restart your client for the change to take effect.") - + std::string("\n") + - _("Some windows may be moved to fit the lowered resolution.")); + _("Restart your client for the change to take effect.") + + std::string("\n") + _("Some windows may be moved to " + "fit the lowered resolution.")); + } else + { new OkDialog(_("Screen Resolution Changed"), - _("Restart your client for the change to take effect.")); + _("Restart your client for the change to take effect.")); + } #else Client::resize(width, height); #endif diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 1a27b8b0c..33ab32ca5 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -753,7 +753,7 @@ void ShopWindow::processRequest(std::string nick, std::string data, int mode) if (config.getBoolValue("autoShop")) { - sound.playGuiSfx("system/newmessage.ogg"); + sound.playGuiSound("soundtrade"); startTrade(); } else diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 287089790..f0ac9e128 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1630,13 +1630,13 @@ void SocialWindow::showPartyCreate() if (player_node->getParty()) { new OkDialog(_("Create Party"), - _("Cannot create party. You are already in a party"), - this); + _("Cannot create party. You are already in a party"), + DIALOG_ERROR, true, true, this); return; } mPartyCreateDialog = new TextDialog(_("Party Name"), - _("Choose your party's name."), this); + _("Choose your party's name."), this); mPartyCreateDialog->setActionEventId("create party"); mPartyCreateDialog->addActionListener(this); } diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index ca21263f1..9ba895ec8 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -134,7 +134,8 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) { mWrongDataNoticeListener->setTarget(this->mPasswordField); - OkDialog *dlg = new OkDialog(_("Error"), errorMsg.str()); + OkDialog *dlg = new OkDialog(_("Error"), + errorMsg.str(), DIALOG_ERROR); dlg->addActionListener(mWrongDataNoticeListener); } else diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 018e35030..53842e887 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -301,7 +301,7 @@ void ChatTab::chatLog(std::string line, Own own, && !Client::getInputFocused())))) { if (own != BY_SERVER) - sound.playGuiSfx("system/newmessage.ogg"); + sound.playGuiSound("soundwhisper"); } } } diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 581002a58..9eedfd58d 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -23,6 +23,7 @@ #include "configuration.h" #include "main.h" #include "logger.h" +#include "sound.h" #include "gui/editdialog.h" #include "gui/gui.h" @@ -872,7 +873,7 @@ SetupItemSliderList::SetupItemSliderList(std::string text, mOnTheFly(onTheFly) { mValueType = VSTR; - createControls(); +// createControls(); } SetupItemSliderList::SetupItemSliderList(std::string text, @@ -892,7 +893,7 @@ SetupItemSliderList::SetupItemSliderList(std::string text, mOnTheFly(onTheFly) { mValueType = VSTR; - createControls(); +// createControls(); } SetupItemSliderList::~SetupItemSliderList() @@ -917,6 +918,8 @@ void SetupItemSliderList::createControls() mHorizont->add(mLabel, 5); mHorizont->add(mSlider); + addMoreControls(); + mParent->getContainer()->add2(mHorizont, true, 4); mParent->addControl(this); mParent->addActionListener(this); @@ -954,3 +957,36 @@ void SetupItemSliderList::apply(std::string eventName) fromWidget(); save(); } + +SetupItemSound::SetupItemSound(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, gcn::ListModel *model, + int width, bool onTheFly, bool mainConfig) : + SetupItemSliderList(text, description, keyName, parent, eventName, + model, width, onTheFly, mainConfig), + mButton(nullptr) +{ + createControls(); +} + +void SetupItemSound::addMoreControls() +{ + mButton = new Button(_("Play"), mEventName + "_PLAY", this); + mHorizont->add(mButton); +} + +void SetupItemSound::action(const gcn::ActionEvent &event) +{ + if (event.getId() == mEventName + "_PLAY") + { + if (mSlider->getSelected()) + { + sound.playGuiSfx(branding.getStringValue("systemsounds") + + mSlider->getSelectedString() + ".ogg"); + } + } + else + { + SetupItemSliderList::action(event); + } +} diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index f883a5b94..38dec929e 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -377,10 +377,12 @@ class SetupItemSliderList : public SetupItem void toWidget(); - void action(const gcn::ActionEvent &event); + virtual void action(const gcn::ActionEvent &event); void apply(std::string eventName); + virtual void addMoreControls() = 0; + protected: HorizontContainer *mHorizont; Label *mLabel; @@ -390,4 +392,21 @@ class SetupItemSliderList : public SetupItem bool mOnTheFly; }; +class SetupItemSound : public SetupItemSliderList +{ + public: + SetupItemSound(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, gcn::ListModel *model, + int width = 150, bool onTheFly = false, + bool mainConfig = true); + + void action(const gcn::ActionEvent &event); + + void addMoreControls(); + + protected: + Button *mButton; +}; + #endif diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index a7b1a564c..b2239834d 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -63,6 +63,9 @@ class SliderList : public Container, void adjustSize(); + int getSelected() + { return mSelectedIndex; } + protected: void updateLabel(); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 5114f868c..de1304240 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2204,7 +2204,8 @@ void LocalPlayer::changeAwayMode() if (outfitWindow) outfitWindow->wearAwayOutfit(); mAwayDialog = new OkDialog(_("Away"), - config.getStringValue("afkMessage"), true, false); + config.getStringValue("afkMessage"), + DIALOG_SILENCE, true, false); mAwayDialog->addActionListener(mAwayListener); sound.volumeOff(); } @@ -4147,7 +4148,7 @@ void LocalPlayer::checkNewName(Being *being) if (!mWaitFor.empty() && mWaitFor == nick) { debugMsg(_("You see ") + mWaitFor); - sound.playGuiSfx("system/newmessage.ogg"); + sound.playGuiSound("soundinfo"); mWaitFor = ""; } } diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 2dc51acf3..67894b0d9 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -167,7 +167,7 @@ void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg) errorMessage = _("Incorrect race."); break; } - new OkDialog(_("Error"), errorMessage); + new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); if (mCharCreateDialog) mCharCreateDialog->unlock(); } @@ -185,7 +185,7 @@ void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED) void CharServerHandler::processCharDeleteFailed(Net::MessageIn &msg A_UNUSED) { unlockCharSelectDialog(); - new OkDialog(_("Error"), _("Failed to delete character.")); + new OkDialog(_("Error"), _("Failed to delete character."), DIALOG_ERROR); } void CharServerHandler::clear() diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 6d021d6a9..c8c870dbd 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -101,7 +101,7 @@ void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) void GameHandler::processMapQuitResponse(Net::MessageIn &msg) { if (msg.readInt8()) - new OkDialog(_("Game"), _("Request to quit denied!"), nullptr); + new OkDialog(_("Game"), _("Request to quit denied!"), DIALOG_ERROR); } } // namespace Ea diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 27aa4da80..ddcf7d9c0 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -336,7 +336,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) weightNotice = new OkDialog(_("Message"), _("You are carrying more than " "half your weight. You are " - "unable to regain health."), false); + "unable to regain health."), DIALOG_ERROR, false); weightNotice->addActionListener( &weightListener); } @@ -346,7 +346,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) weightNotice = new OkDialog(_("Message"), _("You are carrying less than " "half your weight. You " - "can regain health."), false); + "can regain health."), DIALOG_ERROR, false); weightNotice->addActionListener( &weightListener); } @@ -426,8 +426,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) if (PlayerInfo::getAttribute(HP) == 0 && !deathNotice) { deathNotice = new OkDialog(_("Message"), - randomDeathMessage(), - false); + randomDeathMessage(), false); deathNotice->addActionListener(&deathListener); player_node->setAction(Being::DEAD); } diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index cef4f497a..9468baaa1 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -335,7 +335,8 @@ void BeingHandler::handleBeingActionChangeMessage(Net::MessageIn &msg) }; std::string message(deadMsg[rand() % 13]); message.append(std::string(" ") + _("Press OK to respawn.")); - OkDialog *dlg = new OkDialog(_("You Died"), message, false); + OkDialog *dlg = new OkDialog(_("You Died"), + message, DIALOG_OK, false); dlg->addActionListener(&(ManaServ::respawnListener)); } } diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 300af5a2b..7977df909 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -181,7 +181,7 @@ void CharHandler::handleCharacterCreateResponse(Net::MessageIn &msg) errorMessage = _("Unknown error."); break; } - new OkDialog(_("Error"), errorMessage); + new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); if (mCharCreateDialog) mCharCreateDialog->unlock(); @@ -224,7 +224,7 @@ void CharHandler::handleCharacterDeleteResponse(Net::MessageIn &msg) default: errorMessage = strprintf(_("Unknown error (%d)."), errMsg); } - new OkDialog(_("Error"), errorMessage); + new OkDialog(_("Error"), errorMessage, DIALOG_ERROR); } mSelectedCharacter = 0; unlockCharSelectDialog(); diff --git a/src/sound.cpp b/src/sound.cpp index 25b37d578..2c7ecb53d 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -325,6 +325,12 @@ void Sound::playSfx(const std::string &path, int x, int y) } } +void Sound::playGuiSound(const std::string &name) +{ + playGuiSfx(branding.getStringValue("systemsounds") + + config.getStringValue(name) + ".ogg"); +} + void Sound::playGuiSfx(const std::string &path) { if (!mInstalled || path.empty() || !mPlayGui) diff --git a/src/sound.h b/src/sound.h index 7f9fb64a4..cfa847a0b 100644 --- a/src/sound.h +++ b/src/sound.h @@ -109,6 +109,8 @@ class Sound : public ConfigListener */ void playGuiSfx(const std::string &path); + void playGuiSound(const std::string &name); + void changeAudio(); void volumeOff(); -- cgit v1.2.3-70-g09d2 From bbf5743dd18e78298376da6f78c71ae2a524c766 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2012 22:16:23 +0300 Subject: Fix some sound event. Replace hardcoded sound names to constants. Add party/guild sound. --- src/defaults.cpp | 1 + src/gui/confirmdialog.cpp | 2 +- src/gui/okdialog.cpp | 4 ++-- src/gui/setup_audio.cpp | 3 +++ src/gui/shopwindow.cpp | 2 +- src/gui/widgets/chattab.cpp | 21 +++++++++++++++++++-- src/gui/widgets/chattab.h | 2 ++ src/gui/widgets/guildchattab.cpp | 6 ++++++ src/gui/widgets/guildchattab.h | 2 ++ src/localplayer.cpp | 2 +- src/net/ea/gui/guildtab.cpp | 6 ++++++ src/net/ea/gui/guildtab.h | 2 ++ src/net/ea/gui/partytab.cpp | 5 +++++ src/net/ea/gui/partytab.h | 2 ++ src/sound.h | 9 +++++++++ 15 files changed, 62 insertions(+), 7 deletions(-) (limited to 'src/net') diff --git a/src/defaults.cpp b/src/defaults.cpp index cd2911192..3e53506b4 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -236,6 +236,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "soundtrade", "start"); AddDEF(configData, "soundinfo", "notify"); AddDEF(configData, "soundrequest", "attention"); + AddDEF(configData, "soundguild", "newmessage"); return configData; } diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index b6645db3c..a2fb7b6cc 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -97,7 +97,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, } setVisible(true); yesButton->requestFocus(); - sound.playGuiSound("soundrequest"); + sound.playGuiSound(SOUND_REQUEST); } void ConfirmDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp index fe22cf008..3259cb6d6 100644 --- a/src/gui/okdialog.cpp +++ b/src/gui/okdialog.cpp @@ -76,9 +76,9 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, okButton->requestFocus(); if (soundEvent == DIALOG_OK) - sound.playGuiSound("soundinfo"); + sound.playGuiSound(SOUND_INFO); else if (soundEvent == DIALOG_ERROR) - sound.playGuiSound("sounderror"); + sound.playGuiSound(SOUND_ERROR); } void OkDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index a4c3110d9..69ca4e759 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -91,6 +91,9 @@ Setup_Audio::Setup_Audio() new SetupItemSound(_("Whisper message sound"), "", "soundwhisper", this, "soundwhisperEvent", mSoundModel); + new SetupItemSound(_("Guild / Party message sound"), "", + "soundguild", this, "soundguildEvent", mSoundModel); + new SetupItemSound(_("Highlight message sound"), "", "soundhighlight", this, "soundhighlightEvent", mSoundModel); diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 33ab32ca5..01b589ab6 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -753,7 +753,7 @@ void ShopWindow::processRequest(std::string nick, std::string data, int mode) if (config.getBoolValue("autoShop")) { - sound.playGuiSound("soundtrade"); + sound.playGuiSound(SOUND_TRADE); startTrade(); } else diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 53842e887..be6a31164 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -289,9 +289,19 @@ void ChatTab::chatLog(std::string line, Own own, if (getFlash() == 0) { if (chatWindow && chatWindow->findHighlight(tmp.text)) + { setFlash(2); + sound.playGuiSound(SOUND_HIGHLIGHT); + } else + { setFlash(1); + } + } + else if (getFlash() == 2) + { + if (chatWindow && chatWindow->findHighlight(tmp.text)) + sound.playGuiSound(SOUND_HIGHLIGHT); } } @@ -300,8 +310,10 @@ void ChatTab::chatLog(std::string line, Own own, || (Client::getIsMinimized() || (!Client::getMouseFocused() && !Client::getInputFocused())))) { - if (own != BY_SERVER) - sound.playGuiSound("soundwhisper"); + if (own == BY_GM) + sound.playGuiSound(SOUND_GLOBAL); + else if (own != BY_SERVER) + playNewMessageSound(); } } } @@ -468,3 +480,8 @@ void ChatTab::addNewRow(std::string &line) } mScrollArea->logic(); } + +void ChatTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_WHISPER); +} diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 912305a63..d67f56b54 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -162,6 +162,8 @@ class ChatTab : public Tab void addNewRow(std::string &line); + virtual void playNewMessageSound(); + protected: friend class ChatWindow; friend class WhisperWindow; diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp index a95fca3cf..bad34cfb3 100644 --- a/src/gui/widgets/guildchattab.cpp +++ b/src/gui/widgets/guildchattab.cpp @@ -27,6 +27,7 @@ #include "guild.h" #include "guildmanager.h" #include "localplayer.h" +#include "sound.h" #include "gui/theme.h" @@ -126,3 +127,8 @@ void GuildChatTab::saveToLogFile(std::string &msg) if (chatLogger) chatLogger->log("#Guild", msg); } + +void GuildChatTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_GUILD); +} diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index be6f4d034..e729844f4 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -44,6 +44,8 @@ class GuildChatTab : public ChatTab int getType() const { return ChatTab::TAB_GUILD; } + void playNewMessageSound(); + protected: void handleInput(const std::string &msg); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index de1304240..f88423f8e 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -4148,7 +4148,7 @@ void LocalPlayer::checkNewName(Being *being) if (!mWaitFor.empty() && mWaitFor == nick) { debugMsg(_("You see ") + mWaitFor); - sound.playGuiSound("soundinfo"); + sound.playGuiSound(SOUND_INFO); mWaitFor = ""; } } diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 87fc34d94..bd1521b21 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -26,6 +26,7 @@ #include "commandhandler.h" #include "guild.h" #include "localplayer.h" +#include "sound.h" #include "gui/theme.h" @@ -151,4 +152,9 @@ void GuildTab::saveToLogFile(std::string &msg) chatLogger->log("#Guild", msg); } +void GuildTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_GUILD); +} + } // namespace Ea diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h index 81d971161..22a41ce80 100644 --- a/src/net/ea/gui/guildtab.h +++ b/src/net/ea/gui/guildtab.h @@ -47,6 +47,8 @@ class GuildTab : public ChatTab int getType() const { return ChatTab::TAB_GUILD; } + void playNewMessageSound(); + protected: void handleInput(const std::string &msg); diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index d5e344ac2..e69207842 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -26,6 +26,7 @@ #include "commandhandler.h" #include "localplayer.h" #include "party.h" +#include "sound.h" #include "gui/theme.h" @@ -241,4 +242,8 @@ void PartyTab::saveToLogFile(std::string &msg) chatLogger->log("#Party", msg); } +void PartyTab::playNewMessageSound() +{ + sound.playGuiSound(SOUND_GUILD); +} } // namespace Ea diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h index 029d71ac7..931b283dd 100644 --- a/src/net/ea/gui/partytab.h +++ b/src/net/ea/gui/partytab.h @@ -47,6 +47,8 @@ class PartyTab : public ChatTab void saveToLogFile(std::string &msg); + void playNewMessageSound(); + protected: void handleInput(const std::string &msg); diff --git a/src/sound.h b/src/sound.h index cfa847a0b..a967d0a92 100644 --- a/src/sound.h +++ b/src/sound.h @@ -31,6 +31,15 @@ class Music; +const static std::string SOUND_INFO = "soundinfo"; +const static std::string SOUND_ERROR = "sounderror"; +const static std::string SOUND_REQUEST = "soundrequest"; +const static std::string SOUND_TRADE = "soundtrade"; +const static std::string SOUND_WHISPER = "soundwhisper"; +const static std::string SOUND_HIGHLIGHT = "soundhighlight"; +const static std::string SOUND_GLOBAL = "soundglobal"; +const static std::string SOUND_GUILD = "soundguild"; + /** Sound engine * * \ingroup CORE -- cgit v1.2.3-70-g09d2 From e70d551884c0e11408176086a25d359987090003 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Feb 2012 04:53:49 +0300 Subject: Allow open conext menu from free tile if in free camera mode. Menu is same as in minimap. --- src/gui/viewport.cpp | 9 +++++++-- src/net/ea/playerhandler.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 17f40121e..1ef7b1cba 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -413,7 +413,6 @@ void Viewport::mousePressed(gcn::MouseEvent &event) return; // Check if we are alive and kickin' -// if (!mMap || !player_node || !player_node->isAlive()) if (!mMap || !player_node) return; @@ -422,7 +421,6 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (Being::isTalking()) return; - const int pixelX = event.getX() + static_cast(mPixelViewX); const int pixelY = event.getY() + static_cast(mPixelViewY); @@ -461,6 +459,13 @@ void Viewport::mousePressed(gcn::MouseEvent &event) mPopupMenu->showPopup(event.getX(), event.getY(), mHoverSign); return; } + else if (mCameraMode) + { + mPopupMenu->showMapPopup(event.getX(), event.getY(), + (getMouseX() + getCameraX()) / mMap->getTileWidth(), + (getMouseY() + getCameraY()) / mMap->getTileHeight()); + return; + } } // If a popup is active, just remove it diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index ddcf7d9c0..df28b4c1c 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -28,6 +28,7 @@ #include "playerinfo.h" #include "units.h" +#include "gui/ministatuswindow.h" #include "gui/okdialog.h" #include "gui/skilldialog.h" #include "gui/statuswindow.h" @@ -257,7 +258,12 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) static_cast(scrollOffsetY)); if (viewport) + { + viewport->returnCamera(); + if (miniStatusWindow) + miniStatusWindow->updateStatus(); viewport->scrollBy(scrollOffsetX, scrollOffsetY); + } } void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) -- cgit v1.2.3-70-g09d2 From c53136fce2b1cca1bb9273255ad86f0aded747c2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Feb 2012 20:56:37 +0300 Subject: Fix code style in empty methods. --- src/actorspritelistener.h | 3 ++- src/commandhandler.h | 3 ++- src/configlistener.h | 3 ++- src/equipment.h | 5 ++++- src/gui/chatwindow.cpp | 3 ++- src/gui/editserverdialog.h | 3 ++- src/gui/sdlinput.h | 3 ++- src/gui/setup_relations.cpp | 6 ++++-- src/gui/textcommandeditor.cpp | 6 ++++-- src/gui/widgets/browserbox.h | 3 ++- src/gui/widgets/flowcontainer.h | 3 ++- src/gui/widgets/linkhandler.h | 3 ++- src/gui/widgets/tablemodel.h | 3 ++- src/gui/worldselectdialog.cpp | 3 ++- src/guichan/include/guichan/actionlistener.hpp | 7 ++++--- src/guichan/include/guichan/deathlistener.hpp | 7 ++++--- src/guichan/include/guichan/focushandler.hpp | 3 ++- src/guichan/include/guichan/focuslistener.hpp | 12 ++++++++---- src/guichan/include/guichan/graphics.hpp | 9 ++++++--- src/guichan/include/guichan/keylistener.hpp | 12 ++++++++---- src/guichan/include/guichan/listmodel.hpp | 3 ++- src/guichan/include/guichan/mouselistener.hpp | 6 ++++-- src/guichan/include/guichan/widget.hpp | 18 ++++++++++++------ src/guichan/include/guichan/widgetlistener.hpp | 19 ++++++++++++------- src/guichan/include/guichan/widgets/listbox.hpp | 3 ++- src/guichan/include/guichan/widgets/slider.hpp | 3 ++- src/logger.h | 6 ++++-- src/net/manaserv/gamehandler.h | 3 ++- src/particlecontainer.h | 3 ++- src/sprite.h | 3 ++- 30 files changed, 110 insertions(+), 57 deletions(-) (limited to 'src/net') diff --git a/src/actorspritelistener.h b/src/actorspritelistener.h index 314825fc7..7fdb99dc4 100644 --- a/src/actorspritelistener.h +++ b/src/actorspritelistener.h @@ -30,7 +30,8 @@ class ActorSpriteListener /** * Destructor. */ - virtual ~ActorSpriteListener() {} + virtual ~ActorSpriteListener() + { } /** * Called when the ActorSprite has been destroyed. The listener will diff --git a/src/commandhandler.h b/src/commandhandler.h index cd25c234a..d399accf7 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -48,7 +48,8 @@ class CommandHandler /** * Destructor */ - ~CommandHandler() {} + ~CommandHandler() + { } /** * Parse and handle the given command. diff --git a/src/configlistener.h b/src/configlistener.h index e4bbbee53..28540c564 100644 --- a/src/configlistener.h +++ b/src/configlistener.h @@ -37,7 +37,8 @@ class ConfigListener /** * Destructor. */ - virtual ~ConfigListener() {} + virtual ~ConfigListener() + { } /** * Called when an option changed. The config listener will have to be diff --git a/src/equipment.h b/src/equipment.h index 50acd60d3..ed38d32ca 100644 --- a/src/equipment.h +++ b/src/equipment.h @@ -66,8 +66,11 @@ class Equipment { public: virtual Item *getEquipment(int index) const = 0; + virtual void clear() = 0; - virtual ~Backend() { } + + virtual ~Backend() + { } }; /** diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 69e4d703f..ac493b04e 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -133,7 +133,8 @@ const char *COLOR_NAME[14] = class ColorListModel : public gcn::ListModel { public: - virtual ~ColorListModel() { } + virtual ~ColorListModel() + { } virtual int getNumberOfElements() { diff --git a/src/gui/editserverdialog.h b/src/gui/editserverdialog.h index 6035b0e50..4ad6b8fcb 100644 --- a/src/gui/editserverdialog.h +++ b/src/gui/editserverdialog.h @@ -44,7 +44,8 @@ class TypeListModel; class TypeListModel : public gcn::ListModel { public: - TypeListModel() {} + TypeListModel() + { } /** * Used to get number of line in the list diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 17cb4ea8a..f68612793 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -147,7 +147,8 @@ public: * only use SDL and plan sticking with SDL you can safely ignore this * function as it in the SDL case does nothing. */ - virtual void _pollInput() { } + virtual void _pollInput() + { } // Inherited from Input diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index f3b664c9b..d9f7a362d 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -80,7 +80,8 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = class PlayerRelationListModel : public gcn::ListModel { public: - virtual ~PlayerRelationListModel() { } + virtual ~PlayerRelationListModel() + { } virtual int getNumberOfElements() { @@ -211,7 +212,8 @@ protected: class IgnoreChoicesListModel : public gcn::ListModel { public: - virtual ~IgnoreChoicesListModel() { } + virtual ~IgnoreChoicesListModel() + { } virtual int getNumberOfElements() { diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 7b9442318..3f98b4ea3 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -127,7 +127,8 @@ const char *MAGIC_SCHOOL_TEXT[6] = class TargetTypeModel : public gcn::ListModel { public: - virtual ~TargetTypeModel() { } + virtual ~TargetTypeModel() + { } virtual int getNumberOfElements() { @@ -146,7 +147,8 @@ public: class MagicSchoolModel : public gcn::ListModel { public: - virtual ~MagicSchoolModel() { } + virtual ~MagicSchoolModel() + { } virtual int getNumberOfElements() { diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index d82ebd758..b1582e077 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -104,7 +104,8 @@ class BrowserBox : public gcn::Widget, /** * Sets the maximum numbers of rows in the browser box. 0 = no limit. */ - void setMaxRow(unsigned max) {mMaxRows = max; }; + void setMaxRow(unsigned max) + { mMaxRows = max; }; /** * Disable links & user defined colors to be used in chat input. diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h index 677dd3661..e5eeebdcb 100644 --- a/src/gui/widgets/flowcontainer.h +++ b/src/gui/widgets/flowcontainer.h @@ -43,7 +43,8 @@ class FlowContainer : public Container, /** * Destructor. */ - ~FlowContainer() {} + ~FlowContainer() + { } /** * Invoked when a widget changes its size. This is used to determine diff --git a/src/gui/widgets/linkhandler.h b/src/gui/widgets/linkhandler.h index 366899ffc..703f593f2 100644 --- a/src/gui/widgets/linkhandler.h +++ b/src/gui/widgets/linkhandler.h @@ -34,7 +34,8 @@ class LinkHandler { public: - virtual ~LinkHandler() { } + virtual ~LinkHandler() + { } virtual void handleLink(const std::string &link, gcn::MouseEvent *event) = 0; diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h index 40a350163..e931888e4 100644 --- a/src/gui/widgets/tablemodel.h +++ b/src/gui/widgets/tablemodel.h @@ -42,7 +42,8 @@ public: */ virtual void modelUpdated(bool completed) = 0; - virtual ~TableModelListener() {} + virtual ~TableModelListener() + { } }; /** diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index 917605281..19e6b81f7 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -54,7 +54,8 @@ class WorldListModel : public gcn::ListModel { } - virtual ~WorldListModel() {} + virtual ~WorldListModel() + { } int getNumberOfElements() { diff --git a/src/guichan/include/guichan/actionlistener.hpp b/src/guichan/include/guichan/actionlistener.hpp index 28373f2df..5991486a7 100644 --- a/src/guichan/include/guichan/actionlistener.hpp +++ b/src/guichan/include/guichan/actionlistener.hpp @@ -67,7 +67,8 @@ namespace gcn /** * Destructor. */ - virtual ~ActionListener() { } + virtual ~ActionListener() + { } /** * Called when an action is recieved from a widget. It is used @@ -86,8 +87,8 @@ namespace gcn * You should not be able to make an instance of ActionListener, * therefore its constructor is protected. */ - ActionListener() { } - + ActionListener() + { } }; } diff --git a/src/guichan/include/guichan/deathlistener.hpp b/src/guichan/include/guichan/deathlistener.hpp index 5e983e02d..b2061e036 100644 --- a/src/guichan/include/guichan/deathlistener.hpp +++ b/src/guichan/include/guichan/deathlistener.hpp @@ -66,7 +66,8 @@ namespace gcn /** * Destructor. */ - virtual ~DeathListener() { } + virtual ~DeathListener() + { } /** * Called when a widget dies. It is used to be able to recieve @@ -83,8 +84,8 @@ namespace gcn * You should not be able to make an instance of DeathListener, * therefore its constructor is protected. */ - DeathListener() { } - + DeathListener() + { } }; } diff --git a/src/guichan/include/guichan/focushandler.hpp b/src/guichan/include/guichan/focushandler.hpp index 4caba6f7b..9fa7ddeb7 100644 --- a/src/guichan/include/guichan/focushandler.hpp +++ b/src/guichan/include/guichan/focushandler.hpp @@ -80,7 +80,8 @@ namespace gcn /** * Destructor. */ - virtual ~FocusHandler() { }; + virtual ~FocusHandler() + { }; /** * Requests focus for a widget. Focus will only be granted to a widget diff --git a/src/guichan/include/guichan/focuslistener.hpp b/src/guichan/include/guichan/focuslistener.hpp index 9ec53b860..3876e8518 100644 --- a/src/guichan/include/guichan/focuslistener.hpp +++ b/src/guichan/include/guichan/focuslistener.hpp @@ -72,21 +72,24 @@ namespace gcn /** * Destructor. */ - virtual ~FocusListener() { } + virtual ~FocusListener() + { } /** * Called when a widget gains focus. * * @param event Discribes the event. */ - virtual void focusGained(const Event& event A_UNUSED) { }; + virtual void focusGained(const Event& event A_UNUSED) + { }; /** * Called when a widget loses focus. * * @param event Discribes the event. */ - virtual void focusLost(const Event& event A_UNUSED) { }; + virtual void focusLost(const Event& event A_UNUSED) + { }; protected: /** @@ -95,7 +98,8 @@ namespace gcn * You should not be able to make an instance of FocusListener, * therefore its constructor is protected. */ - FocusListener() { } + FocusListener() + { } }; } diff --git a/src/guichan/include/guichan/graphics.hpp b/src/guichan/include/guichan/graphics.hpp index efefa3d73..d10c63ae1 100644 --- a/src/guichan/include/guichan/graphics.hpp +++ b/src/guichan/include/guichan/graphics.hpp @@ -113,7 +113,8 @@ namespace gcn /** * Destructor. */ - virtual ~Graphics() { } + virtual ~Graphics() + { } /** * Initializes drawing. Called by the Gui when Gui::draw() is called. @@ -126,7 +127,8 @@ namespace gcn * * @see _endDraw, Gui::draw */ - virtual void _beginDraw() { } + virtual void _beginDraw() + { } /** * Deinitializes drawing. Called by the Gui when a Gui::draw() is done. @@ -137,7 +139,8 @@ namespace gcn * * @see _beginDraw, Gui::draw */ - virtual void _endDraw() { } + virtual void _endDraw() + { } /** * Pushes a clip area onto the stack. The x and y coordinates in the diff --git a/src/guichan/include/guichan/keylistener.hpp b/src/guichan/include/guichan/keylistener.hpp index a6d6f851d..9f90a1ffc 100644 --- a/src/guichan/include/guichan/keylistener.hpp +++ b/src/guichan/include/guichan/keylistener.hpp @@ -70,7 +70,8 @@ namespace gcn /** * Destructor. */ - virtual ~KeyListener() { } + virtual ~KeyListener() + { } /** * Called if a key is pressed when the widget has keyboard focus. @@ -79,14 +80,16 @@ namespace gcn * * @param keyEvent Discribes the event. */ - virtual void keyPressed(KeyEvent& keyEvent A_UNUSED) { } + virtual void keyPressed(KeyEvent& keyEvent A_UNUSED) + { } /** * Called if a key is released when the widget has keyboard focus. * * @param keyEvent Discribes the event. */ - virtual void keyReleased(KeyEvent& keyEvent A_UNUSED) { } + virtual void keyReleased(KeyEvent& keyEvent A_UNUSED) + { } protected: /** @@ -95,7 +98,8 @@ namespace gcn * You should not be able to make an instance of KeyListener, * therefore its constructor is protected. */ - KeyListener() { } + KeyListener() + { } }; } diff --git a/src/guichan/include/guichan/listmodel.hpp b/src/guichan/include/guichan/listmodel.hpp index 612a5d4bd..bf139afb1 100644 --- a/src/guichan/include/guichan/listmodel.hpp +++ b/src/guichan/include/guichan/listmodel.hpp @@ -65,7 +65,8 @@ namespace gcn /** * Destructor. */ - virtual ~ListModel() { } + virtual ~ListModel() + { } /** * Gets the number of elements in the list. diff --git a/src/guichan/include/guichan/mouselistener.hpp b/src/guichan/include/guichan/mouselistener.hpp index 2f12ecdac..b78f529e9 100644 --- a/src/guichan/include/guichan/mouselistener.hpp +++ b/src/guichan/include/guichan/mouselistener.hpp @@ -69,7 +69,8 @@ namespace gcn /** * Destructor. */ - virtual ~MouseListener() { } + virtual ~MouseListener() + { } /** * Called when the mouse has entered into the widget area. @@ -183,7 +184,8 @@ namespace gcn * You should not be able to make an instance of MouseListener, * therefore its constructor is protected. */ - MouseListener() { } + MouseListener() + { } }; } diff --git a/src/guichan/include/guichan/widget.hpp b/src/guichan/include/guichan/widget.hpp index 69126e3df..b6146b791 100644 --- a/src/guichan/include/guichan/widget.hpp +++ b/src/guichan/include/guichan/widget.hpp @@ -173,7 +173,8 @@ namespace gcn * @see Gui::logic * @since 0.1.0 */ - virtual void logic() { } + virtual void logic() + { } /** * Gets the widget's parent container. @@ -686,7 +687,8 @@ namespace gcn * * @since 0.1.0 */ - virtual void fontChanged() { } + virtual void fontChanged() + { } /** * Checks if a widget exists or not, that is if it still exists @@ -895,7 +897,8 @@ namespace gcn * @see moveToBottom * @since 0.1.0 */ - virtual void moveToTop(Widget* widget A_UNUSED) { }; + virtual void moveToTop(Widget* widget A_UNUSED) + { }; /** * Moves a widget in this widget to the bottom of this widget. @@ -905,7 +908,8 @@ namespace gcn * @see moveToTop * @since 0.1.0 */ - virtual void moveToBottom(Widget* widget A_UNUSED) { }; + virtual void moveToBottom(Widget* widget A_UNUSED) + { }; /** * Focuses the next widget in the widget. @@ -913,7 +917,8 @@ namespace gcn * @see moveToBottom * @since 0.1.0 */ - virtual void focusNext() { }; + virtual void focusNext() + { }; /** * Focuses the previous widget in the widget. @@ -921,7 +926,8 @@ namespace gcn * @see moveToBottom * @since 0.1.0 */ - virtual void focusPrevious() { }; + virtual void focusPrevious() + { }; /** * Tries to show a specific part of a widget by moving it. Used if the diff --git a/src/guichan/include/guichan/widgetlistener.hpp b/src/guichan/include/guichan/widgetlistener.hpp index 0ede5b871..f0cb60fd3 100644 --- a/src/guichan/include/guichan/widgetlistener.hpp +++ b/src/guichan/include/guichan/widgetlistener.hpp @@ -74,7 +74,8 @@ namespace gcn /** * Destructor. */ - virtual ~WidgetListener() { } + virtual ~WidgetListener() + { } /** * Invoked when a widget changes its size. @@ -82,7 +83,8 @@ namespace gcn * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetResized(const Event& event A_UNUSED) { } + virtual void widgetResized(const Event& event A_UNUSED) + { } /** * Invoked when a widget is moved. @@ -90,7 +92,8 @@ namespace gcn * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetMoved(const Event& event A_UNUSED) { } + virtual void widgetMoved(const Event& event A_UNUSED) + { } /** * Invoked when a widget is hidden, i.e it's set to be @@ -99,7 +102,8 @@ namespace gcn * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetHidden(const Event& event A_UNUSED) { } + virtual void widgetHidden(const Event& event A_UNUSED) + { } /** * Invoked when a widget is shown, i.e it's set to be @@ -108,7 +112,8 @@ namespace gcn * @param event Describes the event. * @since 0.8.0 */ - virtual void widgetShown(const Event& event A_UNUSED) { } + virtual void widgetShown(const Event& event A_UNUSED) + { } protected: /** @@ -117,8 +122,8 @@ namespace gcn * You should not be able to make an instance of WidgetListener, * therefore its constructor is protected. */ - WidgetListener() { } - + WidgetListener() + { } }; } diff --git a/src/guichan/include/guichan/widgets/listbox.hpp b/src/guichan/include/guichan/widgets/listbox.hpp index 1e73c2214..ce056acbd 100644 --- a/src/guichan/include/guichan/widgets/listbox.hpp +++ b/src/guichan/include/guichan/widgets/listbox.hpp @@ -89,7 +89,8 @@ namespace gcn /** * Destructor. */ - virtual ~ListBox() { } + virtual ~ListBox() + { } /** * Gets the selected item as an index in the list model. diff --git a/src/guichan/include/guichan/widgets/slider.hpp b/src/guichan/include/guichan/widgets/slider.hpp index 77b0b8806..a22c36844 100644 --- a/src/guichan/include/guichan/widgets/slider.hpp +++ b/src/guichan/include/guichan/widgets/slider.hpp @@ -94,7 +94,8 @@ namespace gcn /** * Destructor. */ - virtual ~Slider() { } + virtual ~Slider() + { } /** * Sets the scale of the slider. diff --git a/src/logger.h b/src/logger.h index 3dc24420d..54b44cc0e 100644 --- a/src/logger.h +++ b/src/logger.h @@ -58,12 +58,14 @@ class Logger /** * Sets whether the log should be written to standard output. */ - void setLogToStandardOut(bool value) { mLogToStandardOut = value; } + void setLogToStandardOut(bool value) + { mLogToStandardOut = value; } /** * Enables logging to chat window */ - void setChatWindow(ChatWindow *window) { mChatWindow = window; } + void setChatWindow(ChatWindow *window) + { mChatWindow = window; } /** * Enters a message in the log. The message will be timestamped. diff --git a/src/net/manaserv/gamehandler.h b/src/net/manaserv/gamehandler.h index 83e636e0e..2019755ea 100644 --- a/src/net/manaserv/gamehandler.h +++ b/src/net/manaserv/gamehandler.h @@ -48,7 +48,8 @@ class GameHandler : public MessageHandler, public Net::GameHandler void quit(bool reconnectAccount); - void quit() { quit(false); } + void quit() + { quit(false); } void ping(int tick); diff --git a/src/particlecontainer.h b/src/particlecontainer.h index a8af163fd..4e402044b 100644 --- a/src/particlecontainer.h +++ b/src/particlecontainer.h @@ -57,7 +57,8 @@ public: /** * Kills and removes all particle effects (only in this container) */ - virtual void clearLocally() {} + virtual void clearLocally() + { } /** * Sets the positions of all elements diff --git a/src/sprite.h b/src/sprite.h index ffee97d49..ab2dcfc6a 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -32,7 +32,8 @@ class Image; class Sprite { public: - virtual ~Sprite() {} + virtual ~Sprite() + { } /** * Resets the sprite. -- cgit v1.2.3-70-g09d2 From f1e7947192d72d1807eb0497756a5d09c91a1766 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 1 Mar 2012 01:44:59 +0300 Subject: Fix weight dialogs sound effect. --- src/net/ea/playerhandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index df28b4c1c..a0cddc219 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -342,7 +342,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) weightNotice = new OkDialog(_("Message"), _("You are carrying more than " "half your weight. You are " - "unable to regain health."), DIALOG_ERROR, false); + "unable to regain health."), DIALOG_OK, false); weightNotice->addActionListener( &weightListener); } @@ -352,7 +352,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) weightNotice = new OkDialog(_("Message"), _("You are carrying less than " "half your weight. You " - "can regain health."), DIALOG_ERROR, false); + "can regain health."), DIALOG_OK, false); weightNotice->addActionListener( &weightListener); } -- cgit v1.2.3-70-g09d2 From d97fabc2a9408a35ecfab733573b6b7592922f0d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 1 Mar 2012 02:43:22 +0300 Subject: Fix modal state for some dialogs. --- src/game.cpp | 3 ++- src/net/ea/playerhandler.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/game.cpp b/src/game.cpp index 33bfe232a..70d794ce8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1799,7 +1799,8 @@ void Game::changeMap(const std::string &mapPath) { logger->log("Error while loading %s", fullMap.c_str()); new OkDialog(_("Could Not Load Map"), strprintf( - _("Error while loading %s"), fullMap.c_str()), DIALOG_ERROR); + _("Error while loading %s"), fullMap.c_str()), + DIALOG_ERROR, false); } if (mCurrentMap) diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index a0cddc219..bfbef0798 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -432,7 +432,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) if (PlayerInfo::getAttribute(HP) == 0 && !deathNotice) { deathNotice = new OkDialog(_("Message"), - randomDeathMessage(), false); + randomDeathMessage(), DIALOG_OK, false); deathNotice->addActionListener(&deathListener); player_node->setAction(Being::DEAD); } -- cgit v1.2.3-70-g09d2