summaryrefslogtreecommitdiff
path: root/noncore
authorzecke <zecke>2004-09-10 11:14:02 (UTC)
committer zecke <zecke>2004-09-10 11:14:02 (UTC)
commitb8baf551919868737c6f56a05e6efa1bad4d97ac (patch) (side-by-side diff)
tree402c587e55356aff7f13990e1efcf57775bb9670 /noncore
parent046bff8abb6727f5522748a2dc8a259d27b5979b (diff)
downloadopie-b8baf551919868737c6f56a05e6efa1bad4d97ac.zip
opie-b8baf551919868737c6f56a05e6efa1bad4d97ac.tar.gz
opie-b8baf551919868737c6f56a05e6efa1bad4d97ac.tar.bz2
Remove unused parameter
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/decorations/flat/flat.cpp2
-rw-r--r--noncore/games/bounce/game.cpp7
-rw-r--r--noncore/games/kbill/Game.cc0
-rw-r--r--noncore/games/kbill/Game.h2
-rw-r--r--noncore/games/kbill/field.cpp0
-rw-r--r--noncore/games/kbill/inputbox.cpp2
-rw-r--r--noncore/games/kbill/kbill.h2
-rw-r--r--noncore/games/zsame/ZSameWidget.cpp12
8 files changed, 15 insertions, 12 deletions
diff --git a/noncore/decorations/flat/flat.cpp b/noncore/decorations/flat/flat.cpp
index a2f12be..9a670cc 100644
--- a/noncore/decorations/flat/flat.cpp
+++ b/noncore/decorations/flat/flat.cpp
@@ -241,97 +241,97 @@ int FlatDecoration::metric( Metric m, const WindowData *wd ) const
void FlatDecoration::drawArea( Area a, QPainter *p, const WindowData *wd ) const
{
int th = metric( TitleHeight, wd );
QRect r = wd->rect;
switch ( a ) {
case Border:
{
const QColorGroup &cg = wd->palette.active();
if ( wd->flags & WindowData::Active ) {
p->setBrush( cg.color(QColorGroup::Highlight) );
} else {
p->setBrush( cg.color(QColorGroup::Background) );
}
p->setPen( cg.foreground() );
int lb = metric(LeftBorder,wd);
int rb = metric(RightBorder,wd);
int tb = metric(TopBorder,wd);
int bb = metric(BottomBorder,wd);
p->drawRect( r.x()-lb, r.y()-tb-th, r.width()+lb+rb,
r.height()+th+tb+bb );
}
break;
case Title:
if ( r.height() < 2 ) {
WindowDecorationInterface::drawArea( a, p, wd );
} else {
const QColorGroup &cg = wd->palette.active();
QColor c;
if ( wd->flags & WindowData::Active )
c = cg.color(QColorGroup::Highlight);
else
c = cg.color(QColorGroup::Background);
p->fillRect( QRect(r.x(),r.y()-th,r.width(),th), c );
}
break;
case TitleText:
p->drawText( r.left()+3+metric(HelpWidth,wd), r.top()-th,
r.width()-metric(HelpWidth,wd)-metric(CloseWidth,wd), th,
Qt::AlignVCenter, wd->caption );
break;
default:
FlatDecoration::drawArea( a, p, wd );
break;
}
}
-void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int w, int h, QWSButton::State state ) const
+void FlatDecoration::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const
{
QColor c;
const QColorGroup &cg = wd->palette.active();
if ( wd->flags & WindowDecorationInterface::WindowData::Active )
c = cg.color(QColorGroup::HighlightedText);
else
c = cg.color(QColorGroup::Foreground);
bool r = (state & QWSButton::MouseOver) && (state & QWSButton::Clicked);
int th = metric(TitleHeight, wd);
QString key( "%1-%2-%3-%4" );
key = key.arg(b).arg(th).arg(c.name()).arg(r ? "1" : "0");
QImage *img = buttonCache.find( key );
if ( !img ) {
QImage tmp;
switch ( b ) {
case OK:
tmp = QImage( ok_xpm );
break;
case Close:
tmp = QImage( close_xpm );
break;
case Help:
tmp = QImage( help_xpm );
break;
case Maximize:
tmp = QImage( maximize_xpm );
break;
}
colorize( tmp, c, r );
img = new QImage( scaleButton(tmp,th) );
FlatDecoration *that = (FlatDecoration *)this;
that->buttonCache.insert( key, img, 1 );
}
p->drawImage( x, y, *img );
}
QRegion FlatDecoration::mask( const WindowData *wd ) const
{
return WindowDecorationInterface::mask( wd );
}
QString FlatDecoration::name() const
{
return qApp->translate( "Decoration", "Flat" );
}
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index bbd3d0b..5ef9f15 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -55,122 +55,122 @@ Arrow::Arrow(QCanvasPixmapArray* array, QCanvas* canvas)
}
void Arrow::update()
{
if ( m_vertical )
setFrame( 0 );
else
setFrame( 1 );
}
void Arrow::changeDirection()
{
m_vertical = ! m_vertical;
update();
}
Ball::Ball(QCanvasPixmapArray* array, QCanvas* canvas)
: QCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
{
}
void Ball::update()
{
m_animDelay--;
if ( m_animDelay<=0 )
{
m_animDelay = MS2TICKS(BALL_ANIM_DELAY);
int frameNum = frame();
frameNum++;
if ( frameNum>=frameCount() )
frameNum = 0;
setFrame( frameNum );
}
}
void Ball::advance(int stage)
{
bool reflectX = false;
bool reflectY = false;
// check for collisions
if ( collide(xVelocity(), 0) ) reflectX = true;
if ( collide(0, yVelocity()) ) reflectY = true;
if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true;
// emit collision
QRect r = boundingRect();
- r.moveBy( xVelocity(), yVelocity() );
+ r.moveBy( static_cast<int>(xVelocity()), static_cast<int>( yVelocity() ) );
JezzField* field = (JezzField *)canvas();
int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
if ( ul!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.top() / TILE_SIZE, ul ); else
if ( ur!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.top() / TILE_SIZE, ur ); else
if ( bl!=TILE_FREE ) field->emitBallCollisiton( this, r.left() / TILE_SIZE, r.bottom() / TILE_SIZE, bl ); else
if ( br!=TILE_FREE ) field->emitBallCollisiton( this, r.right() / TILE_SIZE, r.bottom() / TILE_SIZE, br );
// apply reflection
if ( reflectX ) setXVelocity( -xVelocity() );
if ( reflectY ) setYVelocity( -yVelocity() );
// update field
update();
QCanvasSprite::advance( stage );
}
bool Ball::collide( double dx, double dy )
{
QRect r = boundingRect();
- r.moveBy( dx, dy );
+ r.moveBy( static_cast<int>( dx ), static_cast<int>( dy ) );
JezzField* field = (JezzField *)canvas();
int ul = field->tile( r.left() / TILE_SIZE, r.top() / TILE_SIZE );
int ur = field->tile( r.right() / TILE_SIZE, r.top() / TILE_SIZE );
int bl = field->tile( r.left() / TILE_SIZE, r.bottom() / TILE_SIZE );
int br = field->tile( r.right() / TILE_SIZE, r.bottom() / TILE_SIZE );
return ( ul!=TILE_FREE || ur!=TILE_FREE || bl!=TILE_FREE || br!=TILE_FREE );
}
/*************************************************************************/
Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, QObject *parent, const char *name )
: QObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true )
{
// setup position and direction
m_dx = 0;
m_dy = 0;
switch ( m_dir )
{
case Up: m_dy = -1; break;
case Down: m_dy = 1; break;
case Left: m_dx = -1; break;
case Right: m_dx = 1; break;
}
m_x = m_startX;
m_y = m_startY;
m_field->setTile( m_x, m_y, m_tile );
}
void Wall::finish()
{
m_active = false;
}
bool Wall::isFree( int x, int y )
{
if ( m_field->tile(x, y)==TILE_FREE )
{
// check whether there is a ball at the moment
QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE,
TILE_SIZE, TILE_SIZE) );
if ( cols.count()==0 )
return true;
}
@@ -368,97 +368,98 @@ JezzGame::~JezzGame()
{
m_balls.clear();
delete m_view;
delete m_field;
delete m_ballPixmaps;
}
void JezzGame::display( QString text, int size )
{
odebug << "This function \"display\" shouldn't be called!!!" << oendl;
if ( !text.isEmpty() )
{
QFont font( "Helvetica", size, QFont::Bold );
font.setStyleHint( QFont::Helvetica );
m_text->setFont( font );
m_text->setText( text );
QRect size = m_text->boundingRect();
m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
m_text->show();
} else
{
m_text->hide();
}
}
void JezzGame::start()
{
m_running = true;
}
void JezzGame::stop()
{
m_running = false;
}
void JezzGame::makeBlack()
{
// copy current field into buffer
for ( int y=0; y<FIELD_HEIGHT; y++ )
for ( int x=0; x<FIELD_WIDTH; x++ )
m_buf[x][y] = m_field->tile( x, y );
// fill areas that contains a ball
for ( Ball *ball=m_balls.first(); ball!=0; ball=m_balls.next() )
- fill( ball->x()/TILE_SIZE, ball->y()/TILE_SIZE );
+ fill( static_cast<int>( ball->x()/TILE_SIZE ),
+ static_cast<int>( ball->y()/TILE_SIZE ) );
// areas still free can be blacked now
for ( int y=0; y<FIELD_HEIGHT; y++ )
for ( int x=0; x<FIELD_WIDTH; x++ )
{
if ( m_buf[x][y]==TILE_FREE )
m_field->setGameTile( x, y, true );
}
m_field->update();
m_view->repaint();
// count percent value of occupied area
int p = percent();
if ( p!=m_percent )
{
m_percent = p;
emit newPercent( m_percent );
}
}
int JezzGame::percent()
{
int notFree = 0;
for ( int y=1; y<FIELD_HEIGHT-1; y++ )
for ( int x=1; x<FIELD_WIDTH-1; x++ )
{
if ( m_field->tile(x,y)!=TILE_FREE )
notFree++;
}
return 100 * notFree / ( (FIELD_WIDTH-1) * (FIELD_HEIGHT-1) );
}
void JezzGame::fill( int x, int y )
{
if ( m_buf[x][y]!=TILE_FREE) return;
// go left
int _x=x;
for ( ; m_buf[_x][y]==TILE_FREE; _x-- )
m_buf[_x][y] = TILE_BORDER;
int stopx = _x;
// fill above
for ( _x=x; _x>stopx; _x-- )
if ( m_buf[_x][y-1]==TILE_FREE ) fill( _x, y-1 );
diff --git a/noncore/games/kbill/Game.cc b/noncore/games/kbill/Game.cc
index 624b50b..4cd5322 100644
--- a/noncore/games/kbill/Game.cc
+++ b/noncore/games/kbill/Game.cc
diff --git a/noncore/games/kbill/Game.h b/noncore/games/kbill/Game.h
index 4473936..5c9c497 100644
--- a/noncore/games/kbill/Game.h
+++ b/noncore/games/kbill/Game.h
@@ -1,55 +1,55 @@
#ifndef GAME_H
#define GAME_H
#include "objects.h"
class Game {
- unsigned state;
+ int state;
int efficiency;
public:
unsigned score, level, iteration;
Picture logo;
int grabbed;
static const unsigned short scrwidth = 240;
static const unsigned short scrheight = 290;
static const int PLAYING = 1;
static const int BETWEEN = 2;
static const int END = 3;
static const int WAITING = 4;
static const int DEFAULTC = 0; /* cursors */
static const int DOWNC = -1;
static const int BUCKETC = -2;
static const int ENDGAME = 200; /* dialog window IDs */
static const int ENTERNAME = 201;
static const int HIGHSCORE = 202;
static const int SCORE = 203;
static const int ENDLEVEL = -1; /* Codes for updating score */
static const int BILLPOINTS = 5;
static const int EMPTY = -2; /* Grabbed object */
static const int BUCKET = -1;
int RAND(int lb, int ub);
int MAX(int x, int y);
int MIN(int x, int y);
int INTERSECT(int x1, int y1, int w1, int h1, int x2, int y2, int w2,
int h2);
void setup_level (unsigned int lev);
void start(unsigned int lev);
void quit();
void update_info();
void update_score (int action);
void warp_to_level (unsigned int lev);
void button_press(int x, int y);
void button_release(int x, int y);
void update();
void main(int argc, char **argv);
};
#endif
diff --git a/noncore/games/kbill/field.cpp b/noncore/games/kbill/field.cpp
index a974ab2..0dd8d72 100644
--- a/noncore/games/kbill/field.cpp
+++ b/noncore/games/kbill/field.cpp
diff --git a/noncore/games/kbill/inputbox.cpp b/noncore/games/kbill/inputbox.cpp
index 5087fbb..7aaebe7 100644
--- a/noncore/games/kbill/inputbox.cpp
+++ b/noncore/games/kbill/inputbox.cpp
@@ -1,50 +1,50 @@
/***************************************************************************
inputbox.cpp - description
-------------------
begin : Sat Jan 1 2000
copyright : (C) 2000 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* 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 *
* (at your option) any later version. *
* *
***************************************************************************/
#include "inputbox.h"
-InputBox::InputBox(QWidget *parent, const char *name, const char *caption, const char *text) : QDialog(parent, name, TRUE) {
+InputBox::InputBox(QWidget *parent, const char *name, const char *, const char *) : QDialog(parent, name, TRUE) {
// setCaption(caption);
//
// question = new QLabel(this);
// question->setText(text);
// question->setGeometry(10, 10, 240, 50);
//
// input = new QLineEdit(this);
// input->setGeometry(10, 60, 240, 30);
// input->setFocus();
// input->setMaxLength(19);
//
// ok = new QPushButton( "Ok", this );
// ok->setGeometry(10, 100, 100,30 );
// ok->setDefault(TRUE);
// connect( ok, SIGNAL(clicked()), SLOT(accept()) );
//
// cancel = new QPushButton( "Cancel", this );
// cancel->setGeometry(150, 100, 100,30 );
// connect( cancel, SIGNAL(clicked()), SLOT(reject()) );
}
InputBox::~InputBox(){
delete ok;
delete cancel;
delete question;
delete input;
}
QString InputBox::getText() const{
return input->text();
}
diff --git a/noncore/games/kbill/kbill.h b/noncore/games/kbill/kbill.h
index fbc0c6c..da1a111 100644
--- a/noncore/games/kbill/kbill.h
+++ b/noncore/games/kbill/kbill.h
@@ -1,54 +1,56 @@
/***************************************************************************
kbill.h - description
-------------------
begin : Thu Dec 30 16:55:55 CET 1999
copyright : (C) 1999 by Jurrien Loonstra
email : j.h.loonstra@st.hanze.nl
***************************************************************************/
/***************************************************************************
* *
* 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 *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KBILL_H
#define KBILL_H
#include <qmainwindow.h>
#include <qwidget.h>
#include <qpopupmenu.h>
#include "field.h"
class KBill : public QMainWindow
{
Q_OBJECT
public:
KBill();
~KBill();
Field* getField();
private:
QMenuBar *menu;
QPopupMenu *file, *help;
Field *field;
int pauseid;
+
protected slots:
void Quit();
void About();
void NewGame();
void Pause();
void WarpTo();
void Story();
void Rules();
void ViewHighScores();
+protected:
friend class UI;
};
#endif
diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp
index 4fab0f6..04ad825 100644
--- a/noncore/games/zsame/ZSameWidget.cpp
+++ b/noncore/games/zsame/ZSameWidget.cpp
@@ -64,181 +64,181 @@ ZSameWidget::ZSameWidget( QWidget* parent, const char* name, WFlags fl )
a->addTo( tb );
connect(a, SIGNAL(activated()), this, SLOT(m_new()));
a = new QAction(tr("Restart This Board"), Resource::loadIconSet("redo"),
QString::null, 0, this, "restart_board" );
a->addTo( fileMenu );
connect( a, SIGNAL(activated()), this, SLOT(m_restart()));
restart = a;
a = new QAction( tr("Undo"), Resource::loadIconSet("undo"),
QString::null, 0, this, "undo_action" );
a->addTo( fileMenu );
a->addTo( tb );
connect( a, SIGNAL(activated()), this, SLOT(m_undo()));
a = new QAction(tr("Quit"), Resource::loadIconSet("quit_icon"),
QString::null, 0, this, "quit_action");
a->addTo( fileMenu );
a->addTo( tb );
connect(a, SIGNAL(activated()), this, SLOT(m_quit()));
mb->insertItem(tr("Game" ), fileMenu );
int foo[2];
desktop_widget(foo);
stone = new StoneWidget(this,foo[0],foo[1]);
connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover()));
connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int)));
connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int)));
connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int)));
connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int)));
connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int)));
connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged()));
sizeChanged();
setCentralWidget(stone);
setScore(0);
}
ZSameWidget::~ZSameWidget() {
}
-void ZSameWidget::readProperties(Config *conf) {
+void ZSameWidget::readProperties(Config *) {
/*
Q_ASSERT(conf);
stone->readProperties(conf);
*/
}
-void ZSameWidget::saveProperties(Config *conf) {
+void ZSameWidget::saveProperties(Config *) {
/*
Q_ASSERT(conf);
stone->saveProperties(conf);
conf->sync();
*/
}
void ZSameWidget::sizeChanged() {
// stone->setFixedSize(stone->sizeHint());
}
void ZSameWidget::newGame(unsigned int board,int colors) {
while (board>=1000000) board-=1000000;
// kdDebug() << "newgame board " << board << " colors " << colors << endl;
stone->newGame(board,colors);
setScore(0);
}
bool ZSameWidget::confirmAbort() {
return stone->isGameover() ||
stone->isOriginalBoard() ||
(QMessageBox::warning(this, i18n("Resign"), i18n("<qt>Do you want to resign?</qt>"),
QMessageBox::Yes,
QMessageBox::No|QMessageBox::Default|QMessageBox::Escape, 0) == QMessageBox::Yes );
}
void ZSameWidget::m_new() {
if (confirmAbort())
newGame(_random(),default_colors);
}
void ZSameWidget::m_restart() {
if (confirmAbort())
newGame(stone->board(),default_colors);
}
void ZSameWidget::m_load() {
// kdDebug() << "menu load not supported" << endl;
}
void ZSameWidget::m_save() {
// kdDebug() << "menu save not supported" << endl;
}
void ZSameWidget::m_undo() {
// Q_ASSERT(stone);
stone->undo();
}
void ZSameWidget::m_showhs() {
/* Q_ASSERT(stone);
stone->unmark();
KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this);
d.addField(Board, i18n("Board"), "Board");
d.exec();
*/
}
void ZSameWidget::m_quit() {
// Q_ASSERT(stone);
stone->unmark();
qApp->quit();
// delete this;
}
void ZSameWidget::m_tglboard() {
// kdDebug() << "toggled" << endl;
}
-void ZSameWidget::setColors(int colors) {
+void ZSameWidget::setColors(int ) {
// status->changeItem(i18n("%1 Colors").arg(colors),1);
}
-void ZSameWidget::setBoard(int board) {
+void ZSameWidget::setBoard(int ) {
// status->changeItem(i18n("Board: %1").arg(board, 6), 2);
}
-void ZSameWidget::setMarked(int m) {
+void ZSameWidget::setMarked(int ) {
// status->changeItem(i18n("Marked: %1").arg(m, 6),3);
}
void ZSameWidget::stonesRemoved(int,int) {
// KNotifyClient::event("stones removed",
// i18n("%1 stones removed.").arg(stone->marked()));
}
-void ZSameWidget::setScore(int score) {
+void ZSameWidget::setScore(int ) {
// status->changeItem(i18n("Score: %1").arg(score, 6),4);
// undo->setEnabled(stone->undoPossible());
// restart->setEnabled(!stone->isOriginalBoard());
}
void ZSameWidget::gameover() {
// kdDebug() << "GameOver" << endl;
if (stone->hasBonus()) {
QMessageBox::information(this,i18n("Game won"),
i18n("<qt>You even removed the last stone, great job! "
"This gave you a score of %1 in total.</qt>").arg(stone->score()));
} else {
QMessageBox::information(this,i18n("Game over"),
i18n("<qt>There are no more removeable stones. "
"You got a score of %1 in total.</qt>").arg(stone->score()));
}
stone->unmark();
}
void ZSameWidget::desktop_widget(int *f)const{
QWidget* wid = QApplication::desktop();
/* width > height landscape mode */
if ( wid->width() > wid->height() ) {
f[0]=15;
f[1]=9;
}
/* normal */
else{
f[0]=12;
f[1]=13;
}
}