mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 22:55:35 +00:00
Ensure that stock builds are saved with a code; ignore builds without codes in comparisons
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#2.3.4
|
#2.3.4
|
||||||
* Fix crash when removing the special effect from a module
|
* Fix crash when removing the special effect from a module
|
||||||
|
* Ensure comparisons with saved stock ships work correctly
|
||||||
|
|
||||||
#2.3.3
|
#2.3.3
|
||||||
* Remove unused blueprint when hitting reset
|
* Remove unused blueprint when hitting reset
|
||||||
|
|||||||
@@ -71,21 +71,22 @@ export default class ComparisonTable extends TranslatedComponent {
|
|||||||
* @return {React.Component} Table row
|
* @return {React.Component} Table row
|
||||||
*/
|
*/
|
||||||
_buildRow(build, facets, formats, units) {
|
_buildRow(build, facets, formats, units) {
|
||||||
let url = outfitURL(build.id, build.toString(), build.buildName);
|
if (build && build.id && build.buildName) {
|
||||||
let cells = [
|
let url = outfitURL(build.id, build.toString(), build.buildName);
|
||||||
<td key='s' className='tl'><Link href={url}>{build.name}</Link></td>,
|
let cells = [
|
||||||
<td key='bn' className='tl'><Link href={url}>{build.buildName}</Link></td>
|
<td key='s' className='tl'><Link href={url}>{build.name}</Link></td>,
|
||||||
];
|
<td key='bn' className='tl'><Link href={url}>{build.buildName}</Link></td>
|
||||||
|
];
|
||||||
|
|
||||||
for (let f of facets) {
|
for (let f of facets) {
|
||||||
if (f.active) {
|
if (f.active) {
|
||||||
for (let p of f.props) {
|
for (let p of f.props) {
|
||||||
cells.push(<td key={p}>{formats[f.fmt](build[p])}{f.unit ? units[f.unit] : null}</td>);
|
cells.push(<td key={p}>{formats[f.fmt](build[p])}{f.unit ? units[f.unit] : null}</td>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return <tr key={build.id + build.buildName} className='tr'>{cells}</tr>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <tr key={build.id + build.buildName} className='tr'>{cells}</tr>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ export default class ComparisonPage extends Page {
|
|||||||
newName = name;
|
newName = name;
|
||||||
for (let shipId in allBuilds) {
|
for (let shipId in allBuilds) {
|
||||||
for (let buildName in allBuilds[shipId]) {
|
for (let buildName in allBuilds[shipId]) {
|
||||||
builds.push(this._createBuild(shipId, buildName, allBuilds[shipId][buildName]));
|
if (buildName && allBuilds[shipId][buildName]) {
|
||||||
|
builds.push(this._createBuild(shipId, buildName, allBuilds[shipId][buildName]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -308,7 +308,10 @@ export default class OutfittingPage extends Page {
|
|||||||
* Save the current build
|
* Save the current build
|
||||||
*/
|
*/
|
||||||
_saveBuild() {
|
_saveBuild() {
|
||||||
const { code, buildName, newBuildName, shipId } = this.state;
|
const { ship, buildName, newBuildName, shipId } = this.state;
|
||||||
|
|
||||||
|
// If this is a stock ship the code won't be set, so ensure that we have it
|
||||||
|
const code = this.state.code || ship.toString();
|
||||||
|
|
||||||
Persist.saveBuild(shipId, newBuildName, code);
|
Persist.saveBuild(shipId, newBuildName, code);
|
||||||
this._updateRoute(shipId, newBuildName, code);
|
this._updateRoute(shipId, newBuildName, code);
|
||||||
|
|||||||
@@ -707,6 +707,11 @@ export default class Ship {
|
|||||||
* @return {this} The current ship instance for chaining
|
* @return {this} The current ship instance for chaining
|
||||||
*/
|
*/
|
||||||
buildFrom(serializedString) {
|
buildFrom(serializedString) {
|
||||||
|
if (!serializedString) {
|
||||||
|
// Empty serialized string; nothing to do
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
let standard = new Array(this.standard.length),
|
let standard = new Array(this.standard.length),
|
||||||
hardpoints = new Array(this.hardpoints.length),
|
hardpoints = new Array(this.hardpoints.length),
|
||||||
internal = new Array(this.internal.length),
|
internal = new Array(this.internal.length),
|
||||||
|
|||||||
Reference in New Issue
Block a user