Skip to content

Commit

Permalink
CURSE MY BABY now works forever, until you have another baby. Part of #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrohrer committed Feb 6, 2020
1 parent e2c555e commit 40a9dc1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions documentation/changeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Version 309 ???
--If your mother has no leader, you automatically follow her at birth to
bootstrap leadership. Part of #532

--CURSE MY BABY now works forever, until you have another baby. Part of #529




Expand Down
26 changes: 26 additions & 0 deletions server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,10 @@ typedef struct LiveObject {
// babies born to this player
SimpleVector<timeSec_t> *babyBirthTimes;
SimpleVector<int> *babyIDs;

// for CURSE MY BABY after baby is dead/deleted
char *lastBabyEmail;


// wall clock time after which they can have another baby
// starts at 0 (start of time epoch) for non-mothers, as
Expand Down Expand Up @@ -1742,6 +1746,9 @@ void quitCleanup() {
if( nextPlayer->origEmail != NULL ) {
delete [] nextPlayer->origEmail;
}
if( nextPlayer->lastBabyEmail != NULL ) {
delete [] nextPlayer->lastBabyEmail;
}

if( nextPlayer->murderPerpEmail != NULL ) {
delete [] nextPlayer->murderPerpEmail;
Expand Down Expand Up @@ -5432,6 +5439,14 @@ static void makePlayerSay( LiveObject *inPlayer, char *inToSay ) {
setDBCurse( inPlayer->email, targetEmail );
}
}
else if( isBabyShortcut && babyCursePlayer == NULL &&
inPlayer->lastBabyEmail != NULL &&
spendCurseToken( inPlayer->email ) ) {

isCurse = true;

setDBCurse( inPlayer->email, inPlayer->lastBabyEmail );
}
}


Expand Down Expand Up @@ -7330,6 +7345,8 @@ int processLoggedInPlayer( char inAllowReconnect,
newObject.email = inEmail;
newObject.origEmail = NULL;

newObject.lastBabyEmail = NULL;

newObject.id = nextID;
nextID++;

Expand Down Expand Up @@ -8117,6 +8134,12 @@ int processLoggedInPlayer( char inAllowReconnect,
parent->babyBirthTimes->push_back( curTime );
parent->babyIDs->push_back( newObject.id );

if( parent->lastBabyEmail != NULL ) {
delete [] parent->lastBabyEmail;
}
parent->lastBabyEmail = stringDuplicate( newObject.email );


// set cool-down time before this worman can have another baby
parent->birthCoolDown = pickBirthCooldownSeconds() + curTime;

Expand Down Expand Up @@ -24532,6 +24555,9 @@ int main() {
if( nextPlayer->origEmail != NULL ) {
delete [] nextPlayer->origEmail;
}
if( nextPlayer->lastBabyEmail != NULL ) {
delete [] nextPlayer->lastBabyEmail;
}

if( nextPlayer->murderPerpEmail != NULL ) {
delete [] nextPlayer->murderPerpEmail;
Expand Down

0 comments on commit 40a9dc1

Please sign in to comment.