enigma-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-cvs] enigma/src world.cc,1.82,1.83


From: Daniel Heck <address@hidden>
Subject: [Enigma-cvs] enigma/src world.cc,1.82,1.83
Date: Fri, 21 Nov 2003 09:28:26 +0000

Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv10060/src

Modified Files:
        world.cc 
Log Message:
- Fixed bug in AddActor.
- Added World::add_actor() and World::preparing_level


Index: world.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/world.cc,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** world.cc    20 Nov 2003 20:26:26 -0000      1.82
--- world.cc    21 Nov 2003 09:28:24 -0000      1.83
***************
*** 127,133 ****
  
  /* -------------------- RubberBand -------------------- */
- //----------------------------------------
- // Rubber band
- //----------------------------------------
  
  RubberBand::RubberBand (Actor *a1, Actor *a2, double strength_, double 
length_)
--- 127,130 ----
***************
*** 188,194 ****
  }
  
! //----------------------------------------
! // Field
! //----------------------------------------
  
  Field::Field()
--- 185,190 ----
  }
  
! 
! /* -------------------- Field -------------------- */
  
  Field::Field()
***************
*** 206,213 ****
  }
  
! 
! //----------------------------------------
! // StoneContact
! //----------------------------------------
  
  StoneContact::StoneContact(Actor *a, GridPos p,
--- 202,207 ----
  }
  
! 
! /* -------------------- StoneContact -------------------- */
  
  StoneContact::StoneContact(Actor *a, GridPos p,
***************
*** 265,270 ****
  }
  
  
! World::World(int ww, int hh) : fields(ww,hh)
  {
      w = ww;
--- 259,274 ----
  }
  
+ 
+ /* -------------------- Global variables -------------------- */
  
! enigma::Timer world::GameTimer;
! bool world::TrackMessages;
! 
! 
! /* -------------------- World -------------------- */
! 
! World::World(int ww, int hh) 
! : fields(ww,hh),
!   preparing_level(true)
  {
      w = ww;
***************
*** 326,329 ****
--- 330,343 ----
  }
  
+ void World::add_actor (Actor *a, const V2 &pos)
+ {
+     actorlist.push_back(a);
+     a->get_actorinfo()->pos = pos;
+     if (!preparing_level) {
+         // if game is already running, call on_creation() from here
+         a->on_creation(pos);
+     }
+ }
+ 
  void World::tick (double dtime)
  {
***************
*** 336,345 ****
  }
  
! enigma::Timer world::GameTimer;
! bool world::TrackMessages;
! 
! //======================================================================
! //      PUZZLE SCRAMBLING
! //======================================================================
  
  void World::add_scramble(GridPos p, Direction dir)
--- 350,354 ----
  }
  
! /* ---------- Puzzle scrambling -------------------- */
  
  void World::add_scramble(GridPos p, Direction dir)
***************
*** 370,377 ****
  }
  
! 
! //======================================================================
! // PHYSICS SIMULATION
! //======================================================================
  
  /* Calculate the total acceleration on an actor A at time TIME.  The
--- 379,383 ----
  }
  
! /* ---------- Physics simulation ---------- */
  
  /* Calculate the total acceleration on an actor A at time TIME.  The
***************
*** 764,770 ****
  
  
! //----------------------------------------
! // Functions
! //----------------------------------------
  
  void world::Reset ()
--- 770,774 ----
  
  
! /* -------------------- Functions -------------------- */
  
  void world::Reset ()
***************
*** 830,833 ****
--- 834,839 ----
      sb->show_move_counter (enigma::ShowMoves);
  
+     level->preparing_level = false;
+ 
      return true;
  }
***************
*** 1407,1413 ****
  
  void world::AddActor(double x, double y, Actor* a) {
!     level->actorlist.push_back(a);
!     a->get_actorinfo()->pos = V2(x, y);
!     a->on_creation(a->get_actorinfo()->pos);
  }
  
--- 1413,1417 ----
  
  void world::AddActor(double x, double y, Actor* a) {
!     level->add_actor (a, V2(x, y));
  }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]