Add includePressure to saveStamp as well

Also removed in a407aba087, as part of cleanup. Restoring it now that loadStamp also has this same parameter.
This commit is contained in:
jacob1 2023-12-30 21:10:28 -05:00
parent cdc3eb8663
commit c60e87870a
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
3 changed files with 9 additions and 3 deletions

View File

@ -448,7 +448,12 @@ static Rect<int> SaneSaveRect(Vec2<int> point1, Vec2<int> point2)
ByteString GameController::StampRegion(ui::Point point1, ui::Point point2)
{
auto newSave = gameModel->GetSimulation()->Save(gameModel->GetIncludePressure() != gameView->ShiftBehaviour(), SaneSaveRect(point1, point2));
return StampRegion(point1, point2, gameModel->GetIncludePressure() != gameView->ShiftBehaviour());
}
ByteString GameController::StampRegion(ui::Point point1, ui::Point point2, bool includePressure)
{
auto newSave = gameModel->GetSimulation()->Save(includePressure, SaneSaveRect(point1, point2));
if(newSave)
{
newSave->paused = gameModel->GetPaused();

View File

@ -106,6 +106,7 @@ public:
void DrawLine(int toolSelection, ui::Point point1, ui::Point point2);
void DrawFill(int toolSelection, ui::Point point);
ByteString StampRegion(ui::Point point1, ui::Point point2);
ByteString StampRegion(ui::Point point1, ui::Point point2, bool includePressure);
void CopyRegion(ui::Point point1, ui::Point point2);
void CutRegion(ui::Point point1, ui::Point point2);
void Update();

View File

@ -2168,14 +2168,14 @@ int LuaScriptInterface::simulation_saveStamp(lua_State * l)
int y = luaL_optint(l,2,0);
int w = luaL_optint(l,3,XRES-1);
int h = luaL_optint(l,4,YRES-1);
ByteString name = luacon_controller->StampRegion(ui::Point(x, y), ui::Point(x+w, y+h));
bool includePressure = luaL_optint(l, 5, 1);
ByteString name = luacon_controller->StampRegion(ui::Point(x, y), ui::Point(x+w, y+h), includePressure);
tpt_lua_pushByteString(l, name);
return 1;
}
int LuaScriptInterface::simulation_loadStamp(lua_State * l)
{
auto *luacon_ci = static_cast<LuaScriptInterface *>(commandInterface);
int i = -1;
int pushed = 1;
std::unique_ptr<SaveFile> tempfile;