2025-07-18 21:07 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001185Spring engineGeneralpublic2008-10-26 11:36
Reporterlurker 
Assigned Tolurker 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.77b5+svn 
Target VersionFixed in Version 
Summary0001185: [PATCH] Show coverage range on non-stockpile weapons.
DescriptionThis patch makes the gui show the coverage range for all interceptors, rather than just stockpiled ones.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon nonstockpilecoverage.diff (2,937 bytes) 2008-10-26 05:11 -
    Index: rts/Game/UI/GuiHandler.cpp
    ===================================================================
    --- rts/Game/UI/GuiHandler.cpp	(revision 6893)
    +++ rts/Game/UI/GuiHandler.cpp	(working copy)
    @@ -3704,23 +3704,20 @@
     				DrawSensorRange(unitdef->sonarJamRadius, cmdColors.rangeSonarJammer, p);
     			}
     			// draw interceptor range
    -			const WeaponDef* wd = NULL;
    -			const CWeapon* w = NULL;
    -			if (enemyUnit) {
    -				wd = unitdef->stockpileWeaponDef;
    -			} else {
    -				w = unit->stockpileWeapon;
    -				if (w != NULL) {
    -					wd = w->weaponDef;
    -				}
    -			}
    -			if ((wd != NULL) && wd->interceptor) {
    -				if (enemyUnit || w->numStockpiled) {
    +			if (unitdef->maxCoverage > 0.0f) {
    +				const CWeapon* w = NULL; //will be checked if any missiles are ready
    +				if (!enemyUnit) {
    +					w = unit->stockpileWeapon;
    +					if (w != NULL && !w->weaponDef->interceptor) {
    +						w = NULL; //if this isn't the interceptor, then don't use it
    +					}
    +				} //shows as on if enemy, a non-stockpiled weapon, or if the stockpile has a missile
    +				if (enemyUnit || (w == NULL) || w->numStockpiled) {
     					glColor4fv(cmdColors.rangeInterceptorOn);
     				} else {
     					glColor4fv(cmdColors.rangeInterceptorOff);
     				}
    -				glSurfaceCircle(unit->pos, wd->coverageRange, 40);
    +				glSurfaceCircle(unit->pos, unitdef->maxCoverage, 40);
     			}
     		}
     	}
    Index: rts/Lua/LuaUnitDefs.cpp
    ===================================================================
    --- rts/Lua/LuaUnitDefs.cpp	(revision 6893)
    +++ rts/Lua/LuaUnitDefs.cpp	(working copy)
    @@ -754,6 +754,7 @@
     	ADD_FLOAT("slideTolerance",    ud.slideTolerance);
     
     	ADD_FLOAT("maxWeaponRange", ud.maxWeaponRange);
    +	ADD_FLOAT("maxCoverage", ud.maxCoverage);
     
     	ADD_BOOL( "buildRange3D",   ud.buildRange3D);
     	ADD_FLOAT("buildDistance",  ud.buildDistance);
    Index: rts/Sim/Units/UnitDef.h
    ===================================================================
    --- rts/Sim/Units/UnitDef.h	(revision 6893)
    +++ rts/Sim/Units/UnitDef.h	(working copy)
    @@ -221,6 +221,7 @@
     	const WeaponDef* shieldWeaponDef;
     	const WeaponDef* stockpileWeaponDef;
     	float maxWeaponRange;
    +	float maxCoverage;
     
     	std::map<int, std::string> buildOptions;
     
    Index: rts/Sim/Units/UnitDefHandler.cpp
    ===================================================================
    --- rts/Sim/Units/UnitDefHandler.cpp	(revision 6893)
    +++ rts/Sim/Units/UnitDefHandler.cpp	(working copy)
    @@ -524,6 +524,7 @@
     	ud.stockpileWeaponDef = NULL;
     
     	ud.maxWeaponRange = 0.0f;
    +	ud.maxCoverage = 0.0f;
     
     	const WeaponDef* noWeaponDef = weaponDefHandler->GetWeapon("NOWEAPON");
     
    @@ -584,6 +585,9 @@
     		if (wd->range > ud.maxWeaponRange) {
     			ud.maxWeaponRange = wd->range;
     		}
    +		if (wd->interceptor && wd->coverageRange > ud.maxCoverage) {
    +			ud.maxCoverage = wd->coverageRange;
    +		}
     		if (wd->isShield) {
     			if (!ud.shieldWeaponDef || // use the biggest shield
     			    (ud.shieldWeaponDef->shieldRadius < wd->shieldRadius)) {
    
    diff file icon nonstockpilecoverage.diff (2,937 bytes) 2008-10-26 05:11 +

-Relationships
+Relationships

-Notes

~0003036

lurker (reporter)

committed
+Notes

-Issue History
Date Modified Username Field Change
2008-10-26 05:11 lurker New Issue
2008-10-26 05:11 lurker File Added: nonstockpilecoverage.diff
2008-10-26 11:34 lurker Note Added: 0003036
2008-10-26 11:36 lurker Assigned To => lurker
2008-10-26 11:36 lurker Status new => resolved
2008-10-26 11:36 lurker Resolution open => fixed
2008-10-26 11:36 lurker Product Version => 0.77b5+svn
+Issue History