1
0
forked from mirrors/0ad

# Hotloading of actor XML files.

Stop ignoring actor XML animation speeds.
Add decentralised registration of hotloaders.
Move player ID storage into CModel, to simplify CUnit.
Remove obsolete unit ID allocation code.
Remove some material junk.

This was SVN commit r7605.
This commit is contained in:
Ykkrosh
2010-06-03 01:29:43 +00:00
parent 5c03456a38
commit 310f3466a8
27 changed files with 271 additions and 309 deletions
+14 -10
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2010 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -39,19 +39,12 @@ CObjectBase::CObjectBase(CObjectManager& objectManager)
m_Properties.m_FloatOnWater = false;
}
bool CObjectBase::Load(const std::wstring& filename)
bool CObjectBase::Load(const VfsPath& pathname)
{
m_VariantGroups.clear();
VfsPath pathname(VfsPath(L"art/actors/")/filename);
CXeromyces XeroFile;
if (XeroFile.Load(pathname) != PSRETURN_OK)
return false;
m_Name = filename;
m_ShortName = fs::basename(pathname);
// Define all the elements used in the XML file
#define EL(x) int el_##x = XeroFile.GetElementID(#x)
#define AT(x) int at_##x = XeroFile.GetAttributeID(#x)
@@ -88,6 +81,12 @@ bool CObjectBase::Load(const std::wstring& filename)
}
m_VariantGroups.clear();
m_Pathname = pathname;
m_ShortName = fs::basename(pathname);
// Set up the vector<vector<T>> m_Variants to contain the right number
// of elements, to avoid wasteful copying/reallocation later.
{
@@ -206,7 +205,7 @@ bool CObjectBase::Load(const std::wstring& filename)
if (currentGroup->size() == 0)
{
LOG(CLogger::Error, LOG_CATEGORY, L"Actor group has zero variants ('%ls')", filename.c_str());
LOG(CLogger::Error, LOG_CATEGORY, L"Actor group has zero variants ('%ls')", pathname.string().c_str());
}
++currentGroup;
@@ -228,6 +227,11 @@ bool CObjectBase::Load(const std::wstring& filename)
return true;
}
bool CObjectBase::Reload()
{
return Load(m_Pathname);
}
std::vector<u8> CObjectBase::CalculateVariationKey(const std::vector<std::set<CStr> >& selections)
{
// (TODO: see CObjectManager::FindObjectVariation for an opportunity to