Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure that template designs contain only designable components. T…

…his closes ticket:3971.
  • Loading branch information...
commit 2faeb8ffb444647b39c52727c7e8f1a0d04e0f0e 1 parent 940d3b0
@perim perim authored
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/template.cpp
View
14 src/template.cpp
@@ -148,6 +148,20 @@ bool initTemplates()
design.numWeaps = ini.value("weapons").toInt();
design.prefab = false; // not AI template
design.stored = true;
+ if (!(asBodyStats + design.asParts[COMP_BODY])->designable
+ || !(asPropulsionStats + design.asParts[COMP_PROPULSION])->designable
+ || (design.asParts[COMP_BRAIN] > 0 && !(asBrainStats + design.asParts[COMP_BRAIN])->designable)
+ || (design.asParts[COMP_REPAIRUNIT] > 0 && !(asRepairStats + design.asParts[COMP_REPAIRUNIT])->designable)
+ || (design.asParts[COMP_ECM] > 0 && !(asECMStats + design.asParts[COMP_ECM])->designable)
+ || (design.asParts[COMP_SENSOR] > 0 && !(asSensorStats + design.asParts[COMP_SENSOR])->designable)
+ || (design.asParts[COMP_CONSTRUCT] > 0 && !(asConstructStats + design.asParts[COMP_CONSTRUCT])->designable)
+ || (design.numWeaps > 0 && !(asWeaponStats + design.asWeaps[0])->designable)
+ || (design.numWeaps > 1 && !(asWeaponStats + design.asWeaps[1])->designable)
+ || (design.numWeaps > 2 && !(asWeaponStats + design.asWeaps[2])->designable))
+ {
+ debug(LOG_ERROR, "Template %d / %s from stored templates cannot be designed", i, list[i].toUtf8().constData());
+ continue;
+ }
bool valid = intValidTemplate(&design, ini.value("name").toString().toUtf8().constData(), false, selectedPlayer);
if (!valid)
{
Please sign in to comment.
Something went wrong with that request. Please try again.