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/resources/dyecolor.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ src/resources/emotedb.h | 3 ++- src/resources/iteminfo.h | 1 - src/resources/palettedb.cpp | 7 +++--- 4 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 src/resources/dyecolor.h (limited to 'src/resources') 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