| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design) |
| 5 | * Copyright (c) 2017-2019, The LegacyClonk Team and contributors |
| 6 | * |
| 7 | * Distributed under the terms of the ISC license; see accompanying file |
| 8 | * "COPYING" for details. |
| 9 | * |
| 10 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 11 | * See accompanying file "TRADEMARK" for details. |
| 12 | * |
| 13 | * To redistribute this file separately, substitute the full license texts |
| 14 | * for the above references. |
| 15 | */ |
| 16 | |
| 17 | /* Move liquids in the landscape using individual transport spots */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "C4ForwardDeclarations.h" |
| 22 | |
| 23 | #include <cstdint> |
| 24 | |
| 25 | const int32_t C4MassMoverChunk = 10000; |
| 26 | |
| 27 | class C4MassMoverSet; |
| 28 | |
| 29 | class C4MassMover |
| 30 | { |
| 31 | friend class C4MassMoverSet; |
| 32 | |
| 33 | protected: |
| 34 | int32_t Mat, x, y; |
| 35 | |
| 36 | protected: |
| 37 | void Cease(); |
| 38 | bool Execute(); |
| 39 | bool Init(int32_t tx, int32_t ty); |
| 40 | bool Corrosion(int32_t dx, int32_t dy); |
| 41 | }; |
| 42 | |
| 43 | class C4MassMoverSet |
| 44 | { |
| 45 | public: |
| 46 | C4MassMoverSet(); |
| 47 | ~C4MassMoverSet(); |
| 48 | |
| 49 | public: |
| 50 | int32_t Count; |
| 51 | int32_t CreatePtr; |
| 52 | |
| 53 | protected: |
| 54 | C4MassMover Set[C4MassMoverChunk]; |
| 55 | |
| 56 | public: |
| 57 | void Copy(C4MassMoverSet &rSet); |
| 58 | void Synchronize(); |
| 59 | void Default(); |
| 60 | void Clear(); |
| 61 | void Execute(); |
| 62 | bool Create(int32_t x, int32_t y, bool fExecute = false); |
| 63 | bool Load(C4Group &hGroup); |
| 64 | bool Save(C4Group &hGroup); |
| 65 | |
| 66 | protected: |
| 67 | void Consolidate(); |
| 68 | }; |
| 69 | |