summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.h5
-rw-r--r--src/net/ea/charserverhandler.cpp4
-rw-r--r--src/net/ea/gamehandler.cpp2
-rw-r--r--src/net/ea/gui/guildtab.cpp6
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp5
-rw-r--r--src/net/ea/gui/partytab.h2
-rw-r--r--src/net/ea/partyhandler.cpp1
-rw-r--r--src/net/ea/partyhandler.h1
-rw-r--r--src/net/ea/playerhandler.cpp13
-rw-r--r--src/net/manaserv/beinghandler.cpp3
-rw-r--r--src/net/manaserv/charhandler.cpp4
-rw-r--r--src/net/manaserv/gamehandler.h3
-rw-r--r--src/net/manaserv/network.cpp10
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/tmwa/network.cpp2
-rw-r--r--src/net/tmwa/partyhandler.cpp1
-rw-r--r--src/net/tmwa/partyhandler.h1
-rw-r--r--src/net/tmwa/playerhandler.cpp4
19 files changed, 48 insertions, 23 deletions
diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h
index bc1491ada..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.
*
@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef BEINGHANDLER_H
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/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/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 <lloyd_bryant@netzero.net>
+ * 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 <lloyd_bryant@netzero.net>
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 27aa4da80..bfbef0798 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<int>(scrollOffsetY));
if (viewport)
+ {
+ viewport->returnCamera();
+ if (miniStatusWindow)
+ miniStatusWindow->updateStatus();
viewport->scrollBy(scrollOffsetX, scrollOffsetY);
+ }
}
void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
@@ -336,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."), false);
+ "unable to regain health."), DIALOG_OK, false);
weightNotice->addActionListener(
&weightListener);
}
@@ -346,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."), false);
+ "can regain health."), DIALOG_OK, false);
weightNotice->addActionListener(
&weightListener);
}
@@ -426,8 +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);
}
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/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/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 84e71eaf3..05041c56a 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,8 +76,8 @@ void finalize()
if (connections)
{
- logger->error("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();
@@ -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/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<unsigned>(buf[f]));
str += " ";
for (int f = 0; f < length; f ++)
{
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())
{
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 <lloyd_bryant@netzero.net>
+ * 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 <lloyd_bryant@netzero.net>
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
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<char*>(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<char*>(buf),
status, level, gender, ver));
buf += strlen(buf) + 1;
}