Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpObstruction.cpp
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | if (m_Type == CLUSTER) | ||||
m_ClusterTags.clear(); | m_ClusterTags.clear(); | ||||
m_Moving = false; | m_Moving = false; | ||||
m_ControlGroup = GetEntityId(); | m_ControlGroup = GetEntityId(); | ||||
m_ControlGroup2 = INVALID_ENTITY; | m_ControlGroup2 = INVALID_ENTITY; | ||||
} | } | ||||
void Deinit() override | void Deinit() override | ||||
{ | { | ||||
m_IsDestroyed = true; | |||||
} | |||||
void Update(const CParamNode& paramNode) override | |||||
{ | |||||
bool active = m_Active; | |||||
bool moving = m_Moving; | |||||
entity_id_t cg1 = m_ControlGroup; | |||||
entity_id_t cg2 = m_ControlGroup2; | |||||
bool block_movement = m_Flags & ICmpObstructionManager::FLAG_BLOCK_MOVEMENT; | |||||
bool block_pathfinding = m_Flags & ICmpObstructionManager::FLAG_BLOCK_PATHFINDING; | |||||
SetActive(false); | |||||
Init(paramNode); | |||||
m_Active = false; | |||||
m_Moving = moving; | |||||
m_ControlGroup = cg1; | |||||
m_ControlGroup2 = cg2; | |||||
SetActive(active); | |||||
} | } | ||||
template<typename S> | template<typename S> | ||||
void SerializeCommon(S& serialize) | void SerializeCommon(S& serialize) | ||||
{ | { | ||||
serialize.Bool("active", m_Active); | serialize.Bool("active", m_Active); | ||||
serialize.Bool("moving", m_Moving); | serialize.Bool("moving", m_Moving); | ||||
serialize.NumberU32_Unbounded("control group", m_ControlGroup); | serialize.NumberU32_Unbounded("control group", m_ControlGroup); | ||||
▲ Show 20 Lines • Show All 576 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator