Changeset b07eeac in network-game for common/Common.cpp


Ignore:
Timestamp:
May 25, 2013, 1:45:54 AM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
2df63d6
Parents:
b81cea1
Message:

Players pick up flags when they get close to the flag objects, not the structres. When a flag is picked up, a REMOVE_OBJECT message is sent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Common.cpp

    rb81cea1 rb07eeac  
    22
    33#include <iostream>
    4 using namespace std;
     4#include <cmath>
    55
    66#if defined WINDOWS
     
    99   #include <time.h>
    1010#endif
     11
     12using namespace std;
     13
     14/*
     15FLOAT_POSITION POSITION::toFloat() {
     16   FLOAT_POSITION floatPosition;
     17   floatPosition.x = x;
     18   floatPosition.y = y;
     19
     20   return floatPosition;
     21}
     22*/
    1123
    1224void set_nonblock(int sock)
     
    3850   return numMilliseconds;
    3951}
     52
     53float posDistance(FLOAT_POSITION pos1, FLOAT_POSITION pos2) {
     54   float xDiff = pos2.x - pos1.x;
     55   float yDiff = pos2.y - pos1.y;
     56
     57   return sqrt( pow(xDiff,2) + pow(yDiff,2) );   
     58}
Note: See TracChangeset for help on using the changeset viewer.