diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-11 12:09:04 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-11 12:09:04 +0200 |
| commit | 98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02 (patch) | |
| tree | ddd164d3339a067116f02f88314e2f57457bb1df /pacman-c++/server.cpp | |
| parent | 30c36b7549f8ae411f8eca4de144627331895a24 (diff) | |
| download | foop-98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02.tar.gz foop-98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02.tar.bz2 foop-98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02.zip | |
Added basic game logic
Diffstat (limited to 'pacman-c++/server.cpp')
| -rw-r--r-- | pacman-c++/server.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index ba2b3c9..b631345 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -74,8 +74,15 @@ Transmission::map_t Server::calculateUpdates() | |||
| 74 | newMapPosition.setY(visualMap[newMapPosition.x()].size() - 1); | 74 | newMapPosition.setY(visualMap[newMapPosition.x()].size() - 1); |
| 75 | 75 | ||
| 76 | // <t3h g4m3 10gic> | 76 | // <t3h g4m3 10gic> |
| 77 | if(dynamic_cast<Block*>(visualMap[newMapPosition.x()][newMapPosition.y()]) != 0) | 77 | // TODO: support actors eating each other |
| 78 | continue; | 78 | PixmapItem *item = visualMap[newMapPosition.x()][newMapPosition.y()]; |
| 79 | if (item != NULL) { | ||
| 80 | if (! item->checkEnter(actor)) { // movement invalid | ||
| 81 | newMapPosition = mapPosition; | ||
| 82 | } else { // apply actions of entering this field | ||
| 83 | item->enter(actor); | ||
| 84 | } | ||
| 85 | } | ||
| 79 | // </t3h g4m2 10gic> | 86 | // </t3h g4m2 10gic> |
| 80 | 87 | ||
| 81 | if (mapPosition != newMapPosition) | 88 | if (mapPosition != newMapPosition) |
| @@ -114,7 +121,7 @@ void Server::waitForClientConnections() | |||
| 114 | { | 121 | { |
| 115 | QTcpServer *tcpSrv = new QTcpServer(this); | 122 | QTcpServer *tcpSrv = new QTcpServer(this); |
| 116 | // server must stay alive as long as sockets (qt parent mem mechanism) | 123 | // server must stay alive as long as sockets (qt parent mem mechanism) |
| 117 | tcpSrv->listen(QHostAddress::Any, Constants::port); | 124 | tcpSrv->listen(QHostAddress::Any, Constants::Networking::port); |
| 118 | 125 | ||
| 119 | #define SINGLE | 126 | #define SINGLE |
| 120 | 127 | ||
