Hello community,

here is the log from the commit of package powdertoy for openSUSE:Factory 
checked in at 2017-09-13 22:36:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/powdertoy (Old)
 and      /work/SRC/openSUSE:Factory/.powdertoy.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "powdertoy"

Wed Sep 13 22:36:50 2017 rev:2 rq:523828 version:92.2.333

Changes:
--------
--- /work/SRC/openSUSE:Factory/powdertoy/powdertoy.changes      2017-08-24 
18:46:42.885441646 +0200
+++ /work/SRC/openSUSE:Factory/.powdertoy.new/powdertoy.changes 2017-09-13 
22:36:59.679354455 +0200
@@ -1,0 +2,27 @@
+Tue Sep 12 00:00:00 CEST 2017 - [email protected]
+
+- update to version 92.3.333
+  * Added - New sim.takeSnapshot and tpt.record lua functions
+  * Changed - Fix incorrect 91.1 Windows executable being released
+  * Changed - Now compiled with luajit, should increase lua script performance 
by 10-40%
+  * Fix Mac (untested / unsupported) and Linux versions - luajit is now static
+  * Fix crash with BOMB explosions
+- update to version 92.2
+  * Added: New sim.takeSnapshot and tpt.record lua functions
+  * Fix incorrect 91.1 Windows executable being released
+  * Now compiled with luajit, should increase lua script performance by 10-40%
+  * Fix crash with BOMB explosions
+  * Fix illuminati symbols appearing when rescanning stamps
+- update to version 92.1
+  * Added: Hold shift when saving or loading stamps to not save / load pressure
+  * Added: Android: ptsave links from the website now directly open the save 
in the app
+  * Changed 'enter' closes SaveIDMessage interface after uploading a save
+  * Turned off HSWC acts as insulator for HEAC
+  * Fix -nan RFRG glitch
+  * Fix newtonian gravity state transitions flashing
+  * Fix issue where saving / loading saves could sometimes lag or crash the 
game
+  * Ensure air doesn't "leak" out of TTAN containers when loading stamps and 
saves
+  * Attempt to fix crash when zooming in on signs
+  * Other minor fixes and changes
+
+-------------------------------------------------------------------

Old:
----
  v92.0.331.tar.gz

New:
----
  v92.2.333.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ powdertoy.spec ++++++
--- /var/tmp/diff_new_pack.GIoG9E/_old  2017-09-13 22:37:00.227277308 +0200
+++ /var/tmp/diff_new_pack.GIoG9E/_new  2017-09-13 22:37:00.231276746 +0200
@@ -20,7 +20,7 @@
 License:        GPL-3.0
 Group:          Amusements/Games/Other
 Name:           powdertoy
-Version:        92.0.331
+Version:        92.2.333
 Release:        0
 Source:         
https://github.com/simtr/The-Powder-Toy/archive/v%{version}.tar.gz
 Url:            http://powdertoy.co.uk

++++++ v92.0.331.tar.gz -> v92.2.333.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/README.md 
new/The-Powder-Toy-92.2.333/README.md
--- old/The-Powder-Toy-92.0.331/README.md       2017-07-23 22:41:38.000000000 
+0200
+++ new/The-Powder-Toy-92.2.333/README.md       2017-09-05 05:08:52.000000000 
+0200
@@ -1,4 +1,4 @@
-The Powder Toy - July 2017
+The Powder Toy - September 2017
 ==========================
 
 Get the latest version here: http://powdertoy.co.uk/Download.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/SConscript 
new/The-Powder-Toy-92.2.333/SConscript
--- old/The-Powder-Toy-92.0.331/SConscript      2017-07-23 22:41:38.000000000 
+0200
+++ new/The-Powder-Toy-92.2.333/SConscript      2017-09-05 05:08:52.000000000 
+0200
@@ -269,7 +269,7 @@
                #Look for Lua
                luaver = "lua5.1"
                if GetOption('luajit'):
-                       if not conf.CheckLib(['luajit-5.1', 'luajit5.1', 
'luajit', 'libluajit']):
+                       if not conf.CheckLib(['luajit-5.1', 'luajit5.1', 
'luajit2.0', 'luajit', 'libluajit']):
                                FatalError("luajit development library not 
found or not installed")
                        env.Append(CPPDEFINES=["LUAJIT"])
                        luaver = "luajit"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/Config.h 
new/The-Powder-Toy-92.2.333/src/Config.h
--- old/The-Powder-Toy-92.0.331/src/Config.h    2017-07-23 22:41:38.000000000 
+0200
+++ new/The-Powder-Toy-92.2.333/src/Config.h    2017-09-05 05:08:52.000000000 
+0200
@@ -16,11 +16,11 @@
 #endif
 
 #ifndef MINOR_VERSION
-#define MINOR_VERSION 0
+#define MINOR_VERSION 2
 #endif
 
 #ifndef BUILD_NUM
-#define BUILD_NUM 331
+#define BUILD_NUM 333
 #endif
 
 #ifndef SNAPSHOT_ID
@@ -36,7 +36,7 @@
 
 #ifdef SNAPSHOT
 #define FUTURE_SAVE_VERSION 92
-#define FUTURE_MINOR_VERSION 0
+#define FUTURE_MINOR_VERSION 1
 #endif
 //VersionInfoEnd
 
@@ -118,8 +118,8 @@
 #define YRES   384
 #define NPART XRES*YRES
 
-#define XCNTR   306
-#define YCNTR   192
+#define XCNTR   XRES/2
+#define YCNTR   YRES/2
 
 #define WINDOWW (XRES+BARSIZE)
 #define WINDOWH (YRES+MENUSIZE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/client/Client.cpp 
new/The-Powder-Toy-92.2.333/src/client/Client.cpp
--- old/The-Powder-Toy-92.0.331/src/client/Client.cpp   2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/client/Client.cpp   2017-09-05 
05:08:52.000000000 +0200
@@ -1204,9 +1204,7 @@
                {
                        if(strncmp(entry->d_name, "..", 3) && 
strncmp(entry->d_name, ".", 2) && strstr(entry->d_name, ".stm") && 
strlen(entry->d_name) == 14)
                        {
-                               char stampname[11];
-                               strncpy(stampname, entry->d_name, 10);
-                               stampIDs.push_front(stampname);
+                               
stampIDs.push_front(std::string(entry->d_name).substr(0, 10));
                        }
                }
                closedir(directory);
@@ -2023,16 +2021,15 @@
                // unless there is nothing loaded currently, then set authors 
directly
                if (authors.size())
                {
+                       // Don't add if it's exactly the same
+                       if (stampAuthors["links"].size() == 1 && 
stampAuthors["links"][0] == Client::Ref().authors)
+                               return;
                        if (authors["username"] != stampAuthors["username"])
                        {
-                               // Don't add if it's exactly the same
-                               if (stampAuthors["links"].size() != 1 || 
stampAuthors["links"][0] != Client::Ref().authors)
-                               {
-                                       // 2nd arg of MergeAuthorInfo needs to 
be an array 
-                                       Json::Value toAdd;
-                                       toAdd.append(stampAuthors);
-                                       MergeAuthorInfo(toAdd);
-                               }
+                               // 2nd arg of MergeAuthorInfo needs to be an 
array 
+                               Json::Value toAdd;
+                               toAdd.append(stampAuthors);
+                               MergeAuthorInfo(toAdd);
                        }
                        else if (stampAuthors["links"].size())
                        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/client/GameSave.cpp 
new/The-Powder-Toy-92.2.333/src/client/GameSave.cpp
--- old/The-Powder-Toy-92.0.331/src/client/GameSave.cpp 2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/client/GameSave.cpp 2017-09-05 
05:08:52.000000000 +0200
@@ -2346,7 +2346,7 @@
        return (char*)outputData;
 }
 
-void GameSave::ConvertBsonToJson(bson_iterator *iter, Json::Value *j)
+void GameSave::ConvertBsonToJson(bson_iterator *iter, Json::Value *j, int 
depth)
 {
        bson_iterator subiter;
        bson_iterator_subiterator(iter, &subiter);
@@ -2360,23 +2360,28 @@
                else if (bson_iterator_type(&subiter) == BSON_INT)
                        (*j)[key] = bson_iterator_int(&subiter);
                else if (bson_iterator_type(&subiter) == BSON_LONG)
-                       (*j)[key] = 
(Json::Value::Int64)bson_iterator_long(&subiter);
-               else if (bson_iterator_type(&subiter) == BSON_ARRAY)
+                       (*j)[key] = 
(Json::Value::UInt64)bson_iterator_long(&subiter);
+               else if (bson_iterator_type(&subiter) == BSON_ARRAY && depth < 
5)
                {
                        bson_iterator arrayiter;
                        bson_iterator_subiterator(&subiter, &arrayiter);
+                       int length = 0, length2 = 0;
                        while (bson_iterator_next(&arrayiter))
                        {
                                if (bson_iterator_type(&arrayiter) == 
BSON_OBJECT && !strcmp(bson_iterator_key(&arrayiter), "part"))
                                {
                                        Json::Value tempPart;
-                                       ConvertBsonToJson(&arrayiter, 
&tempPart);
+                                       ConvertBsonToJson(&arrayiter, 
&tempPart, depth + 1);
                                        (*j)["links"].append(tempPart);
+                                       length++;
                                }
                                else if (bson_iterator_type(&arrayiter) == 
BSON_INT && !strcmp(bson_iterator_key(&arrayiter), "saveID"))
                                {
                                        
(*j)["links"].append(bson_iterator_int(&arrayiter));
                                }
+                               length2++;
+                               if (length > (int)(40 / ((depth+1) * 
(depth+1))) || length2 > 50)
+                                       break;
                        }
                }
        }
@@ -2422,14 +2427,15 @@
                        bson_append_string(b, member.c_str(), 
j[member].asCString());
                else if (j[member].isBool())
                        bson_append_bool(b, member.c_str(), j[member].asBool());
-               else if (j[member].isInt() || j[member].isUInt())
+               else if (j[member].type() == Json::intValue)
                        bson_append_int(b, member.c_str(), j[member].asInt());
-               else if (j[member].isInt64() || j[member].isUInt64())
+               else if (j[member].type() == Json::uintValue)
                        bson_append_long(b, member.c_str(), 
j[member].asInt64());
                else if (j[member].isArray())
                {
                        bson_append_start_array(b, member.c_str());
                        std::set<int> saveIDs = std::set<int>();
+                       int length = 0;
                        for (Json::Value::ArrayIndex i = 0; i < 
j[member].size(); i++)
                        {
                                // only supports objects and ints here because 
that is all we need
@@ -2440,7 +2446,7 @@
                                }
                                if (!j[member][i].isObject())
                                        continue;
-                               if (depth > 4)
+                               if (depth > 4 || length > (int)(40 / ((depth+1) 
* (depth+1))))
                                {
                                        std::set<int> nestedSaveIDs = 
GetNestedSaveIDs(j[member][i]);
                                        saveIDs.insert(nestedSaveIDs.begin(), 
nestedSaveIDs.end());
@@ -2451,6 +2457,7 @@
                                        ConvertJsonToBson(b, j[member][i], 
depth+1);
                                        bson_append_finish_object(b);
                                }
+                               length++;
                        }
                        for (std::set<int>::iterator iter = saveIDs.begin(), 
end = saveIDs.end(); iter != end; ++iter)
                        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/client/GameSave.h 
new/The-Powder-Toy-92.2.333/src/client/GameSave.h
--- old/The-Powder-Toy-92.0.331/src/client/GameSave.h   2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/client/GameSave.h   2017-09-05 
05:08:52.000000000 +0200
@@ -117,7 +117,7 @@
        void readPSv(char * data, int dataLength);
        char * serialiseOPS(unsigned int & dataSize);
        void ConvertJsonToBson(bson *b, Json::Value j, int depth = 0);
-       void ConvertBsonToJson(bson_iterator *b, Json::Value *j);
+       void ConvertBsonToJson(bson_iterator *b, Json::Value *j, int depth = 0);
 };
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/debug/ParticleDebug.cpp 
new/The-Powder-Toy-92.2.333/src/debug/ParticleDebug.cpp
--- old/The-Powder-Toy-92.0.331/src/debug/ParticleDebug.cpp     2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/debug/ParticleDebug.cpp     2017-09-05 
05:08:52.000000000 +0200
@@ -84,6 +84,8 @@
                }
                else
                {
+                       if (ctrl)
+                               return true;
                        if (sim->debug_currentParticle > 0)
                        {
                                
sim->UpdateParticles(sim->debug_currentParticle, NPART);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/gui/dialogues/SaveIDMessage.cpp 
new/The-Powder-Toy-92.2.333/src/gui/dialogues/SaveIDMessage.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/dialogues/SaveIDMessage.cpp     
2017-07-23 22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/dialogues/SaveIDMessage.cpp     
2017-09-05 05:08:52.000000000 +0200
@@ -49,6 +49,8 @@
        okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
        okayButton->SetActionCallback(new DismissAction(this));
        AddComponent(okayButton);
+       // This button has multiple personalities
+       SetOkayButton(okayButton);
        SetCancelButton(okayButton);
        
        MakeActiveWindow();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/gui/game/GameController.cpp 
new/The-Powder-Toy-92.2.333/src/gui/game/GameController.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/game/GameController.cpp 2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/GameController.cpp 2017-09-05 
05:08:52.000000000 +0200
@@ -128,7 +128,7 @@
 
 GameController::GameController():
        firstTick(true),
-       foundSign(NULL),
+       foundSignID(-1),
        activePreview(NULL),
        search(NULL),
        renderOptions(NULL),
@@ -308,26 +308,32 @@
        return gameView;
 }
 
-sign * GameController::GetSignAt(int x, int y)
+int GameController::GetSignAt(int x, int y)
 {
        Simulation * sim = gameModel->GetSimulation();
-       for (std::vector<sign>::reverse_iterator iter = sim->signs.rbegin(), 
end = sim->signs.rend(); iter != end; ++iter)
+       for (int i = sim->signs.size()-1; i >= 0; i--)
        {
                int signx, signy, signw, signh;
-               (*iter).pos((*iter).getText(sim), signx, signy, signw, signh);
+               sim->signs[i].pos(sim->signs[i].getText(sim), signx, signy, 
signw, signh);
                if (x>=signx && x<=signx+signw && y>=signy && y<=signy+signh)
-                       return &(*iter);
+                       return i;
        }
-       return NULL;
+       return -1;
 }
 
-void GameController::PlaceSave(ui::Point position)
+// assumed to already be a valid sign
+std::string GameController::GetSignText(int signID)
+{
+       return gameModel->GetSimulation()->signs[signID].text;
+}
+
+void GameController::PlaceSave(ui::Point position, bool includePressure)
 {
        GameSave *placeSave = gameModel->GetPlaceSave();
        if (placeSave)
        {
                HistorySnapshot();
-               if (!gameModel->GetSimulation()->Load(position.X, position.Y, 
placeSave))
+               if (!gameModel->GetSimulation()->Load(position.X, position.Y, 
placeSave, includePressure))
                {
                        gameModel->SetPaused(placeSave->paused | 
gameModel->GetPaused());
                        Client::Ref().MergeStampAuthorInfo(placeSave->authors);
@@ -561,10 +567,10 @@
        activeTool->Click(sim, cBrush, point);
 }
 
-std::string GameController::StampRegion(ui::Point point1, ui::Point point2)
+std::string GameController::StampRegion(ui::Point point1, ui::Point point2, 
bool includePressure)
 {
        GameSave * newSave;
-       newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, 
point2.X, point2.Y);
+       newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, 
point2.X, point2.Y, includePressure);
        if(newSave)
        {
                newSave->paused = gameModel->GetPaused();
@@ -580,10 +586,10 @@
        }
 }
 
-void GameController::CopyRegion(ui::Point point1, ui::Point point2)
+void GameController::CopyRegion(ui::Point point1, ui::Point point2, bool 
includePressure)
 {
        GameSave * newSave;
-       newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, 
point2.X, point2.Y);
+       newSave = gameModel->GetSimulation()->Save(point1.X, point1.Y, 
point2.X, point2.Y, includePressure);
        if(newSave)
        {
                Json::Value clipboardInfo;
@@ -598,9 +604,9 @@
        }
 }
 
-void GameController::CutRegion(ui::Point point1, ui::Point point2)
+void GameController::CutRegion(ui::Point point1, ui::Point point2, bool 
includePressure)
 {
-       CopyRegion(point1, point2);
+       CopyRegion(point1, point2, includePressure);
        gameModel->GetSimulation()->clear_area(point1.X, point1.Y, 
point2.X-point1.X, point2.Y-point1.Y);
 }
 
@@ -619,9 +625,13 @@
                y = point.Y;
                if (!gameModel->GetActiveTool(0) || 
gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != 
SDL_BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking
                {
-                       foundSign = GetSignAt(x, y);
-                       if(foundSign && 
sign::splitsign(foundSign->text.c_str()))
-                               return false;
+                       foundSignID = GetSignAt(x, y);
+                       if (foundSignID != -1)
+                       {
+                               sign foundSign = 
gameModel->GetSimulation()->signs[foundSignID];
+                               if (sign::splitsign(foundSign.text.c_str()))
+                                       return false;
+                       }
                }
        }
        return ret;
@@ -632,17 +642,18 @@
        bool ret = commandInterface->OnMouseUp(x, y, button, type);
        if (type)
                return ret;
-       if (ret && foundSign && y<YRES && x<XRES && !gameView->GetPlacingSave())
+       if (ret && foundSignID != -1 && y<YRES && x<XRES && 
!gameView->GetPlacingSave())
        {
                ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y));
                x = point.X;
                y = point.Y;
                if (!gameModel->GetActiveTool(0) || 
gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != 
SDL_BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking
                {
-                       sign * foundSign = GetSignAt(x, y);
-                       if (foundSign)
+                       int foundSignID = GetSignAt(x, y);
+                       if (foundSignID != -1)
                        {
-                               const char* str = foundSign->text.c_str();
+                               sign foundSign = 
gameModel->GetSimulation()->signs[foundSignID];
+                               const char* str = foundSign.text.c_str();
                                char type;
                                int pos = sign::splitsign(str, &type);
                                if (pos)
@@ -678,13 +689,13 @@
                                        else if (type == 'b')
                                        {
                                                Simulation * sim = 
gameModel->GetSimulation();
-                                               sim->create_part(-1, 
foundSign->x, foundSign->y, PT_SPRK);
+                                               sim->create_part(-1, 
foundSign.x, foundSign.y, PT_SPRK);
                                        }
                                }
                        }
                }
        }
-       foundSign = NULL;
+       foundSignID = -1;
        return ret;
 }
 
@@ -1560,6 +1571,11 @@
                return "";
 }
 
+int GameController::Record(bool record)
+{
+       return gameView->Record(record);
+}
+
 void GameController::NotifyAuthUserChanged(Client * sender)
 {
        User newUser = sender->GetAuthUser();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/gui/game/GameController.h 
new/The-Powder-Toy-92.2.333/src/gui/game/GameController.h
--- old/The-Powder-Toy-92.0.331/src/gui/game/GameController.h   2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/GameController.h   2017-09-05 
05:08:52.000000000 +0200
@@ -30,7 +30,7 @@
 {
 private:
        bool firstTick;
-       sign * foundSign;
+       int foundSignID;
 
        PreviewController * activePreview;
        GameView * gameView;
@@ -57,7 +57,8 @@
        GameController();
        ~GameController();
        GameView * GetView();
-       sign * GetSignAt(int x, int y);
+       int GetSignAt(int x, int y);
+       std::string GetSignText(int signID);
 
        bool MouseMove(int x, int y, int dx, int dy);
        bool MouseDown(int x, int y, unsigned button);
@@ -88,9 +89,9 @@
        void DrawRect(int toolSelection, ui::Point point1, ui::Point point2);
        void DrawLine(int toolSelection, ui::Point point1, ui::Point point2);
        void DrawFill(int toolSelection, ui::Point point);
-       std::string StampRegion(ui::Point point1, ui::Point point2);
-       void CopyRegion(ui::Point point1, ui::Point point2);
-       void CutRegion(ui::Point point1, ui::Point point2);
+       std::string StampRegion(ui::Point point1, ui::Point point2, bool 
includePressure);
+       void CopyRegion(ui::Point point1, ui::Point point2, bool 
includePressure);
+       void CutRegion(ui::Point point1, ui::Point point2, bool 
includePressure);
        void Update();
        void SetPaused(bool pauseState);
        void SetPaused();
@@ -132,7 +133,7 @@
        void OpenStamps();
        void OpenElementSearch();
        void OpenColourPicker();
-       void PlaceSave(ui::Point position);
+       void PlaceSave(ui::Point position, bool includePressure);
        void ClearSim();
        void ReloadSim();
        void Vote(int direction);
@@ -148,6 +149,7 @@
        std::string ElementResolve(int type, int ctype);
        bool IsValidElement(int type);
        std::string WallName(int type);
+       int Record(bool record);
 
        void ResetAir();
        void ResetSpark();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/gui/game/GameModel.cpp 
new/The-Powder-Toy-92.2.333/src/gui/game/GameModel.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/game/GameModel.cpp      2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/GameModel.cpp      2017-09-05 
05:08:52.000000000 +0200
@@ -664,7 +664,7 @@
                        }
                        // This save was probably just created, and we didn't 
know the ID when creating it
                        // Update with the proper ID
-                       else if (saveData->authors.get("id", -1) == 0)
+                       else if (saveData->authors.get("id", -1) == 0 || 
saveData->authors.get("id", -1) == -1)
                        {
                                saveData->authors["id"] = newSave->id;
                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/gui/game/GameView.cpp 
new/The-Powder-Toy-92.2.333/src/gui/game/GameView.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/game/GameView.cpp       2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/GameView.cpp       2017-09-05 
05:08:52.000000000 +0200
@@ -186,8 +186,9 @@
        introTextMessage(introTextData),
 
        doScreenshot(false),
-       recording(false),
        screenshotIndex(0),
+       recording(false),
+       recordingFolder(0),
        recordingIndex(0),
        currentPoint(ui::Point(0, 0)),
        lastPoint(ui::Point(0, 0)),
@@ -720,11 +721,7 @@
 {
        if (sender->GetLastTool())
        {
-               if (sender->GetLastTool()->GetResolution() == CELL)
-                       wallBrush = true;
-               else
-                       wallBrush = false;
-
+               wallBrush = sender->GetLastTool()->GetBlocky();
                if 
(sender->GetLastTool()->GetIdentifier().find("DEFAULT_TOOL_") != 
sender->GetLastTool()->GetIdentifier().npos)
                        toolBrush = true;
                else
@@ -1048,28 +1045,31 @@
        doScreenshot = true;
 }
 
-void GameView::record()
+int GameView::Record(bool record)
 {
-       if(recording)
+       if (!record)
        {
                recording = false;
+               recordingIndex = 0;
+               recordingFolder = 0;
        }
-       else
+       else if (!recording)
        {
-               class RecordingConfirmation: public ConfirmDialogueCallback {
-               public:
-                       GameView * v;
-                       RecordingConfirmation(GameView * v): v(v) {}
-                       virtual void 
ConfirmCallback(ConfirmPrompt::DialogueResult result) {
-                               if (result == ConfirmPrompt::ResultOkay)
-                               {
-                                       v->recording = true;
-                               }
-                       }
-                       virtual ~RecordingConfirmation() { }
-               };
-               new ConfirmPrompt("Recording", "You're about to start recording 
all drawn frames. This may use a load of hard disk space.", new 
RecordingConfirmation(this));
+               // block so that the return value is correct
+               bool record = ConfirmPrompt::Blocking("Recording", "You're 
about to start recording all drawn frames. This will use a load of disk 
space.");
+               if (record)
+               {
+                       time_t startTime = time(NULL);
+                       recordingFolder = startTime;
+                       std::stringstream recordingDir;
+                       recordingDir << "recordings" << PATH_SEP << 
recordingFolder;
+                       Client::Ref().MakeDirectory("recordings");
+                       Client::Ref().MakeDirectory(recordingDir.str().c_str());
+                       recording = true;
+                       recordingIndex = 0;
+               }
        }
+       return recordingFolder;
 }
 
 void GameView::updateToolButtonScroll()
@@ -1257,7 +1257,7 @@
                                                if 
(thumbY+(placeSaveThumb->Height) >= YRES)
                                                        thumbY = 
YRES-placeSaveThumb->Height;
 
-                                               c->PlaceSave(ui::Point(thumbX, 
thumbY));
+                                               c->PlaceSave(ui::Point(thumbX, 
thumbY), !shiftBehaviour);
                                        }
                                }
                                else
@@ -1267,11 +1267,11 @@
                                        int x1 = 
(selectPoint2.X<selectPoint1.X) ? selectPoint2.X : selectPoint1.X;
                                        int y1 = 
(selectPoint2.Y<selectPoint1.Y) ? selectPoint2.Y : selectPoint1.Y;
                                        if (selectMode ==SelectCopy)
-                                               c->CopyRegion(ui::Point(x1, 
y1), ui::Point(x2, y2));
+                                               c->CopyRegion(ui::Point(x1, 
y1), ui::Point(x2, y2), !shiftBehaviour);
                                        else if (selectMode == SelectCut)
-                                               c->CutRegion(ui::Point(x1, y1), 
ui::Point(x2, y2));
+                                               c->CutRegion(ui::Point(x1, y1), 
ui::Point(x2, y2), !shiftBehaviour);
                                        else if (selectMode == SelectStamp)
-                                               c->StampRegion(ui::Point(x1, 
y1), ui::Point(x2, y2));
+                                               c->StampRegion(ui::Point(x1, 
y1), ui::Point(x2, y2), !shiftBehaviour);
                                }
                        }
                        selectMode = SelectNone;
@@ -1500,8 +1500,6 @@
        case 'r':
                if (ctrl)
                        c->ReloadSim();
-               else
-                       record();
                break;
        case 'e':
                c->OpenElementSearch();
@@ -1735,11 +1733,11 @@
                }
        }
 
-       sign * foundSign = c->GetSignAt(mousePosition.X, mousePosition.Y);
-       if (foundSign)
+       int foundSignID = c->GetSignAt(mousePosition.X, mousePosition.Y);
+       if (foundSignID != -1)
        {
-               const char* str = foundSign->text.c_str();
-               char type;
+               const char* str = c->GetSignText(foundSignID).c_str();;
+               char type = '\0';
                int pos = sign::splitsign(str, &type);
                if (type == 'c' || type == 't' || type == 's')
                {
@@ -2237,6 +2235,7 @@
                        std::vector<char> data = 
format::VideoBufferToPPM(screenshot);
 
                        std::stringstream filename;
+                       filename << "recordings" << PATH_SEP << recordingFolder 
<< PATH_SEP;
                        filename << "frame_";
                        filename << std::setfill('0') << std::setw(6) << 
(recordingIndex++);
                        filename << ".ppm";
@@ -2329,7 +2328,8 @@
                                }
                                sampleInfo << ", Temp: " << std::fixed << 
sample.particle.temp -273.15f << " C";
                                sampleInfo << ", Life: " << 
sample.particle.life;
-                               sampleInfo << ", Tmp: " << sample.particle.tmp;
+                               if (sample.particle.type != PT_RFRG && 
sample.particle.type != PT_RFGL)
+                                       sampleInfo << ", Tmp: " << 
sample.particle.tmp;
 
                                // only elements that use .tmp2 show it in the 
debug HUD
                                if (type == PT_CRAY || type == PT_DRAY || type 
== PT_EXOT || type == PT_LIGH || type == PT_SOAP || type == PT_TRON || type == 
PT_VIBR || type == PT_VIRS || type == PT_WARP || type == PT_LCRY || type == 
PT_CBNW || type == PT_TSNS || type == PT_DTEC || type == PT_LSNS || type == 
PT_PSTN)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/gui/game/GameView.h 
new/The-Powder-Toy-92.2.333/src/gui/game/GameView.h
--- old/The-Powder-Toy-92.0.331/src/gui/game/GameView.h 2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/GameView.h 2017-09-05 
05:08:52.000000000 +0200
@@ -66,8 +66,9 @@
        std::string introTextMessage;
 
        bool doScreenshot;
-       bool recording;
        int screenshotIndex;
+       bool recording;
+       int recordingFolder;
        int recordingIndex;
 
        ui::Point currentPoint, lastPoint;
@@ -117,7 +118,6 @@
        void SetSaveButtonTooltips();
 
        void screenshot();
-       void record();
 
        void enableShiftBehaviour();
        void disableShiftBehaviour();
@@ -147,6 +147,7 @@
        void ExitPrompt();
        SelectMode GetSelectMode() { return selectMode; }
        void BeginStampSelection();
+       int Record(bool record);
 
        //all of these are only here for one debug lines
        bool GetMouseDown() { return isMouseDown; }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/gui/game/Tool.cpp 
new/The-Powder-Toy-92.2.333/src/gui/game/Tool.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/game/Tool.cpp   2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/Tool.cpp   2017-09-05 
05:08:52.000000000 +0200
@@ -12,7 +12,7 @@
        toolName(name),
        toolDescription(description),
        strength(1.0f),
-       resolution(1),
+       blocky(false),
        identifier(identifier),
        colRed(r),
        colGreen(g),
@@ -72,7 +72,7 @@
 WallTool::WallTool(int id, string name, string description, int r, int g, int 
b, std::string identifier, VideoBuffer * (*textureGen)(int, int, int)):
 Tool(id, name, description, r, g, b, identifier, textureGen)
 {
-       resolution = CELL;
+       blocky = true;
 }
 WallTool::~WallTool() {}
 void WallTool::Draw(Simulation * sim, Brush * brush, ui::Point position) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/gui/game/Tool.h 
new/The-Powder-Toy-92.2.333/src/gui/game/Tool.h
--- old/The-Powder-Toy-92.0.331/src/gui/game/Tool.h     2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/game/Tool.h     2017-09-05 
05:08:52.000000000 +0200
@@ -20,7 +20,7 @@
        string toolName;
        string toolDescription;
        float strength;
-       int resolution;
+       bool blocky;
        std::string identifier;
 public:
        int colRed, colGreen, colBlue;
@@ -30,7 +30,7 @@
        string GetName();
        string GetDescription();
        std::string GetIdentifier();
-       int GetResolution() { return resolution; }
+       int GetBlocky() { return blocky; }
        void SetStrength(float value) { strength = value; }
        float  GetStrength() { return strength; }
        VideoBuffer * GetTexture(int width, int height);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/gui/search/SearchController.cpp 
new/The-Powder-Toy-92.2.333/src/gui/search/SearchController.cpp
--- old/The-Powder-Toy-92.0.331/src/gui/search/SearchController.cpp     
2017-07-23 22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/gui/search/SearchController.cpp     
2017-09-05 05:08:52.000000000 +0200
@@ -262,7 +262,7 @@
                                if 
(Client::Ref().DeleteSave(saves[i])!=RequestOkay)
                                {
                                        std::stringstream saveIDF;
-                                       saveIDF << "\boFailed to delete [" << 
saves[i] << "]: " << Client::Ref().GetLastError();
+                                       saveIDF << "Failed to delete [" << 
saves[i] << "]: " << Client::Ref().GetLastError();
                                        notifyError(saveIDF.str());
                                        c->Refresh();
                                        return false;
@@ -345,9 +345,9 @@
                                {
                                        std::stringstream error;
                                        if (publish) // uses html page so error 
message will be spam
-                                               error << "\boFailed to publish 
[" << saves[i] << "], is this save yours?";
+                                               error << "Failed to publish [" 
<< saves[i] << "], is this save yours?";
                                        else
-                                               error << "\boFailed to 
unpublish [" << saves[i] << "]: " + Client::Ref().GetLastError();
+                                               error << "Failed to unpublish 
[" << saves[i] << "]: " + Client::Ref().GetLastError();
                                        notifyError(error.str());
                                        c->Refresh();
                                        return false;
@@ -380,7 +380,7 @@
                                if (Client::Ref().FavouriteSave(saves[i], 
true)!=RequestOkay)
                                {
                                        std::stringstream saveIDF;
-                                       saveIDF << "\boFailed to favourite [" 
<< saves[i] << "]: " + Client::Ref().GetLastError();
+                                       saveIDF << "Failed to favourite [" << 
saves[i] << "]: " + Client::Ref().GetLastError();
                                        notifyError(saveIDF.str());
                                        return false;
                                }
@@ -405,7 +405,7 @@
                                if (Client::Ref().FavouriteSave(saves[i], 
false)!=RequestOkay)
                                {
                                        std::stringstream saveIDF;
-                                       saveIDF << "\boFailed to unfavourite [" 
<< saves[i] << "]: " + Client::Ref().GetLastError();
+                                       saveIDF << "Failed to unfavourite [" << 
saves[i] << "]: " + Client::Ref().GetLastError();
                                        notifyError(saveIDF.str());
                                        return false;
                                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LegacyLuaAPI.cpp 
new/The-Powder-Toy-92.2.333/src/lua/LegacyLuaAPI.cpp
--- old/The-Powder-Toy-92.0.331/src/lua/LegacyLuaAPI.cpp        2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LegacyLuaAPI.cpp        2017-09-05 
05:08:52.000000000 +0200
@@ -446,6 +446,7 @@
 bool shortcuts = true;
 int luacon_keyevent(int key, Uint16 character, int modifier, int event)
 {
+       ui::Engine::Ref().LastTick(Platform::GetTime());
        int kycontinue = 1;
        lua_State* l=luacon_ci->l;
        lua_pushstring(l, "keyfunctions");
@@ -501,6 +502,7 @@
 
 int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel)
 {
+       ui::Engine::Ref().LastTick(Platform::GetTime());
        int mpcontinue = 1;
        lua_State* l=luacon_ci->l;
        lua_pushstring(l, "mousefunctions");
@@ -554,6 +556,7 @@
 
 int luacon_step(int mx, int my)
 {
+       ui::Engine::Ref().LastTick(Platform::GetTime());
        lua_State* l = luacon_ci->l;
        lua_pushinteger(l, my);
        lua_pushinteger(l, mx);
@@ -2029,4 +2032,14 @@
        return 1;
 }
 
+int luatpt_record(lua_State* l)
+{
+       if (!lua_isboolean(l, -1))
+               return luaL_typerror(l, 1, lua_typename(l, LUA_TBOOLEAN));
+       bool record = lua_toboolean(l, -1);
+       int recordingFolder = luacon_controller->Record(record);
+       lua_pushinteger(l, recordingFolder);
+       return 1;
+}
+
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LuaCompat.c 
new/The-Powder-Toy-92.2.333/src/lua/LuaCompat.c
--- old/The-Powder-Toy-92.0.331/src/lua/LuaCompat.c     2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaCompat.c     2017-09-05 
05:08:52.000000000 +0200
@@ -1,11 +1,19 @@
 #include "LuaCompat.h"
 
 #if LUA_VERSION_NUM >= 502
-//implement missing luaL_typerror function
+// Implement missing luaL_typerror function
 int luaL_typerror (lua_State *L, int narg, const char *tname)
 {
        const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, 
luaL_typename(L, narg));
        return luaL_argerror(L, narg, msg);
 }
 
+#else
+
+// Implement function added in lua 5.2 that we now use
+void lua_pushglobaltable(lua_State *L)
+{
+       lua_pushvalue(L, LUA_GLOBALSINDEX);
+}
+
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LuaCompat.h 
new/The-Powder-Toy-92.2.333/src/lua/LuaCompat.h
--- old/The-Powder-Toy-92.0.331/src/lua/LuaCompat.h     2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaCompat.h     2017-09-05 
05:08:52.000000000 +0200
@@ -26,9 +26,10 @@
 
 #if LUA_VERSION_NUM >= 502
 #define luaL_getn(L,i)         lua_rawlen(L, (i))
-#define LUA_GLOBALSINDEX       LUA_RIDX_GLOBALS
 
 LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
+#else
+LUALIB_API void (lua_pushglobaltable) (lua_State *L);
 #endif
 
 #ifdef __cplusplus
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LuaLuna.h 
new/The-Powder-Toy-92.2.333/src/lua/LuaLuna.h
--- old/The-Powder-Toy-92.0.331/src/lua/LuaLuna.h       2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaLuna.h       2017-09-05 
05:08:52.000000000 +0200
@@ -15,6 +15,9 @@
                lua_newtable(L);
                int methods = lua_gettop(L);
 
+               // push global table to the stack, so we can add the component 
APIs to it
+               lua_pushglobaltable(L);
+                
                luaL_newmetatable(L, T::className);
                int metatable = lua_gettop(L);
 
@@ -22,7 +25,7 @@
                // scripts can add functions written in Lua.
                lua_pushstring(L, T::className);
                lua_pushvalue(L, methods);
-               lua_settable(L, LUA_GLOBALSINDEX);
+               lua_settable(L, -4);
 
                lua_pushliteral(L, "__metatable");
                lua_pushvalue(L, methods);
@@ -60,7 +63,7 @@
                        lua_settable(L, methods);
                }
 
-               lua_pop(L, 2);  // drop metatable and method table
+               lua_pop(L, 3);  // pop global table, metatable, and method table
        }
 
        // get userdata from Lua stack and return pointer to T object
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LuaScriptHelper.h 
new/The-Powder-Toy-92.2.333/src/lua/LuaScriptHelper.h
--- old/The-Powder-Toy-92.0.331/src/lua/LuaScriptHelper.h       2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaScriptHelper.h       2017-09-05 
05:08:52.000000000 +0200
@@ -131,6 +131,7 @@
 int luatpt_setwindowsize(lua_State* l);
 
 int luatpt_screenshot(lua_State* l);
+int luatpt_record(lua_State* l);
 
 
 #endif /* LUASCRIPTHELPER_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/lua/LuaScriptInterface.cpp 
new/The-Powder-Toy-92.2.333/src/lua/LuaScriptInterface.cpp
--- old/The-Powder-Toy-92.0.331/src/lua/LuaScriptInterface.cpp  2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaScriptInterface.cpp  2017-09-05 
05:08:52.000000000 +0200
@@ -202,6 +202,7 @@
                {"setwindowsize",&luatpt_setwindowsize},
                {"watertest",&luatpt_togglewater},
                {"screenshot",&luatpt_screenshot},
+               {"record",&luatpt_record},
                {"element",&luatpt_getelement},
                {"element_func",&luatpt_element_func},
                {"graphics_func",&luatpt_graphics_func},
@@ -765,6 +766,7 @@
                {"neighbors", simulation_neighbours},
                {"framerender", simulation_framerender},
                {"gspeed", simulation_gspeed},
+               {"takeSnapshot", simulation_takeSnapshot},
                {NULL, NULL}
        };
        luaL_register(l, "simulation", simulationAPIMethods);
@@ -1680,17 +1682,19 @@
        int y = luaL_optint(l,2,0);
        int w = luaL_optint(l,3,XRES-1);
        int h = luaL_optint(l,4,YRES-1);
-       std::string name = luacon_controller->StampRegion(ui::Point(x, y), 
ui::Point(x+w, y+h));
+       int includePressure = luaL_optint(l,5,1);
+       std::string name = luacon_controller->StampRegion(ui::Point(x, y), 
ui::Point(x+w, y+h), includePressure);
        lua_pushstring(l, name.c_str());
        return 1;
 }
 
 int LuaScriptInterface::simulation_loadStamp(lua_State * l)
 {
-       int i = -1, x, y;
+       int i = -1;
        SaveFile * tempfile = NULL;
-       x = luaL_optint(l,2,0);
-       y = luaL_optint(l,3,0);
+       int x = luaL_optint(l,2,0);
+       int y = luaL_optint(l,3,0);
+       int includePressure = luaL_optint(l,4,1);
        if (lua_isstring(l, 1)) //Load from 10 char name, or full filename
        {
                const char * filename = luaL_optstring(l, 1, "");
@@ -1707,7 +1711,7 @@
 
        if (tempfile)
        {
-               if (!luacon_sim->Load(x, y, tempfile->GetGameSave()))
+               if (!luacon_sim->Load(x, y, tempfile->GetGameSave(), 
includePressure))
                {
                        //luacon_sim->sys_pause = 
(tempfile->GetGameSave()->paused | luacon_model->GetPaused())?1:0;
                        lua_pushinteger(l, 1);
@@ -2141,6 +2145,12 @@
        return 0;
 }
 
+int LuaScriptInterface::simulation_takeSnapshot(lua_State * l)
+{
+       luacon_controller->HistorySnapshot();
+       return 0;
+}
+
 //// Begin Renderer API
 
 void LuaScriptInterface::initRendererAPI()
@@ -3473,7 +3483,6 @@
 
 bool LuaScriptInterface::OnMouseTick()
 {
-       ui::Engine::Ref().LastTick(Platform::GetTime());
        if (luacon_mousedown)
                return luacon_mouseevent(luacon_mousex, luacon_mousey, 
luacon_mousebutton, LUACON_MPRESS, 0);
        return true;
@@ -3488,7 +3497,6 @@
                lua_setfield(l, -2, "NUM_PARTS");
        }
        lua_pop(l, 1);
-       ui::Engine::Ref().LastTick(Platform::GetTime());
        luacon_step(luacon_mousex, luacon_mousey);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/LuaScriptInterface.h 
new/The-Powder-Toy-92.2.333/src/lua/LuaScriptInterface.h
--- old/The-Powder-Toy-92.0.331/src/lua/LuaScriptInterface.h    2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/LuaScriptInterface.h    2017-09-05 
05:08:52.000000000 +0200
@@ -108,6 +108,7 @@
        static int simulation_neighbours(lua_State * l);
        static int simulation_framerender(lua_State * l);
        static int simulation_gspeed(lua_State * l);
+       static int simulation_takeSnapshot(lua_State *l);
 
        //Renderer
        void initRendererAPI();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/lua/TPTScriptInterface.cpp 
new/The-Powder-Toy-92.2.333/src/lua/TPTScriptInterface.cpp
--- old/The-Powder-Toy-92.0.331/src/lua/TPTScriptInterface.cpp  2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/TPTScriptInterface.cpp  2017-09-05 
05:08:52.000000000 +0200
@@ -392,7 +392,6 @@
                        throw GeneralException("Invalid particle type");
                if (type==0)
                        throw GeneralException("Cannot set properties of 
particles that do not exist");
-               std::cout << propertyOffset << std::endl;
                switch(propertyFormat)
                {
                case FormatInt:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/lua/socket/options.c 
new/The-Powder-Toy-92.2.333/src/lua/socket/options.c
--- old/The-Powder-Toy-92.0.331/src/lua/socket/options.c        2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/lua/socket/options.c        2017-09-05 
05:08:52.000000000 +0200
@@ -5,6 +5,7 @@
 * RCS ID: $Id: options.c,v 1.6 2005/11/20 07:20:23 diego Exp $
 \*=========================================================================*/
 #include <string.h> 
+#include <stdlib.h>
 
 #include "auxiliar.h"
 #include "options.h"
@@ -31,9 +32,10 @@
     while (opt->name && strcmp(name, opt->name))
         opt++;
     if (!opt->func) {
-        char msg[45];
+        char* msg = malloc(30+strlen(name));
         sprintf(msg, "unsupported option `%.35s'", name);
         luaL_argerror(L, 2, msg);
+        free(msg);
     }
     return opt->func(L, ps);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/simulation/Air.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/Air.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/Air.cpp  2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/Air.cpp  2017-09-05 
05:08:52.000000000 +0200
@@ -352,6 +352,31 @@
                }
 }
 
+// called when loading saves / stamps to ensure nothing "leaks" the first frame
+void Air::RecalculateBlockAirMaps()
+{
+       for (int i = 0; i <= sim.parts_lastActiveIndex; i++)
+       {
+               int type = sim.parts[i].type;
+               // Real TTAN would only block if there was enough TTAN
+               // but it would be more expensive and complicated to actually 
check that
+               // so just block for a frame, if it wasn't supposed to block it 
will continue allowing air next frame
+               if (type == PT_TTAN)
+               {
+                       int x = ((int)(sim.parts[i].x+0.5f))/CELL, y = 
((int)(sim.parts[i].y+0.5f))/CELL;
+                       bmap_blockair[y][x] = 1;
+                       bmap_blockairh[y][x] = 0x8;
+               }
+               // mostly accurate insulator blocking, besides checking GEL
+               else if ((type == PT_HSWC && sim.parts[i].life != 10) || 
sim.elements[type].HeatConduct <= (rand()%250))
+               {
+                       int x = ((int)(sim.parts[i].x+0.5f))/CELL, y = 
((int)(sim.parts[i].y+0.5f))/CELL;
+                       if (!(bmap_blockairh[y][x]&0x8))
+                               bmap_blockairh[y][x]++;
+               }
+       }
+}
+
 Air::Air(Simulation & simulation):
        sim(simulation),
        airMode(0),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/simulation/Air.h 
new/The-Powder-Toy-92.2.333/src/simulation/Air.h
--- old/The-Powder-Toy-92.0.331/src/simulation/Air.h    2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/Air.h    2017-09-05 
05:08:52.000000000 +0200
@@ -33,6 +33,7 @@
        void Clear();
        void ClearAirH();
        void Invert();
+       void RecalculateBlockAirMaps();
        Air(Simulation & sim);
 };
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/simulation/Simulation.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/Simulation.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/Simulation.cpp   2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/Simulation.cpp   2017-09-05 
05:08:52.000000000 +0200
@@ -26,12 +26,12 @@
 #include "lua/LuaScriptHelper.h"
 #endif
 
-int Simulation::Load(GameSave * save)
+int Simulation::Load(GameSave * save, bool includePressure)
 {
-       return Load(0, 0, save);
+       return Load(0, 0, save, includePressure);
 }
 
-int Simulation::Load(int fullX, int fullY, GameSave * save)
+int Simulation::Load(int fullX, int fullY, GameSave * save, bool 
includePressure)
 {
        int blockX, blockY, x, y, r;
 
@@ -207,25 +207,29 @@
                                fvx[saveBlockY+blockY][saveBlockX+blockX] = 
save->fanVelX[saveBlockY][saveBlockX];
                                fvy[saveBlockY+blockY][saveBlockX+blockX] = 
save->fanVelY[saveBlockY][saveBlockX];
                        }
-                       pv[saveBlockY+blockY][saveBlockX+blockX] = 
save->pressure[saveBlockY][saveBlockX];
-                       vx[saveBlockY+blockY][saveBlockX+blockX] = 
save->velocityX[saveBlockY][saveBlockX];
-                       vy[saveBlockY+blockY][saveBlockX+blockX] = 
save->velocityY[saveBlockY][saveBlockX];
-                       if (save->hasAmbientHeat)
-                               hv[saveBlockY+blockY][saveBlockX+blockX] = 
save->ambientHeat[saveBlockY][saveBlockX];
+                       if (includePressure)
+                       {
+                               pv[saveBlockY+blockY][saveBlockX+blockX] = 
save->pressure[saveBlockY][saveBlockX];
+                               vx[saveBlockY+blockY][saveBlockX+blockX] = 
save->velocityX[saveBlockY][saveBlockX];
+                               vy[saveBlockY+blockY][saveBlockX+blockX] = 
save->velocityY[saveBlockY][saveBlockX];
+                               if (save->hasAmbientHeat)
+                                       
hv[saveBlockY+blockY][saveBlockX+blockX] = 
save->ambientHeat[saveBlockY][saveBlockX];
+                       }
                }
        }
 
        gravWallChanged = true;
+       air->RecalculateBlockAirMaps();
 
        return 0;
 }
 
-GameSave * Simulation::Save()
+GameSave * Simulation::Save(bool includePressure)
 {
-       return Save(0, 0, XRES-1, YRES-1);
+       return Save(0, 0, XRES-1, YRES-1, includePressure);
 }
 
-GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2)
+GameSave * Simulation::Save(int fullX, int fullY, int fullX2, int fullY2, bool 
includePressure)
 {
        int blockX, blockY, blockX2, blockY2, blockW, blockH;
        //Normalise incoming coords
@@ -309,11 +313,14 @@
                                newSave->fanVelX[saveBlockY][saveBlockX] = 
fvx[saveBlockY+blockY][saveBlockX+blockX];
                                newSave->fanVelY[saveBlockY][saveBlockX] = 
fvy[saveBlockY+blockY][saveBlockX+blockX];
                        }
-                       newSave->pressure[saveBlockY][saveBlockX] = 
pv[saveBlockY+blockY][saveBlockX+blockX];
-                       newSave->velocityX[saveBlockY][saveBlockX] = 
vx[saveBlockY+blockY][saveBlockX+blockX];
-                       newSave->velocityY[saveBlockY][saveBlockX] = 
vy[saveBlockY+blockY][saveBlockX+blockX];
-                       newSave->ambientHeat[saveBlockY][saveBlockX] = 
hv[saveBlockY+blockY][saveBlockX+blockX];
-                       newSave->hasAmbientHeat = true;
+                       if (includePressure)
+                       {
+                               newSave->pressure[saveBlockY][saveBlockX] = 
pv[saveBlockY+blockY][saveBlockX+blockX];
+                               newSave->velocityX[saveBlockY][saveBlockX] = 
vx[saveBlockY+blockY][saveBlockX+blockX];
+                               newSave->velocityY[saveBlockY][saveBlockX] = 
vy[saveBlockY+blockY][saveBlockX+blockX];
+                               newSave->ambientHeat[saveBlockY][saveBlockX] = 
hv[saveBlockY+blockY][saveBlockX+blockX];
+                               newSave->hasAmbientHeat = true;
+                       }
                }
        }
 
@@ -373,7 +380,7 @@
                parts[i].type = 0;
        std::copy(snap.Particles.begin(), snap.Particles.end(), parts);
        parts_lastActiveIndex = NPART-1;
-       RecalcFreeParticles();
+       RecalcFreeParticles(false);
        std::copy(snap.PortalParticles.begin(), snap.PortalParticles.end(), 
&portalp[0][0][0]);
        std::copy(snap.WirelessData.begin(), snap.WirelessData.end(), 
&wireless[0][0]);
        if (grav->ngrav_enable)
@@ -3256,7 +3263,7 @@
        case PT_FIGH:
        {
                unsigned char fcount = 0;
-               while (fcount < MAX_FIGHTERS && fcount < (fighcount+1) && 
fighters[fcount].spwn==1) fcount++;
+               while (fcount < MAX_FIGHTERS && fighters[fcount].spwn==1) 
fcount++;
                if (fcount < MAX_FIGHTERS && fighters[fcount].spwn == 0)
                {
                        parts[i].life = 100;
@@ -4100,7 +4107,7 @@
                                        else s = 0;
                                }
                                else s = 0;
-                       } else if (elements[t].LowPressureTransition>-1 && 
pv[y/CELL][x/CELL]<elements[t].LowPressure) {
+                       } else if (elements[t].LowPressureTransition>-1 && 
pv[y/CELL][x/CELL]<elements[t].LowPressure && 
gravtot<=(elements[t].LowPressure/4.0f)) {
                                // particle type change due to low pressure
                                if (elements[t].LowPressureTransition!=PT_NUM)
                                        t = elements[t].LowPressureTransition;
@@ -4874,7 +4881,7 @@
        //memset(gol2, 0, sizeof(gol2));
 }
 
-void Simulation::RecalcFreeParticles()
+void Simulation::RecalcFreeParticles(bool do_life_dec)
 {
        int x, y, t;
        int lastPartUsed = 0;
@@ -4912,7 +4919,7 @@
                        NUM_PARTS ++;
 
                        //decrease particle life
-                       if (!sys_pause || framerender)
+                       if (do_life_dec && (!sys_pause || framerender))
                        {
                                if (t<0 || t>=PT_NUM || !elements[t].Enabled)
                                {
@@ -5071,7 +5078,7 @@
        sandcolour = (int)(20.0f*sin((float)sandcolour_frame*(M_PI/180.0f)));
        sandcolour_frame = (sandcolour_frame+1)%360;
 
-       RecalcFreeParticles();
+       RecalcFreeParticles(true);
 
        if (!sys_pause || framerender)
        {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/The-Powder-Toy-92.0.331/src/simulation/Simulation.h 
new/The-Powder-Toy-92.2.333/src/simulation/Simulation.h
--- old/The-Powder-Toy-92.0.331/src/simulation/Simulation.h     2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/Simulation.h     2017-09-05 
05:08:52.000000000 +0200
@@ -114,10 +114,10 @@
        int sandcolour;
        int sandcolour_frame;
 
-       int Load(GameSave * save);
-       int Load(int x, int y, GameSave * save);
-       GameSave * Save();
-       GameSave * Save(int x1, int y1, int x2, int y2);
+       int Load(GameSave * save, bool includePressure = true);
+       int Load(int x, int y, GameSave * save, bool includePressure = true);
+       GameSave * Save(bool includePressure = true);
+       GameSave * Save(int x1, int y1, int x2, int y2, bool includePressure = 
true);
        void SaveSimOptions(GameSave * gameSave);
        SimulationSample GetSample(int x, int y);
 
@@ -159,7 +159,7 @@
        void create_arc(int sx, int sy, int dx, int dy, int midpoints, int 
variance, int type, int flags);
        void UpdateParticles(int start, int end);
        void SimulateGoL();
-       void RecalcFreeParticles();
+       void RecalcFreeParticles(bool do_life_dec);
        void CheckStacking();
        void BeforeSim();
        void AfterSim();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/simulation/elements/BOMB.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/elements/BOMB.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/elements/BOMB.cpp        
2017-07-23 22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/elements/BOMB.cpp        
2017-09-05 05:08:52.000000000 +0200
@@ -67,14 +67,18 @@
                                                for (nxi=-rad; nxi<=rad; nxi++)
                                                        if 
((pow((float)nxi,2))/(pow((float)rad,2))+(pow((float)nxj,2))/(pow((float)rad,2))<=1)
                                                        {
-                                                               if 
(!pmap[y+nxj][x+nxi])
+                                                               int ynxj = y + 
nxj, xnxi = x + nxi;
+                                                               
+                                                               if ((ynxj < 0) 
|| (ynxj >= YRES) || (xnxi <= 0) || (xnxi >= XRES))
                                                                        
continue;
-                                                               nt = 
pmap[y+nxj][x+nxi]&0xFF;
+                                                               
+                                                               nt = 
pmap[ynxj][xnxi]&0xFF;
                                                                if (nt!=PT_DMND 
&& nt!=PT_CLNE && nt!=PT_PCLN && nt!=PT_BCLN && nt!=PT_VIBR)
                                                                {
-                                                                       
sim->kill_part(pmap[y+nxj][x+nxi]>>8);
-                                                                       
sim->pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
-                                                                       nb = 
sim->create_part(-3, x+nxi, y+nxj, PT_EMBR);
+                                                                       if (nt)
+                                                                               
sim->kill_part(pmap[ynxj][xnxi]>>8);
+                                                                       
sim->pv[(ynxj)/CELL][(xnxi)/CELL] += 0.1f;
+                                                                       nb = 
sim->create_part(-3, xnxi, ynxj, PT_EMBR);
                                                                        if 
(nb!=-1)
                                                                        {
                                                                                
parts[nb].tmp = 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/simulation/elements/DMG.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/elements/DMG.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/elements/DMG.cpp 2017-07-23 
22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/elements/DMG.cpp 2017-09-05 
05:08:52.000000000 +0200
@@ -81,21 +81,23 @@
                                                                                
sim->vy[(y+nxj)/CELL][(x+nxi)/CELL] += fy;
                                                                                
sim->pv[(y+nxj)/CELL][(x+nxi)/CELL] += 1.0f;
                                                                                
t = rr&0xFF;
-                                                                               
if(t && sim->elements[t].HighPressureTransition>-1 && 
sim->elements[t].HighPressureTransition<PT_NUM)
+                                                                               
if (t && sim->elements[t].HighPressureTransition>-1 && 
sim->elements[t].HighPressureTransition<PT_NUM)
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, 
sim->elements[t].HighPressureTransition);
-                                                                               
else if(t == PT_BMTL)
+                                                                               
else if (t == PT_BMTL)
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT);
-                                                                               
else if(t == PT_GLAS)
+                                                                               
else if (t == PT_GLAS)
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BGLA);
-                                                                               
else if(t == PT_COAL)
+                                                                               
else if (t == PT_COAL)
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BCOL);
-                                                                               
else if(t == PT_QRTZ)
+                                                                               
else if (t == PT_QRTZ)
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_PQRT);
-                                                                               
else if(t == PT_TUNG)
+                                                                               
else if (t == PT_TUNG)
                                                                                
{
                                                                                
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT);
                                                                                
        parts[rr>>8].ctype = PT_TUNG;
                                                                                
}
+                                                                               
else if (t == PT_WOOD)
+                                                                               
        sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_SAWD);
                                                                        }
                                                                }
                                                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/simulation/elements/HEAC.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/elements/HEAC.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/elements/HEAC.cpp        
2017-07-23 22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/elements/HEAC.cpp        
2017-09-05 05:08:52.000000000 +0200
@@ -50,7 +50,10 @@
 
 //#TPT-Directive ElementHeader Element_HEAC struct IsInsulator
 struct Element_HEAC::IsInsulator : public 
std::binary_function<Simulation*,int,bool> {
-  bool operator() (Simulation* a, int b) {return b && 
a->elements[b].HeatConduct == 0;}
+  bool operator() (Simulation* a, int b)
+  {
+         return b && (a->elements[b&0xFF].HeatConduct == 0 || ((b&0xFF) == 
PT_HSWC && a->parts[b>>8].life != 10));
+  }
 };
 //#TPT-Directive ElementHeader Element_HEAC static IsInsulator isInsulator
 Element_HEAC::IsInsulator Element_HEAC::isInsulator = 
Element_HEAC::IsInsulator();
@@ -94,11 +97,11 @@
        {
                if (reverseXY)
                {
-                       if (func(sim, sim->pmap[x][y]&0xFF)) return true;
+                       if (func(sim, sim->pmap[x][y])) return true;
                }
                else
                {
-                       if (func(sim, sim->pmap[y][x]&0xFF)) return true;
+                       if (func(sim, sim->pmap[y][x])) return true;
                }
                e += de;
                if (e >= 0.5f)
@@ -108,11 +111,11 @@
                        {
                                if (reverseXY)
                                {
-                                       if (func(sim, sim->pmap[x][y]&0xFF)) 
return true;
+                                       if (func(sim, sim->pmap[x][y])) return 
true;
                                }
                                else
                                {
-                                       if (func(sim, sim->pmap[y][x]&0xFF)) 
return true;
+                                       if (func(sim, sim->pmap[y][x])) return 
true;
                                }
                        }
                        e -= 1.0f;
@@ -136,13 +139,13 @@
                        if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && y+rry < 
YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, x+rrx, 
y+rry, isInsulator))
                        {
                                r = pmap[y+rry][x+rrx];
-                               if (r && sim->elements[r&0xFF].HeatConduct > 0)
+                               if (r && sim->elements[r&0xFF].HeatConduct > 0 
&& ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
                                {
                                        count++;
                                        tempAgg += parts[r>>8].temp;
                                }
                                r = sim->photons[y+rry][x+rrx];
-                               if (r && sim->elements[r&0xFF].HeatConduct > 0)
+                               if (r && sim->elements[r&0xFF].HeatConduct > 0 
&& ((r&0xFF) != PT_HSWC || parts[r>>8].life == 10))
                                {
                                        count++;
                                        tempAgg += parts[r>>8].temp;
@@ -164,12 +167,12 @@
                                if (x+rrx >= 0 && x+rrx < XRES && y+rry >= 0 && 
y+rry < YRES && !Element_HEAC::CheckLine<Element_HEAC::IsInsulator>(sim, x, y, 
x+rrx, y+rry, isInsulator))
                                {
                                        r = pmap[y+rry][x+rrx];
-                                       if (r && 
sim->elements[r&0xFF].HeatConduct > 0)
+                                       if (r && 
sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || 
parts[r>>8].life == 10))
                                        {
                                                parts[r>>8].temp = 
parts[i].temp;
                                        }
                                        r = sim->photons[y+rry][x+rrx];
-                                       if (r && 
sim->elements[r&0xFF].HeatConduct > 0)
+                                       if (r && 
sim->elements[r&0xFF].HeatConduct > 0 && ((r&0xFF) != PT_HSWC || 
parts[r>>8].life == 10))
                                        {
                                                parts[r>>8].temp = 
parts[i].temp;
                                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/The-Powder-Toy-92.0.331/src/simulation/elements/RFRG.cpp 
new/The-Powder-Toy-92.2.333/src/simulation/elements/RFRG.cpp
--- old/The-Powder-Toy-92.0.331/src/simulation/elements/RFRG.cpp        
2017-07-23 22:41:38.000000000 +0200
+++ new/The-Powder-Toy-92.2.333/src/simulation/elements/RFRG.cpp        
2017-09-05 05:08:52.000000000 +0200
@@ -28,7 +28,7 @@
 
        Temperature = R_TEMP + 273.15f;
        HeatConduct = 3;
-       Description = "Refrigerant. Heats up and liquifies under pressure.";
+       Description = "Refrigerant. Heats up and liquefies under pressure.";
 
        Properties = TYPE_GAS|PROP_DEADLY;
 
@@ -49,6 +49,11 @@
 {
        float new_pressure = sim->pv[y/CELL][x/CELL];
        float *old_pressure = (float *)&parts[i].tmp;
+       if (std::isnan(*old_pressure))
+       {
+               *old_pressure = new_pressure;
+               return 0;
+       }
        
        // * 0 bar seems to be pressure value -256 in TPT, see Air.cpp. Also, 1 
bar seems to be pressure value 0.
        //   With those two values we can set up our pressure scale which 
states that ... the highest pressure


Reply via email to