1 /***************************************************************************** 2 * Copyright (c) 2014-2021 OpenRCT2 developers 3 * 4 * For a complete list of all authors, please refer to contributors.md 5 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 6 * 7 * OpenRCT2 is licensed under the GNU General Public License version 3. 8 *****************************************************************************/ 9 10 #pragma once 11 12 #ifdef ENABLE_SCRIPTING 13 14 # include "../../../common.h" 15 # include "../../Duktape.hpp" 16 # include "ScTileElement.hpp" 17 18 # include <cstdio> 19 # include <cstring> 20 # include <utility> 21 # include <vector> 22 23 namespace OpenRCT2::Scripting 24 { 25 class ScTile 26 { 27 private: 28 CoordsXY _coords; 29 30 public: 31 ScTile(const CoordsXY& coords); 32 33 private: 34 int32_t x_get() const; 35 36 int32_t y_get() const; 37 38 uint32_t numElements_get() const; 39 40 std::vector<std::shared_ptr<ScTileElement>> elements_get() const; 41 42 DukValue data_get() const; 43 void data_set(DukValue value); 44 45 std::shared_ptr<ScTileElement> getElement(uint32_t index) const; 46 std::shared_ptr<ScTileElement> insertElement(uint32_t index); 47 48 void removeElement(uint32_t index); 49 50 TileElement* GetFirstElement() const; 51 52 static size_t GetNumElements(const TileElement* first); 53 54 duk_context* GetDukContext() const; 55 56 public: 57 static void Register(duk_context* ctx); 58 }; 59 } // namespace OpenRCT2::Scripting 60 61 #endif 62