Mercurial > repo
annotate interps/rail/src/Vec.h @ 2375:96c770628fda
<oerjan> undo 2374
author | HackBot |
---|---|
date | Tue, 05 Mar 2013 00:13:29 +0000 |
parents | 859f9b4339e6 |
children |
rev | line source |
---|---|
996 | 1 // Vec.h |
2 | |
3 #ifndef VEC_H_RAIL_1 | |
4 #define VEC_H_RAIL_1 | |
5 | |
6 struct Vec | |
7 { | |
8 Vec() : x(0), y(0) {} | |
9 Vec(int newX, int newY) : x(newX), y(newY) {} | |
10 | |
11 Vec & operator+=(Vec right) | |
12 { | |
13 x += right.x; | |
14 y += right.y; | |
15 return *this; | |
16 } | |
17 | |
18 Vec operator+(Vec right) | |
19 { | |
20 Vec result(*this); | |
21 result += right; | |
22 return result; | |
23 } | |
24 | |
25 bool operator==(Vec const & right) const | |
26 { | |
27 return x == right.x && y == right.y; | |
28 } | |
29 | |
30 int x; | |
31 int y; | |
32 }; | |
33 | |
34 #endif |