Changeset 0129700 in network-game for server


Ignore:
Timestamp:
Dec 19, 2013, 3:31:45 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
fef7c69
Parents:
70fc3e8
Message:

The Game class validates player movement on the server side

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r70fc3e8 r0129700  
    818818              p->addr.sin_port == from.sin_port )
    819819         {
    820             // we need to make sure the player can move here
    821             if (0 <= x && x < gameMap->width*25 && 0 <= y && y < gameMap->height*25 &&
    822                gameMap->getElement(x/25, y/25) == WorldMap::TERRAIN_GRASS)
    823             {
    824                cout << "valid terrain" << endl;
    825 
    826                p->target.x = x;
    827                p->target.y = y;
    828 
    829                p->isChasing = false;
    830                p->isAttacking = false;
    831 
     820            if (p->currentGame->startPlayerMovement(id, x, y)) {
    832821               serverMsg.type = MSG_TYPE_PLAYER_MOVE;
    833822               
Note: See TracChangeset for help on using the changeset viewer.