From 67d5177ef4f5d54ea8edc5403ed20f9ade56e8bf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Apr 2013 23:11:05 +0300 Subject: fix code style and some other fixes after auto checks. --- src/being.cpp | 2 ++ src/chatlogger.cpp | 3 ++- src/client.cpp | 4 +-- src/configuration.cpp | 6 +++++ src/gui/minimap.cpp | 1 + src/gui/popupmenu.cpp | 1 + src/gui/viewport.cpp | 1 + src/net/eathena/messagehandler.cpp | 5 ++-- src/net/tmwa/messagehandler.cpp | 5 ++-- src/resources/dyecolor.h | 55 ++++++++++++++++++++++++++++++++++++++ src/resources/emotedb.h | 3 ++- src/resources/iteminfo.h | 1 - src/resources/palettedb.cpp | 7 ++--- 13 files changed, 82 insertions(+), 12 deletions(-) create mode 100644 src/resources/dyecolor.h (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index d5012ac06..e8f6566f0 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2794,6 +2794,8 @@ void Being::setEmote(const uint8_t emotion, const int emote_time) mEmotionSprite = AnimatedSprite::clone(sprite->sprite); if (mEmotionSprite) mEmotionTime = info->time; + else + mEmotionTime = emote_time; } } } diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index c09249f12..0343a7190 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -138,7 +138,8 @@ std::string ChatLogger::getDir() const std::string ChatLogger::secureName(std::string &name) const { - for (unsigned int f = 0, sz = name.length(); f < sz; f ++) + const unsigned int sz = name.length(); + for (unsigned int f = 0; f < sz; f ++) { const unsigned char ch = name[f]; if ((ch < '0' || ch > '9') diff --git a/src/client.cpp b/src/client.cpp index 6cd3967fc..e22f50fea 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -655,7 +655,7 @@ void Client::gameInit() if (mCurrentServer.port == 0) { mCurrentServer.port = static_cast(branding.getValue( - "defaultPort", DEFAULT_PORT)); + "defaultPort", static_cast(DEFAULT_PORT))); mCurrentServer.type = ServerInfo::parseType( branding.getValue("defaultServerType", "tmwathena")); } @@ -722,7 +722,7 @@ void Client::setEnv(const char *const name, const char *const value) if (!name || !value) return; #ifdef WIN32 - if (putenv(reinterpret_cast((std::string(name) + if (putenv(const_cast((std::string(name) + "=" + value).c_str()))) #else if (setenv(name, value, 1)) diff --git a/src/configuration.cpp b/src/configuration.cpp index 05b048408..ca2281a71 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -317,7 +317,13 @@ void ConfigurationObject::clear() ConfigurationObject::ConfigurationObject() : mOptions(), +#ifdef DEBUG_CONFIG + mContainerOptions(), + mLogKeys(false), + mIsMain(false) +#else mContainerOptions() +#endif { } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index e2087117d..6c7a32a71 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -325,6 +325,7 @@ void Minimap::draw(gcn::Graphics *graphics) case ActorSprite::PLAYER: case ActorSprite::FLOOR_ITEM: case ActorSprite::PORTAL: + case ActorSprite::PET: default: continue; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index a66a534f7..ecb24849f 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -254,6 +254,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) case ActorSprite::UNKNOWN: case ActorSprite::FLOOR_ITEM: case ActorSprite::PORTAL: + case ActorSprite::PET: default: /* Other beings aren't interesting... */ return; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index e4bbc8f5c..da771b397 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -925,6 +925,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED) case ActorSprite::FLOOR_ITEM: case ActorSprite::UNKNOWN: case ActorSprite::PLAYER: + case ActorSprite::PET: default: gui->setCursorType(Cursor::CURSOR_POINTER); break; diff --git a/src/net/eathena/messagehandler.cpp b/src/net/eathena/messagehandler.cpp index 791660283..bf7753e4f 100644 --- a/src/net/eathena/messagehandler.cpp +++ b/src/net/eathena/messagehandler.cpp @@ -31,8 +31,9 @@ namespace EAthena { -MessageHandler::MessageHandler() - : mNetwork(nullptr) +MessageHandler::MessageHandler() : + Net::MessageHandler(), + mNetwork(nullptr) { } diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp index 827efdcbd..6de8ea645 100644 --- a/src/net/tmwa/messagehandler.cpp +++ b/src/net/tmwa/messagehandler.cpp @@ -31,8 +31,9 @@ namespace TmwAthena { -MessageHandler::MessageHandler() - : mNetwork(nullptr) +MessageHandler::MessageHandler() : + Net::MessageHandler(), + mNetwork(nullptr) { } diff --git a/src/resources/dyecolor.h b/src/resources/dyecolor.h new file mode 100644 index 000000000..77351a042 --- /dev/null +++ b/src/resources/dyecolor.h @@ -0,0 +1,55 @@ +/* + * The ManaPlus Client + * Copyright (C) 2013 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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, see . + */ + +#ifndef DYECOLOR_H +#define DYECOLOR_H + +#include + +#include "localconsts.h" + +struct DyeColor +{ + DyeColor() + { + value[3] = 255; + } + + DyeColor(const uint8_t r, const uint8_t g, const uint8_t b) + { + value[0] = r; + value[1] = g; + value[2] = b; + value[3] = 255; + } + + DyeColor(const uint8_t r, const uint8_t g, const uint8_t b, + const uint8_t a) + { + value[0] = r; + value[1] = g; + value[2] = b; + value[3] = a; + } + + uint8_t value[4]; +}; + +#endif diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index d8edb99ec..939b3d667 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -48,7 +48,8 @@ struct EmoteInfo final { EmoteInfo() : sprites(), - particles() + particles(), + time(400) { } A_DELETE_COPY(EmoteInfo) diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 01b5b2e6c..64855bc0a 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -26,7 +26,6 @@ #include "being.h" #include "resources/colordb.h" -#include "resources/soundinfo.h" #include #include diff --git a/src/resources/palettedb.cpp b/src/resources/palettedb.cpp index c770a9cdc..1219601ce 100644 --- a/src/resources/palettedb.cpp +++ b/src/resources/palettedb.cpp @@ -25,8 +25,6 @@ #include "resources/dyecolor.h" #include "resources/resourcemanager.h" -#include "utils/stringvector.h" - #include #include "debug.h" @@ -87,8 +85,11 @@ void PaletteDB::loadPalette() unsigned int g; unsigned int b; - if (sscanf(line.c_str(), "%u %u %u\t%s", &r, &g, &b, name) == 4) + if (sscanf(line.c_str(), "%10u %10u %10u\t%100s", + &r, &g, &b, name) == 4) + { mColors[name] = DyeColor(r, g, b); + } } } -- cgit v1.2.3-70-g09d2