diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 444823e373..122a2463ee 100644 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -1499,10 +1499,12 @@ void CBuildingPlacer::update( float timeStep ) if( pTerrain->isOnMap( pos.X, pos.Z ) ) { // Check that we are being placed in a valid territory; currently, m_territoryRestriction - // can be either "Allied" for placing in allied territories, or nothing. Since there's no - // diplomacy yet, "allied" just means "owned by us" for now. + // can be either "Allied" for placing in allied territories, or nothing. + // Special case: If the territory has no centre unit, that means the map contains no + // Settlements; for testing purposes, let us build anywhere. CTerritory* territory = g_Game->GetWorld()->GetTerritoryManager()->GetTerritory( pos.X, pos.Z ); - if( m_template->m_territoryRestriction == L"Allied" && territory->owner != g_Game->GetLocalPlayer() ) + if( m_template->m_territoryRestriction == L"Allied" && territory->centre + && territory->owner != g_Game->GetLocalPlayer() ) { m_valid = false; } diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index 8057a0aa9e..68597d4117 100644 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -680,7 +680,6 @@ bool CEntity::Initialize() kill(); return false; } - initAuraData(); return true; } diff --git a/source/simulation/EntityScriptInterface.cpp b/source/simulation/EntityScriptInterface.cpp index 9921a80a13..7d0f07ec20 100644 --- a/source/simulation/EntityScriptInterface.cpp +++ b/source/simulation/EntityScriptInterface.cpp @@ -559,6 +559,8 @@ jsval CEntity::AddAura( JSContext* cx, uintN argc, jsval* argv ) } m_auras[name] = new CAura( cx, this, name, radius, tickRate, color, handler ); + initAuraData(); + return JSVAL_VOID; } @@ -571,6 +573,9 @@ jsval CEntity::RemoveAura( JSContext* UNUSED(cx), uintN argc, jsval* argv ) delete m_auras[name]; m_auras.erase(name); } + + initAuraData(); + return JSVAL_VOID; }