Page MenuHomeWildfire Games

Formation debug update
ClosedPublic

Authored by temple on Apr 12 2018, 1:19 AM.

Details

Summary

For debugging formation movement and UnitAI it's useful to be able to see and select the formation controllers during a game. This patch updates the commented out parts of the formation template to allow that to happen. See D1423.

Test Plan

To not get errors, we still have to add

FormationAttack.prototype.GetAttackTypes = function()
{
	return [];
};

(or something more correct) to FormationAttack.js, or

Index: binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- binaries/data/mods/public/simulation/components/GuiInterface.js	(revision 21627)
+++ binaries/data/mods/public/simulation/components/GuiInterface.js	(working copy)
@@ -382,7 +382,7 @@
 	let cmpAttack = Engine.QueryInterface(ent, IID_Attack);
 	if (cmpAttack)
 	{
-		let types = cmpAttack.GetAttackTypes();
+		let types = cmpAttack.GetAttackTypes ? cmpAttack.GetAttackTypes() : [];
 		if (types.length)
 			ret.attack = {};

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

temple created this revision.Apr 12 2018, 1:19 AM
elexis accepted this revision.Apr 12 2018, 1:32 AM
elexis added a subscriber: elexis.
FormationAttack.prototype.GetAttackTypes = function()
{
	return [];
};

I'd say adding this is ok and doesn't require a justification for debug mode, because the component implements the Attack interface and that function might be called under other circumstances too in the future. (Then it should likely return either the attack types of the members or whatever the formation allows.)
Perhaps we can add // Only called when making formation entities selectable for debugging as a clarification.
(It doesn't reduce the performance in release mode as it will never be called)

Thanks for updating it. It will enable us to fix more formation issues that were neglected for so long.

This revision is now accepted and ready to land.Apr 12 2018, 1:32 AM
Vulcan added a subscriber: Vulcan.Apr 12 2018, 1:52 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/378/display/redirect

This revision was automatically updated to reflect the committed changes.