source:
network-game/common/Common.h@
03ba5e3
| Last change on this file since 03ba5e3 was d05086b, checked in by , 12 years ago | |
|---|---|
|
|
| File size: 680 bytes | |
| Rev | Line | |
|---|---|---|
| [3b1efcc] | 1 | #ifndef _COMMON_H |
| 2 | #define _COMMON_H | |
| 3 | ||
| [4c202e0] | 4 | #include "Compiler.h" |
| 5 | ||
| 6 | #if defined WINDOWS | |
| 7 | #include <winsock2.h> | |
| 8 | #include <WS2tcpip.h> | |
| 9 | #elif defined LINUX | |
| 10 | #include <fcntl.h> | |
| 11 | #include <assert.h> | |
| 12 | #endif | |
| [edfd1d0] | 13 | |
| [d05086b] | 14 | #include <string> |
| 15 | ||
| 16 | using namespace std; | |
| 17 | ||
| [b07eeac] | 18 | typedef struct |
| 19 | { | |
| 20 | float x; | |
| 21 | float y; | |
| 22 | } FLOAT_POSITION; | |
| [edfd1d0] | 23 | |
| 24 | typedef struct | |
| [3b1efcc] | 25 | { |
| [edfd1d0] | 26 | int x; |
| 27 | int y; | |
| [b07eeac] | 28 | FLOAT_POSITION toFloat() { |
| 29 | FLOAT_POSITION floatPosition; | |
| 30 | floatPosition.x = x; | |
| 31 | floatPosition.y = y; | |
| 32 | ||
| 33 | return floatPosition; | |
| 34 | } | |
| [62ee2ce] | 35 | } POSITION; |
| [3b1efcc] | 36 | |
| [b07eeac] | 37 | void set_nonblock(int sock); |
| 38 | unsigned long long getCurrentMillis(); | |
| [d05086b] | 39 | string getCurrentDateTimeString(); |
| [b07eeac] | 40 | float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2); |
| [60017fc] | 41 | |
| [3b1efcc] | 42 | #endif |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/medieval/chrome/site/your_project_logo.png)