Changeset 264 for trunk/monsterz/mash.cpp
- Timestamp:
- Jan 23, 2011, 2:21:26 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/monsterz/mash.cpp
r262 r264 14 14 15 15 #include <cstdio> 16 #include <cstdlib> 16 17 #include <cmath> 17 18 … … 32 33 Piece *pieces[8 * 8]; 33 34 Int2 cells[8 * 8]; 34 int npieces ;35 int npieces, finished; 35 36 }; 36 37 … … 46 47 Ticker::Ref(game); 47 48 data->npieces = 0; 49 data->finished = 0; 48 50 } 49 51 … … 55 57 } 56 58 59 int Mash::IsFinished() const 60 { 61 return data->finished; 62 } 63 57 64 void Mash::TickGame(float deltams) 58 65 { 59 66 Entity::TickGame(deltams); 67 68 if (data->finished) 69 return; 70 71 int inplace = 1; 72 for (int n = 0; n < data->npieces && inplace; n++) 73 { 74 Int2 dest = data->pieces[n]->GetCell() * 48; 75 Int2 cur = data->pieces[n]->GetPos(); 76 77 if (abs(cur.x - dest.x) > 24) 78 inplace = 0; 79 } 80 81 if (inplace) 82 { 83 for (int n = 0; n < data->npieces; n++) 84 Ticker::Unref(data->pieces[n]); 85 data->finished = 1; 86 } 60 87 } 61 88
Note: See TracChangeset
for help on using the changeset viewer.