Mercurial > repo
annotate interps/rail/src/Vec.h @ 3042:21e6d68feebb
<nooodl> echo sed \\\'s/^[^aeiou]*\\(.*\\)/Thanks, \\0. Th\\1./\\\' >> bin/thanks
author | HackBot |
---|---|
date | Wed, 05 Jun 2013 17:29:17 +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 |