mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-26 23:51:58 +00:00
Fix variant loading order
file="" properties were not overriden by other things defined in the actor, which lead to weird edge cases, such as frequency="0" variants being loaded because their names="" ended up matching their parent's name="" Also remove the name because it doesn't serve a purpose Accepted by: @wraitii Differential Revision: https://code.wildfiregames.com/D3572 This was SVN commit r24929.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -80,6 +80,7 @@ void CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
|
||||
return;
|
||||
}
|
||||
|
||||
// Load variants first, so that they can be overriden if necessary.
|
||||
XERO_ITER_ATTR(variant, attr)
|
||||
{
|
||||
if (attr.Name == at_file)
|
||||
@@ -97,7 +98,11 @@ void CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
|
||||
LOGERROR("Could not open path %s", attr.Value);
|
||||
// Continue loading extra definitions in this variant to allow nested files
|
||||
}
|
||||
else if (attr.Name == at_name)
|
||||
}
|
||||
|
||||
XERO_ITER_ATTR(variant, attr)
|
||||
{
|
||||
if (attr.Name == at_name)
|
||||
currentVariant.m_VariantName = attr.Value.LowerCase();
|
||||
else if (attr.Name == at_frequency)
|
||||
currentVariant.m_Frequency = attr.Value.ToInt();
|
||||
|
||||
Reference in New Issue
Block a user