| 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 | /* The C4Action class is merely a simple data structure */ |
| 18 | |
| 19 | #include <C4Include.h> |
| 20 | #include <C4Object.h> |
| 21 | |
| 22 | C4Action::C4Action() |
| 23 | { |
| 24 | Default(); |
| 25 | } |
| 26 | |
| 27 | C4Action::~C4Action() {} |
| 28 | |
| 29 | void C4Action::Default() |
| 30 | { |
| 31 | Act = ActIdle; |
| 32 | std::fill(first: Name, last: std::end(arr&: Name), value: '\0'); |
| 33 | Dir = DIR_None; |
| 34 | DrawDir = Dir; |
| 35 | ComDir = COMD_None; |
| 36 | Time = 0; |
| 37 | Data = 0; |
| 38 | Target = Target2 = nullptr; |
| 39 | Phase = PhaseDelay = 0; |
| 40 | Facet.Default(); |
| 41 | FacetX = FacetY = 0; |
| 42 | t_attach = CNAT_None; |
| 43 | } |
| 44 | |
| 45 | void C4Action::CompileFunc(StdCompiler *pComp) |
| 46 | { |
| 47 | // Note: Compiled directly into "Object"-categories, so beware of name clashes (see C4Object::CompileFunc) |
| 48 | pComp->Value(rStruct: mkNamingAdapt(toC4CStr(Name), szName: "Action" , rDefault: "" )); |
| 49 | pComp->Value(rStruct: mkNamingAdapt(rValue&: Dir, szName: "Dir" , DIR_None)); |
| 50 | pComp->Value(rStruct: mkNamingAdapt(rValue&: ComDir, szName: "ComDir" , COMD_None)); |
| 51 | pComp->Value(rStruct: mkNamingAdapt(rValue&: Time, szName: "ActionTime" , rDefault: 0)); |
| 52 | pComp->Value(rStruct: mkNamingAdapt(rValue&: Data, szName: "ActionData" , rDefault: 0)); |
| 53 | pComp->Value(rStruct: mkNamingAdapt(rValue&: Phase, szName: "Phase" , rDefault: 0)); |
| 54 | pComp->Value(rStruct: mkNamingAdapt(rValue&: PhaseDelay, szName: "PhaseDelay" , rDefault: 0)); |
| 55 | } |
| 56 | |