Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hetuw committed Jul 5, 2020
2 parents f9c33b0 + defe946 commit d9df132
Show file tree
Hide file tree
Showing 15 changed files with 16,255 additions and 33 deletions.
Binary file added documentation/art/badges.pdf
Binary file not shown.
Binary file added documentation/art/badgesScaled.pdf
Binary file not shown.
16,034 changes: 16,034 additions & 0 deletions documentation/art/spray.dxf

Large diffs are not rendered by default.

Binary file added documentation/art/spray.pdf
Binary file not shown.
39 changes: 39 additions & 0 deletions documentation/changeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,45 @@ This file only list changes to game code. Changes to content can be found here:
http://onehouronelife.com/updateLog.php


Version 346 2020-July-3

--Forbid backslash and quotes in login email address in client.

--Forbid player flipping when a 0-speed object is held (like cast fishing
pole). Fixes #644

--Object editor preserves use vanish when inserting an object.

--Category editor preserves index, if possible, when switching categories.

--Tech tree button (to open Onetech in browser) on login screen. Better tool
tips for several buttons. Fixes #647





Server Fixes

--Fixed crash when someone right-clicks a full basket on a table.

--Fixed glitch where you get stuck unable to satisfy a craving if the craved
item has a YUM parent (example: bowl of gooseberries). Fixes #641

--Fitness server admin interface now has links to other players on details page.

--Two bugs in genetic fitness tracking. First, if your mother is childless,
she was being considered as your aunt in the ancestor tracking. Second, if
an email has a wayward backslash character (which the client should forbid,
but does not), it breaks the SQL statement, preventing fitness from being
logged. Both issues were causing lives to be ignored or mis-recorded by the
fitness server. Fixes #642. Fixes #643.

--Pagination of fitness server logs.




Version 344 2020-June-26

--Cravings implemented.
Expand Down
131 changes: 108 additions & 23 deletions fitnessServer/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,33 +457,81 @@ function fs_setupDatabase() {
function fs_showLog() {
fs_checkPassword( "show_log" );

echo "[<a href=\"server.php?action=show_data" .
"\">Main</a>]<br><br><br>";
echo "[<a href=\"server.php?action=show_data" .
"\">Main</a>]<br><br><br>";

$entriesPerPage = 1000;

$skip = fs_requestFilter( "skip", "/\d+/", 0 );


global $tableNamePrefix;

$query = "SELECT * FROM $tableNamePrefix"."log ".
"ORDER BY entry_time DESC;";

// first, count results
$query = "SELECT COUNT(*) FROM $tableNamePrefix"."log;";

$result = fs_queryDatabase( $query );
$totalEntries = fs_mysqli_result( $result, 0, 0 );



$query = "SELECT entry, entry_time FROM $tableNamePrefix"."log ".
"ORDER BY entry_time DESC LIMIT $skip, $entriesPerPage;";
$result = fs_queryDatabase( $query );

$numRows = mysqli_num_rows( $result );



echo "<a href=\"server.php?action=clear_log\">".
"Clear log</a>";
$startSkip = $skip + 1;

$endSkip = $startSkip + $entriesPerPage - 1;

if( $endSkip > $totalEntries ) {
$endSkip = $totalEntries;
}




echo "$totalEntries Log entries".
" (showing $startSkip - $endSkip):<br>\n";


$nextSkip = $skip + $entriesPerPage;

$prevSkip = $skip - $entriesPerPage;

if( $skip > 0 && $prevSkip < 0 ) {
$prevSkip = 0;
}

if( $prevSkip >= 0 ) {
echo "[<a href=\"server.php?action=show_log" .
"&skip=$prevSkip\">".
"Previous Page</a>] ";
}
if( $nextSkip < $totalEntries ) {
echo "[<a href=\"server.php?action=show_log" .
"&skip=$nextSkip\">".
"Next Page</a>]";
}


echo "<hr>";

echo "$numRows log entries:<br><br><br>\n";




for( $i=0; $i<$numRows; $i++ ) {
$time = fs_mysqli_result( $result, $i, "entry_time" );
$entry = htmlspecialchars( fs_mysqli_result( $result, $i, "entry" ) );

echo "<b>$time</b>:<br>$entry<hr>\n";
echo "<b>$time</b>:<br><pre>$entry</pre><hr>\n";
}

echo "<br><br><hr><a href=\"server.php?action=clear_log\">".
"Clear log</a>";
}


Expand Down Expand Up @@ -752,19 +800,38 @@ function fs_showDetail( $checkPassword = true ) {
global $tableNamePrefix;


$email = fs_requestFilter( "email", "/[A-Z0-9._%+\-]+@[A-Z0-9.\-]+/i" );
// two possible params... id or email

$id = fs_requestFilter( "id", "/[0-9]+/i", -1 );
$email = "";

$aveAge = fs_getAveAge( $email );

$query = "SELECT id ".
"FROM $tableNamePrefix"."users ".
"WHERE email = '$email';";
$result = fs_queryDatabase( $query );
if( $id != -1 ) {
$query = "SELECT email ".
"FROM $tableNamePrefix"."users ".
"WHERE id = '$id';";
$result = fs_queryDatabase( $query );

$email = fs_mysqli_result( $result, 0, "email" );
}
else {
$email = fs_requestFilter( "email", "/[A-Z0-9._%+\-]+@[A-Z0-9.\-]+/i" );

$query = "SELECT id ".
"FROM $tableNamePrefix"."users ".
"WHERE email = '$email';";
$result = fs_queryDatabase( $query );

$id = fs_mysqli_result( $result, 0, "id" );
}

$id = fs_mysqli_result( $result, 0, "id" );

$aveAge = fs_getAveAge( $email );



$query = "SELECT name, age, relation_name, ".
"old_score, new_score, death_time ".
"old_score, new_score, death_time, life_player_id ".
"FROM $tableNamePrefix"."offspring AS offspring ".
"INNER JOIN $tableNamePrefix"."lives AS lives ".
"ON offspring.life_id = lives.id ".
Expand Down Expand Up @@ -794,6 +861,10 @@ function fs_showDetail( $checkPassword = true ) {
$new_score = fs_mysqli_result( $result, $i, "new_score" );
$death_time = fs_mysqli_result( $result, $i, "death_time" );

$otherLifePlayerID =
fs_mysqli_result( $result, $i, "life_player_id" );


$delta = round( $new_score - $old_score, 3 );

$deltaString;
Expand All @@ -807,8 +878,15 @@ function fs_showDetail( $checkPassword = true ) {

echo "<tr>";

echo "<td>$name</td>";

if( $relation_name != "You" ) {
// link to other player
echo "<td><a href='server.php?".
"action=show_detail&id=$otherLifePlayerID'>$name</a></td>";
}
else {
echo "<td>$name</td>";
}

if( $old_score != $new_score &&
$relation_name == "You" &&
$numYouLives < $numLivesInAverage ) {
Expand Down Expand Up @@ -1844,9 +1922,16 @@ function fs_reportDeath() {

list( $ancestorEmail, $relName ) = explode( " ", $part, 2 );

fs_logDeath( $ancestorEmail, $life_id, $relName, $age,
$deadPlayerScore );


// watch for malformed emails in list
$ancestorEmail =
fs_filter( $ancestorEmail,
"/[A-Z0-9._%+\-]+@[A-Z0-9.\-]+/i", "" );

if( $ancestorEmail != "" ) {
fs_logDeath( $ancestorEmail, $life_id, $relName, $age,
$deadPlayerScore );
}
$numAncestors ++;
}
}
Expand Down
13 changes: 12 additions & 1 deletion gameSource/EditorCategoryPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,18 @@ void EditorCategoryPage::actionPerformed( GUIComponent *inTarget ) {
}
else {
mCurrentCategory = parentID;
mSelectionIndex = 0;

if( mCurrentCategory != -1 ) {
int newMax =
getCategory( mCurrentCategory )->objectIDSet.size() - 1;

if( newMax < mSelectionIndex ) {
mSelectionIndex = 0;
}
}
else {
mSelectionIndex = 0;
}
}
updateCheckbox();
}
Expand Down
10 changes: 10 additions & 0 deletions gameSource/EditorObjectPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,16 @@ void EditorObjectPage::actionPerformed( GUIComponent *inTarget ) {
mCurrentObject.spriteParent[i + oldNumSprites] =
pickedRecord->spriteParent[i] + oldNumSprites;
}

if( pickedRecord->numUses > 0 &&
mNumUsesField.getInt() > 0 ) {

mCurrentObject.spriteUseVanish[i + oldNumSprites] =
pickedRecord->spriteUseVanish[i];

mCurrentObject.spriteUseAppear[i + oldNumSprites] =
pickedRecord->spriteUseAppear[i];
}
}
if( jumpPerSprite > 0 ) {
for( int i=0; i<pickedRecord->numSprites; i++ ) {
Expand Down
25 changes: 22 additions & 3 deletions gameSource/ExistingAccountPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ ExistingAccountPage::ExistingAccountPage()
: mEmailField( mainFont, 0, 128, 10, false,
translate( "email" ),
NULL,
// forbid only spaces
" " ),
// forbid only spaces and backslash and
// single/double quotes
"\"' \\" ),
mKeyField( mainFont, 0, 0, 15, true,
translate( "accountKey" ),
// allow only ticket code characters
Expand All @@ -57,7 +58,8 @@ ExistingAccountPage::ExistingAccountPage()
mLoginButton( mainFont, 400, 0, translate( "loginButton" ) ),
mFriendsButton( mainFont, 400, -80, translate( "friendsButton" ) ),
mGenesButton( mainFont, 550, 0, translate( "genesButton" ) ),
mFamilyTreesButton( mainFont, 400, -160, translate( "familyTrees" ) ),
mFamilyTreesButton( mainFont, 320, -160, translate( "familyTrees" ) ),
mTechTreeButton( mainFont, 550, -160, translate( "techTree" ) ),
mClearAccountButton( mainFont, 400, -280,
translate( "clearAccount" ) ),
mCancelButton( mainFont, -400, -280,
Expand Down Expand Up @@ -96,6 +98,7 @@ ExistingAccountPage::ExistingAccountPage()
setButtonStyle( &mFriendsButton );
setButtonStyle( &mGenesButton );
setButtonStyle( &mFamilyTreesButton );
setButtonStyle( &mTechTreeButton );
setButtonStyle( &mClearAccountButton );
setButtonStyle( &mCancelButton );
setButtonStyle( &mSettingsButton );
Expand All @@ -117,6 +120,7 @@ ExistingAccountPage::ExistingAccountPage()
addComponent( &mFriendsButton );
addComponent( &mGenesButton );
addComponent( &mFamilyTreesButton );
addComponent( &mTechTreeButton );
addComponent( &mClearAccountButton );
addComponent( &mCancelButton );
addComponent( &mSettingsButton );
Expand All @@ -136,6 +140,7 @@ ExistingAccountPage::ExistingAccountPage()
mFriendsButton.addActionListener( this );
mGenesButton.addActionListener( this );
mFamilyTreesButton.addActionListener( this );
mTechTreeButton.addActionListener( this );
mClearAccountButton.addActionListener( this );

mCancelButton.addActionListener( this );
Expand All @@ -162,6 +167,12 @@ ExistingAccountPage::ExistingAccountPage()
mLoginButton.setMouseOverTip( translate( "saveTip" ) );
mClearAccountButton.setMouseOverTip( translate( "clearAccountTip" ) );

mFriendsButton.setMouseOverTip( translate( "friendsTip" ) );
mGenesButton.setMouseOverTip( translate( "genesTip" ) );
mFamilyTreesButton.setMouseOverTip( translate( "familyTreesTip" ) );
mTechTreeButton.setMouseOverTip( translate( "techTreeTip" ) );


int reviewPosted = SettingsManager::getIntSetting( "reviewPosted", 0 );

if( reviewPosted ) {
Expand Down Expand Up @@ -427,6 +438,14 @@ void ExistingAccountPage::actionPerformed( GUIComponent *inTarget ) {
}
delete [] url;
}
else if( inTarget == &mTechTreeButton ) {
char *url = SettingsManager::getStringSetting( "techTreeURL", "" );

if( strcmp( url, "" ) != 0 ) {
launchURL( url );
}
delete [] url;
}
else if( inTarget == &mViewAccountButton ) {
if( mHideAccount ) {
mViewAccountButton.setLabelText( translate( "hide" ) );
Expand Down
1 change: 1 addition & 0 deletions gameSource/ExistingAccountPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class ExistingAccountPage : public GamePage, public ActionListener {
TextButton mFriendsButton;
TextButton mGenesButton;
TextButton mFamilyTreesButton;
TextButton mTechTreeButton;
TextButton mClearAccountButton;
TextButton mCancelButton;

Expand Down
6 changes: 5 additions & 1 deletion gameSource/LivingLifePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23073,7 +23073,11 @@ void LivingLifePage::pointerMove( float inX, float inY ) {
double worldX = inX / (double)CELL_D;


if( ! ourLiveObject->inMotion ) {
if( ! ourLiveObject->inMotion &&
// watch for being stuck with no-move object in hand, like fishing
// pole
( ourLiveObject->holdingID <= 0 ||
getObject( ourLiveObject->holdingID )->speedMult > 0 ) ) {
char flip = false;

if( ourLiveObject->holdingFlip &&
Expand Down
2 changes: 1 addition & 1 deletion gameSource/game.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
int versionNumber = 344;
int versionNumber = 346;
int dataVersionNumber = 0;

int binVersionNumber = versionNumber;
Expand Down
7 changes: 7 additions & 0 deletions gameSource/languages/English.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ atSignTip "INSERT '@' SIGN (INTL KEYBOARDS)"
loginButton "LOGIN"
friendsButton "FRIENDS"
familyTrees "FAMILY TREES"
techTree "TECH"
genesButton "GENES"
geneticHistoryButton "GENETIC HISTORY"

Expand Down Expand Up @@ -91,6 +92,12 @@ submit "SUBMIT"
saveTip "LOGIN AND STORE DETAILS LOCALLY"
clearAccountTip "DELETES ACCOUNT DETAILS FROM DISK"

friendsTip "GET BORN WITH FRIENDS"
genesTip "GENETIC SCORE DETAILS"

familyTreesTip "OPEN FAMILY TREES IN WEB BROWSER"
techTreeTip "OPEN TECH TREE IN WEB BROWSER"


accountKey "KEY:"
paste "PASTE"
Expand Down
1 change: 1 addition & 0 deletions gameSource/settings/techTreeURL.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://onetech.info
Loading

0 comments on commit d9df132

Please sign in to comment.