Package list pipenightdreams / b411bad7-171a-4993-af8f-fba2797a8b77/main debian / patches / source.patch
b411bad7-171a-4993-af8f-fba2797a8b77/main

Tree @b411bad7-171a-4993-af8f-fba2797a8b77/main (Download .tar.gz)

source.patch @b411bad7-171a-4993-af8f-fba2797a8b77/mainraw · history · blame

From: Debian Games Team <pkg-games-devel@lists.alioth.debian.org>
Date: Tue, 24 Nov 2015 17:59:23 +0100
Subject: source

---
 src/config.h.in         |  2 +-
 src/eventmanager.cpp    |  2 +-
 src/graphic.cpp         |  6 +++---
 src/hash.cpp            |  8 ++++----
 src/image.cpp           |  2 +-
 src/level.ll            | 28 ++++++++++++++--------------
 src/list.cpp            |  4 ++--
 src/main.cpp            |  6 ++++--
 src/pipe.cpp            |  4 ++--
 src/pipenightdreams.cpp |  1 +
 src/player.cpp          |  8 --------
 src/player.h            |  9 +++++++--
 src/pointer.cpp         | 23 +----------------------
 src/pointer.h           | 26 +++++++++++++++++++++-----
 src/score.cpp           |  2 +-
 src/str.cpp             |  6 +++---
 16 files changed, 66 insertions(+), 71 deletions(-)

diff --git a/src/config.h.in b/src/config.h.in
index 31064ca..60e0680 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -1,4 +1,4 @@
-/* src/config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* src/config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
 
 /* Define if lex declares yytext as a char * by default, not a char[].  */
 #undef YYTEXT_POINTER
diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp
index e31941a..e2e7cd4 100644
--- a/src/eventmanager.cpp
+++ b/src/eventmanager.cpp
@@ -40,7 +40,7 @@ void EventManager::removeStream(EventStream * s){
   lista_streams->remove(lista_streams->indexOf(s));
 }
 
-void EventManager::pumpEvents(bool wait=false){
+void EventManager::pumpEvents(bool wait){
   SDL_Event event;
   Index * stream;
   bool got=false;
diff --git a/src/graphic.cpp b/src/graphic.cpp
index 9e0867e..4360c22 100644
--- a/src/graphic.cpp
+++ b/src/graphic.cpp
@@ -44,11 +44,11 @@ Graphic::~Graphic(){
   if (pixels) free(pixels);
 }
 
-void Graphic::setAlpha(char value=OPAQUE){
+void Graphic::setAlpha(char value){
   SDL_SetAlpha(surface, SDL_SRCALPHA, value);
 }
 
-void Graphic::enableClipping(bool flag=true){
+void Graphic::enableClipping(bool flag){
 
   if (flag){
     SDL_Rect rect;
@@ -68,7 +68,7 @@ void Graphic::setClipping(int x, int y, int width, int height){
   clip_height=height;
 }
 
-void Graphic::flip(Axis a=HAxis){
+void Graphic::flip(Axis a){
   if (surface){
     if (SDL_MUSTLOCK(surface))
       if (SDL_LockSurface(surface)<0) return;
diff --git a/src/hash.cpp b/src/hash.cpp
index a8be35d..3560842 100644
--- a/src/hash.cpp
+++ b/src/hash.cpp
@@ -55,10 +55,10 @@ int Hash::function(Str * str){
   return(sum % nbuckets);
 }
 
-Hash::Hash(int bs=256){
+Hash::Hash(int bs){
  int i;
  nbuckets=bs;
- lbuckets=new (List *)[nbuckets];
+ lbuckets=new List *[nbuckets];
 
  for (i=0;i<nbuckets;i++)
    lbuckets[i]=new List();
@@ -99,7 +99,7 @@ Hash::Result Hash::add(Str * str, Object * obj){
   return NotAdded;
 }
 
-Hash::Result Hash::remove(Str * str, bool del=false){
+Hash::Result Hash::remove(Str * str, bool del){
   if (str){
     Index * i;
     List * list=lbuckets[function(str)];
@@ -135,7 +135,7 @@ Object * Hash::find(Str * str){
   return NULL;
 }
 
-void Hash::empty(bool del=true){
+void Hash::empty(bool del){
   int i;
   List * list;
   for (i=0;i<nbuckets;i++){
diff --git a/src/image.cpp b/src/image.cpp
index b4e6be5..aa4344c 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -19,7 +19,7 @@
 #include "SDL_image.h"
 #include <stdio.h>
 
-Image::Image(Str * filename=NULL):Graphic(){
+Image::Image(Str * filename):Graphic(){
   if (filename) load(filename);
 }
 
diff --git a/src/level.ll b/src/level.ll
index 26e7608..9877572 100644
--- a/src/level.ll
+++ b/src/level.ll
@@ -93,6 +93,20 @@
 #define INVALID									100
 
 int nline;
+
+int Level::load(Str * filename){
+  YY_FLUSH_BUFFER;
+  nline=1;
+  if (!(yyin=fopen(filename->get(), "r"))){
+   delete filename;
+   return 1;
+  }
+  delete filename;
+  level();
+  fclose(yyin);
+  if (error) return -1;
+  return 0;
+}
 %}
 
 %option noyywrap
@@ -599,17 +613,3 @@ void Level::level(){
   }else printError(new Str("'pipenightdreams' not found"));
 }
 
-int Level::load(Str * filename){
-  YY_FLUSH_BUFFER;
-  nline=1;
-  if (!(yyin=fopen(filename->get(), "r"))){
-   delete filename;
-   return 1;
-  }
-  delete filename;
-  level();
-  fclose(yyin);
-  if (error) return -1;
-  return 0;
-}
-
diff --git a/src/list.cpp b/src/list.cpp
index 836527e..7d4f5ed 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -125,7 +125,7 @@ List::Result List::insert(int i, Object * obj){
   return (insert(indexOf(i), obj));
 }
 
-List::Result List::remove(Index * index, bool del=false){
+List::Result List::remove(Index * index, bool del){
   if (isEmpty()) return EmptyList;
   if (!index) return NullIndex;
 
@@ -155,7 +155,7 @@ List::Result List::remove(Index * index, bool del=false){
   return Removed;
 }
 
-void List::empty(bool del=true){
+void List::empty(bool del){
   while (!isEmpty())
     remove(getFirst(), del);
 }
diff --git a/src/main.cpp b/src/main.cpp
index 36adf7a..fca6e76 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -36,10 +36,12 @@ int main(int argc, char *argv[])
       if (data_dir) delete data_dir;
       data_dir=new Str(argv[++i]);
     }else
-      if (!strcmp("--fullscreen", argv[i]))
+      if (!strcmp("--level", argv[i])) {
+	level = atoi(argv[++i]);
+      } else if (!strcmp("--fullscreen", argv[i]))
         fullscreen=true;
       else{
-        printf("Invalid Data Dir\nUse pipenightdreams [--datadir <DATA DIR>] [--fullscreen]\n");
+        printf("Invalid Data Dir\nUse pipenightdreams [--datadir <DATA DIR>] [--fullscreen] [--level <level>]\n");
         printf("Using default: %s\n", GAME_DATADIR);
       }
     i++;
diff --git a/src/pipe.cpp b/src/pipe.cpp
index e39d547..cbfaebf 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -43,11 +43,11 @@ bool Pipe::isRemovable(){
   return !(full_level>0) && !fixed;
 }
 
-void Pipe::setFixed(bool flag=true){
+void Pipe::setFixed(bool flag){
   fixed=flag;
 }
 
-void Pipe::setBonus(Bonus bonus=NormalBonus){
+void Pipe::setBonus(Bonus bonus){
   this->bonus=bonus;
 }
 
diff --git a/src/pipenightdreams.cpp b/src/pipenightdreams.cpp
index 441c517..51e2f4e 100644
--- a/src/pipenightdreams.cpp
+++ b/src/pipenightdreams.cpp
@@ -99,6 +99,7 @@ void PipeNightDreams::run(){
     switch (error){
       case 1:{
         showFinal();
+        game_over=true;
         break;
       }
       case -1:{
diff --git a/src/player.cpp b/src/player.cpp
index 5e923e9..96faa70 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -163,14 +163,6 @@ void Player::paint(VideoManager * vm){
     queue->paint(vm);
 }
 
-void Player::setRestrictionCoef(unsigned int coef){
-  queue->setRestrictionCoef(coef);
-}
-
-void Player::setFixedCoef(unsigned int coef){
-  queue->setFixedCoef(coef);
-}
-
 void Player::tick(){
   score->tick();
 
diff --git a/src/player.h b/src/player.h
index 92bda6d..c17d5ba 100644
--- a/src/player.h
+++ b/src/player.h
@@ -47,8 +47,13 @@ class Player : protected AnimatedCanvas{
     void setStartRowColumn(int row, int column);
     void setBoard(Board * bd);
 
-    inline void setRestrictionCoef(unsigned int coef);
-    inline void setFixedCoef(unsigned int coef);
+    inline void setRestrictionCoef(unsigned int coef){
+      queue->setRestrictionCoef(coef);
+    }
+
+    inline void setFixedCoef(unsigned int coef){
+      queue->setFixedCoef(coef);
+    }
 
     void incLives();
     void decLives();
diff --git a/src/pointer.cpp b/src/pointer.cpp
index 8e31394..2d15793 100644
--- a/src/pointer.cpp
+++ b/src/pointer.cpp
@@ -17,7 +17,7 @@
 
 #include "pointer.h"
 
-Pointer::Pointer(int row=0, int column=0){
+Pointer::Pointer(int row, int column){
   this->row=row;
   this->column=column;
   this->moved_flag=true;
@@ -25,27 +25,6 @@ Pointer::Pointer(int row=0, int column=0){
 
 Pointer::~Pointer(){ delete image_name;}
 
-void Pointer::setRow(int row){
-  this->row=row;
-}
-
-void Pointer::setColumn(int column){
-  this->column=column;
-}
-
-void Pointer::setRowColumn(int row, int column){
-  this->row=row;
-  this->column=column;
-}
-
-void Pointer::setMoved(bool flag){
-  moved_flag=flag;
-}
-
-bool Pointer::moved(){
- return moved_flag;
-}
-
 int Pointer::getRow(){
   return row;
 }
diff --git a/src/pointer.h b/src/pointer.h
index be271cb..25ddd50 100644
--- a/src/pointer.h
+++ b/src/pointer.h
@@ -43,11 +43,27 @@ class Pointer: public Canvas{
 
     friend class Board;
 
-    inline void setRow(int row);
-    inline void setColumn(int column);
-    inline void setRowColumn(int row, int column);
-    inline void setMoved(bool flag);
-    inline bool moved();
+    inline void setRow(int row){
+      this->row=row;
+    }
+
+    inline void setColumn(int column){
+      this->column=column;
+    }
+
+    inline void setRowColumn(int row, int column){
+      this->row=row;
+      this->column=column;
+    }
+
+    inline void setMoved(bool flag){
+       moved_flag=flag;
+    }
+
+    inline bool moved(){
+      return moved_flag;
+    }
+
 
     Str * image_name;
     Image * ima;
diff --git a/src/score.cpp b/src/score.cpp
index 6e2e4b5..7744c16 100644
--- a/src/score.cpp
+++ b/src/score.cpp
@@ -18,7 +18,7 @@
 #include "score.h"
 #include <math.h>
 
-Score::Score(int value=0){
+Score::Score(int value){
   this->value=value;
   delta=0;
   changed=true;
diff --git a/src/str.cpp b/src/str.cpp
index fca6e6c..f2338ad 100644
--- a/src/str.cpp
+++ b/src/str.cpp
@@ -11,7 +11,7 @@
 
 const char Str::nul = '\0';
 
-Str::Str(const char * string=NULL){
+Str::Str(const char * string){
   s=NULL;
   set(string);
 }
@@ -25,7 +25,7 @@ Str::~Str(){
   if (s) delete[] s;
 }
 
-void Str::set(const char * string=NULL){
+void Str::set(const char * string){
   if (s) delete[] s;
   if (string){
     s=new char[strlen(string)+1];
@@ -71,7 +71,7 @@ int Str::lenght(){
   return (strlen(s));
 }
 
-bool Str::isEqual(Str * str, bool case_sensitive = true){
+bool Str::isEqual(Str * str, bool case_sensitive){
   if (case_sensitive){
     return (!strcmp(s, str->s));
   }