Skip to content

Commit

Permalink
Disabled plane flying over rift. People escaping early makes it impos…
Browse files Browse the repository at this point in the history
…sible to test properly.
  • Loading branch information
jasonrohrer committed Jul 31, 2019
1 parent 1815683 commit a54f9ea
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions documentation/changeLog.txt
Expand Up @@ -87,6 +87,9 @@ Server Fixes
surrounded by desert surrounded by jungle. Every grassy area is a good
settlement spot, because it's always next to a swamp.

--Disabled plane flying over rift. People escaping early makes it impossible
to test properly.




Expand Down
32 changes: 31 additions & 1 deletion server/map.cpp
Expand Up @@ -8279,16 +8279,34 @@ GridPos getNextCloseLandingPos( GridPos inCurPos,


GridPos getNextFlightLandingPos( int inCurrentX, int inCurrentY,
doublePair inDir ) {
doublePair inDir,
int inRadiusLimit ) {
int closestIndex = -1;
GridPos closestPos;
double closestDist = DBL_MAX;

GridPos curPos = { inCurrentX, inCurrentY };

char useLimit = false;

if( abs( inCurrentX ) <= inRadiusLimit &&
abs( inCurrentY ) <= inRadiusLimit ) {
useLimit = true;
}



for( int i=0; i<flightLandingPos.size(); i++ ) {
GridPos thisPos = flightLandingPos.getElementDirect( i );

if( useLimit &&
( abs( thisPos.x ) > inRadiusLimit ||
abs( thisPos.x ) > inRadiusLimit ) ) {
// out of bounds destination
continue;
}


double dist = distSquared( curPos, thisPos );

if( dist < closestDist ) {
Expand Down Expand Up @@ -8346,6 +8364,18 @@ GridPos getNextFlightLandingPos( int inCurrentX, int inCurrentY,

GridPos returnVal = { eveX, eveY };

if( inRadiusLimit > 0 &&
( abs( eveX ) >= inRadiusLimit ||
abs( eveY ) >= inRadiusLimit ) ) {
// even Eve pos is out of bounds
// stick them in center
returnVal.x = 0;
returnVal.y = 0;
}




return returnVal;
}

Expand Down
5 changes: 4 additions & 1 deletion server/map.h
Expand Up @@ -291,8 +291,11 @@ int getMapObjectRaw( int inX, int inY );

// next landing strip in line, in round-the-world circuit across all
// landing positions
// radius limit limits flights from inside that square radius
// from leaving (though flights from outside are unrestriced)
GridPos getNextFlightLandingPos( int inCurrentX, int inCurrentY,
doublePair inDir );
doublePair inDir,
int inRadiusLimit = -1 );


// get and set player ID for grave on map
Expand Down
15 changes: 14 additions & 1 deletion server/server.cpp
Expand Up @@ -16003,11 +16003,24 @@ int main() {

doublePair takeOffDir = { xDir, yDir };

int radiusLimit = -1;

int barrierRadius =
SettingsManager::getIntSetting(
"barrierRadius", 250 );
int barrierOn = SettingsManager::getIntSetting(
"barrierOn", 1 );

if( barrierOn ) {
radiusLimit = barrierRadius;
}

GridPos destPos =
getNextFlightLandingPos(
nextPlayer->xs,
nextPlayer->ys,
takeOffDir );
takeOffDir,
radiusLimit );

AppLog::infoF(
"Player %d flight taking off from (%d,%d), "
Expand Down

0 comments on commit a54f9ea

Please sign in to comment.