author | zecke <zecke> | 2004-10-17 18:38:39 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-17 18:38:39 (UTC) |
commit | e95fcb09fc069a83b3c10c19c081873daba49831 (patch) (side-by-side diff) | |
tree | 13d13bac82d5bcf2489075e4f2962685ff3c897d /noncore | |
parent | 7e28835e246e06e157d760a40754b6257f2ad6b3 (diff) | |
download | opie-e95fcb09fc069a83b3c10c19c081873daba49831.zip opie-e95fcb09fc069a83b3c10c19c081873daba49831.tar.gz opie-e95fcb09fc069a83b3c10c19c081873daba49831.tar.bz2 |
G++ 4.0 compiler fixes
-Remove anonymous structures and name them
-Include 'card.h' to cardpile to make 'Card' known to QList
so deleteItem will work
-cast 'enum' to char in event.cpp and opimevent.cpp
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp | 26 | ||||
-rw-r--r-- | noncore/games/qasteroids/view.cpp | 7 | ||||
-rw-r--r-- | noncore/games/solitaire/cardpile.h | 2 |
3 files changed, 22 insertions, 13 deletions
diff --git a/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp b/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp index b2180ba..a47bf6c 100644 --- a/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/zkbnames.cpp @@ -1,35 +1,37 @@ #include <qmap.h> #include "zkbnames.h" QString Null_String((const char*) 0); // Implementation of KeyNames -static struct { +struct Key_Names_t { int key; char *name; -} Key_Names[] = { +}; + +static const Key_Names_t Key_Names[] = { { 32, "Space" }, { 39, "Apostrophe" }, { 44, "Comma" }, { 46, "Period" }, { 47, "Slash" }, { 65, "A" }, { 66, "B" }, { 67, "C" }, { 68, "D" }, { 69, "E" }, { 70, "F" }, { 71, "G" }, { 72, "H" }, { 73, "I" }, { 74, "J" }, { 75, "K" }, { 76, "L" }, { 77, "M" }, { 78, "N" }, { 79, "O" }, { 80, "P" }, { 81, "Q" }, { 82, "R" }, { 83, "S" }, @@ -84,52 +86,54 @@ int KeyNames::find(const QString& key) { } QMap<QString, int>::Iterator it = kn_map.find(key); if (it == kn_map.end()) { return -1; } else { return it.data(); } } const QString& KeyNames::find(int k) { if (kn_map.isEmpty()) { init_kn_maps(); } QMap<int, QString>::Iterator it = kn_rmap.find(k); if (it == kn_rmap.end()) { return Null_String; } else { return it.data(); } } // Implementation of ModifierNames -struct { +struct Modifier_Names_t { int value; char* name; -} Modifier_Names[] = { +}; + +static const Modifier_Names_t Modifier_Names[] = { { 8, "Shift" }, { 16, "Control" }, { 32, "Alt" }, { 0x4000, "Keypad" }, { 0, 0 } }; static QMap<QString, int> mn_map; static QMap<int, QString> mn_rmap; void init_mn_maps() { int i = 0; while (Modifier_Names[i].name != 0) { int value = Modifier_Names[i].value; QString name(Modifier_Names[i].name); mn_map.insert(name, value); mn_rmap.insert(value, name); i++; } } int ModifierNames::find(const QString& key) { if (mn_map.isEmpty()) { @@ -138,73 +142,75 @@ int ModifierNames::find(const QString& key) { QMap<QString, int>::Iterator it = mn_map.find(key); if (it == mn_map.end()) { return -1; } else { return it.data(); } } const QString& ModifierNames::find(int k) { if (mn_map.isEmpty()) { init_mn_maps(); } QMap<int, QString>::Iterator it = mn_rmap.find(k); if (it == mn_rmap.end()) { return Null_String; } else { return it.data(); } } // Implementation of KeycodeNames -struct { +struct Keycode_Names_t { char* name; int keycode; -} Keycode_Names[] = { +}; + +static const Keycode_Names_t Keycode_Names[] = { { "Escape", 0x1000 }, { "Tab", 0x1001 }, { "Backtab", 0x1002 }, - { "Backspace", 0x1003 }, + { "Backspace", 0x1003 }, { "BackSpace", 0x1003 }, { "Return", 0x1004 }, { "Enter", 0x1005 }, { "Insert", 0x1006 }, { "Delete", 0x1007 }, { "Pause", 0x1008 }, { "Print", 0x1009 }, { "SysReq", 0x100a }, { "Home", 0x1010 }, { "End", 0x1011 }, { "Left", 0x1012 }, { "Up", 0x1013 }, { "Right", 0x1014 }, { "Down", 0x1015 }, - { "Prior", 0x1016 }, - { "PageUp", 0x1016 }, - { "Next", 0x1017 }, + { "Prior", 0x1016 }, + { "PageUp", 0x1016 }, + { "Next", 0x1017 }, { "PageDown", 0x1017 }, { "Shift", 0x1020 }, { "Control", 0x1021 }, { "Meta", 0x1022 }, { "Alt", 0x1023 }, { "CapsLock", 0x1024 }, { "NumLock", 0x1025 }, { "ScrollLock", 0x1026 }, { "F1", 0x1030 }, { "F2", 0x1031 }, { "F3", 0x1032 }, { "F4", 0x1033 }, { "F5", 0x1034 }, { "F6", 0x1035 }, { "F7", 0x1036 }, { "F8", 0x1037 }, { "F9", 0x1038 }, { "F10", 0x1039 }, { "F11", 0x103a }, { "F12", 0x103b }, { "F13", 0x103c }, { "F14", 0x103d }, { "F15", 0x103e }, { "F16", 0x103f }, diff --git a/noncore/games/qasteroids/view.cpp b/noncore/games/qasteroids/view.cpp index 352c63b..3a4d410 100644 --- a/noncore/games/qasteroids/view.cpp +++ b/noncore/games/qasteroids/view.cpp @@ -34,55 +34,56 @@ #define REFRESH_DELAY 33 #define SHIP_SPEED 0.3 #define MISSILE_SPEED 10.0 #define SHIP_STEPS 64 #define ROTATE_RATE 2 #define SHIELD_ON_COST 1 #define SHIELD_HIT_COST 30 #define BRAKE_ON_COST 4 #define MAX_ROCK_SPEED 2.5 #define MAX_POWERUP_SPEED 1.5 #define MAX_SHIP_SPEED 8 #define MAX_BRAKES 5 #define MAX_SHIELDS 5 #define MAX_FIREPOWER 5 #define TEXT_SPEED 4 #define PI_X_2 6.283185307 #ifndef M_PI #define M_PI 3.141592654 #endif -struct +struct kas_animations_t { int id; const char *path; int frames; -} -kas_animations [] = +}; + +static const kas_animations_t kas_animations [] = { // { ID_ROCK_LARGE, "rock1/rock1\%1.png", 32 }, { ID_ROCK_MEDIUM, "rock2/rock2\%1.png", 32 }, { ID_ROCK_SMALL, "rock3/rock3\%1.png", 32 }, { ID_SHIP, "ship/ship\%1.png", 32 }, { ID_MISSILE, "missile/missile.png", 0 }, { ID_BIT, "bits/bits\%1.png", 16 }, { ID_EXHAUST, "exhaust/exhaust.png", 0 }, { ID_ENERGY_POWERUP, "powerups/energy.png", 0 }, // { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 }, { ID_BRAKE_POWERUP, "powerups/brake.png", 0 }, { ID_SHIELD_POWERUP, "powerups/shield.png", 0 }, { ID_SHOOT_POWERUP, "powerups/shoot.png", 0 }, { ID_SHIELD, "shield/shield\%1.png", 6 }, { 0, 0, 0 } }; KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) : QWidget( parent, name ), field(200, 200), view(&field,this) { diff --git a/noncore/games/solitaire/cardpile.h b/noncore/games/solitaire/cardpile.h index 1eb2499..757e6b3 100644 --- a/noncore/games/solitaire/cardpile.h +++ b/noncore/games/solitaire/cardpile.h @@ -1,46 +1,48 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef CARD_PILE_H #define CARD_PILE_H +#include "card.h" + #include <qpoint.h> #include <qlist.h> enum ePileStackingType { pileCascades = 0, pileStacks, pileCascadesOrStacks }; enum ePileFaceingType { pileFaceUp = 0, pileFaceDown, pileFaceUpOrDown }; class Card; class Config; class CardPile : public QList<Card> { public: CardPile(int x, int y); virtual ~CardPile() { } |