Skip to content

Commit

Permalink
New method for putting Eve to west of homelands. Completely ignore an…
Browse files Browse the repository at this point in the history
…y d-town or tutorial homelands, and compute the average location of the rest. Place Eve to the west of the furthest-west homeland that is not > 1500 to the west of this average.
  • Loading branch information
jasonrohrer committed Jun 19, 2020
1 parent 0cbd93c commit 8f136a9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
4 changes: 4 additions & 0 deletions documentation/changeLog.txt
Expand Up @@ -10,6 +10,10 @@ Server Fixes
--Fixed bug that caused Eve spawn to jump to the west of a donkeytown homeland.
Fixes #633.

--New method for putting Eve to west of homelands. Completely ignore any
d-town or tutorial homelands, and compute the average location of the rest.
Place Eve to the west of the furthest-west homeland that is not > 1500 to the
west of this average.



Expand Down
22 changes: 14 additions & 8 deletions server/map.cpp
Expand Up @@ -539,7 +539,10 @@ typedef struct Homeland {
// did the creation of this homeland tapout-trigger
// a +primaryHomeland object?
char primary;


// should Eve placement ignore this homeland?
char ignoredForEve;

} Homeland;


Expand Down Expand Up @@ -6958,6 +6961,7 @@ static char runTapoutOperation( int inX, int inY,

// from server.cpp
extern int getPlayerLineage( int inID );
extern char isPlayerIgnoredForEvePlacement( int inID );



Expand Down Expand Up @@ -7311,7 +7315,8 @@ void setMapObjectRaw( int inX, int inY, int inID ) {
false,
// changed
true,
tappedOutPrimaryHomeland };
tappedOutPrimaryHomeland,
isPlayerIgnoredForEvePlacement( p ) };
homelands.push_back( newH );
}
else if( h->expired ) {
Expand Down Expand Up @@ -8461,7 +8466,8 @@ void getEvePosition( const char *inEmail, int inID, int *outX, int *outY,
for( int i=0; i<homelands.size(); i++ ) {
Homeland *h = homelands.getElement( i );

if( ! h->expired ) {
// any d-town or tutorial homelands are ignored
if( ! h->expired && ! h->ignoredForEve ) {
homelandXCount ++;
homelandXSum += h->x;
}
Expand All @@ -8474,11 +8480,11 @@ void getEvePosition( const char *inEmail, int inID, int *outX, int *outY,

Homeland *h = homelands.getElement( i );

// d-town placed 20K away
// by looking for homelands not more than 9K past average
// in negative (west) direction
// we avoid d-town homelands
if( ! h->expired && h->x > homelandXAve - 9000 ) {
// avoid extreme outlier homelands that are more
// than 1500 to the West of the average homeland location
if( ! h->expired && ! h->ignoredForEve &&
h->x > homelandXAve - 1500 ) {
int xBoundary = h->x - 2 * h->radius;

if( xBoundary < ave.x ) {
Expand Down
12 changes: 12 additions & 0 deletions server/server.cpp
Expand Up @@ -1587,6 +1587,18 @@ int getPlayerLineage( int inID ) {



char isPlayerIgnoredForEvePlacement( int inID ) {
LiveObject *o = getLiveObject( inID );
if( o != NULL ) {
return ( o->curseStatus.curseLevel > 0 ) || o->isTutorial;
}

// player id doesn't even exist
return true;
}




static double pickBirthCooldownSeconds() {
// Kumaraswamy distribution
Expand Down

0 comments on commit 8f136a9

Please sign in to comment.