From ed9e4a9052c67674c8b3af1017cd06ed3adb3710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?= <50486086+DarkCat09@users.noreply.github.com> Date: Fri, 8 Nov 2019 15:36:32 +0300 Subject: [PATCH] Add files via upload Edited main.cpp --- FallSimulation.cpp | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/FallSimulation.cpp b/FallSimulation.cpp index e01bdd7..8de58bd 100644 --- a/FallSimulation.cpp +++ b/FallSimulation.cpp @@ -59,6 +59,8 @@ void mainFunc(); bool addingBlock(bool clicked, RECT blockBut, HDC pic, int blocktype, int* arrElem, MapPart mapParts[]); +void addingStone(int* arrElem, MapPart mapParts[]); + int main() { txCreateWindow(1300, 600); @@ -331,10 +333,6 @@ void mainFunc() In(txMousePos(), mapParts[i].coords) && txMouseButtons() & 2 && !(clickedBlock || clickedQuest || clickedWater || clickedFire)) { - //cout << i; - //cout << arrElem; - //txSleep(1000); - selectedPict = i; mapParts[selectedPict] = mapParts[arrElem - 1]; mapParts[arrElem - 1].visible = false; @@ -461,4 +459,38 @@ bool addingBlock(bool clicked, RECT blockBut, HDC pic, return clicked; } +void addingStone(int quanOfElemsToRep, int nElemsToRep[], int* arrElem, MapPart mapParts[]) +{ + HDC pict; + RECT coords; + + switch(quanOfElemsToRep) + { + default: + return; + + case 2: + pict = light_stone; + + case 3: + pict = dark_stone; + + case 4: + pict = vdark_stone; + } + + coords = mapParts[nElemsToRep[0]].coords; + + for (int i = 0; i < quanOfElemsToRep; i++) { + + mapParts[nElemsToRep[i]] = mapParts[*arrElem - 1]; + mapParts[*arrElem - 1].visible = false; + *arrElem--; + } + + mapParts[nElemsToRep[0]] = { + coords, true, pict, BLOCK_TYPE + }; +} +