2025-07-22 05:16 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000531Spring engineGeneralpublic2007-05-02 12:00
Reportersemi 
Assigned Totvo 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000531: [patch] CUnitHandler::ShowUnitBuildSquare incorrect handling of buildfacing
DescriptionWhen selecting a location for a new building, places where previously queued buildings prevent placing the new building, should show in dark green for the area that is ok and red for the area that is occupied by the previously queued building. This works ok, as long as the previously queued buildings have default buildfacing. If the previously queued building is not square and has buildfacing flipped once for 90 degrees, then hovering the new build project on top of that will show wrong graphics, having light green for the whole building where a cancel would occur, or red even where it's not over the previous building.

My patch fixes this and I've tested that it works.
Steps To ReproducePause the game, select a builder and queue a vehicle lab (or any non-square) somewhere far away from the builder (to prevent the building being initiated). Then select a wind generator from the build menu and while holding shift, hover the mouse cursor all over the previously queued vehicle lab. Notice the graphics.

Then flip buildfacing once, queue another vehicle lab, and again hover over it with a wind generator. Notice the graphics, they are inconsistent with the first case. If the wind generator is over the vertical border of the vehicle lab, and just 1/3 of the wind is overlapping the lab, then 2/3 of it is red. If the wind is over the horizontal border of the lab, then it's light green in any position.
Additional InformationThe bug is quite similar with previously fixed bug 0000508, as is the fix.

The bug only seems to affect the graphics shown. A screenshot will be attached.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon ShowUnitBuildSquare_semi.diff (949 bytes) 2007-05-02 11:14 -
    Index: rts/Sim/Units/UnitHandler.cpp
    ===================================================================
    --- rts/Sim/Units/UnitHandler.cpp	(revision 3706)
    +++ rts/Sim/Units/UnitHandler.cpp	(working copy)
    @@ -447,15 +447,11 @@
     			CFeature* feature=0;
     			int tbs=TestBuildSquare(float3(x,pos.y,z),buildInfo.def,feature,gu->myAllyTeam);
     			if(tbs){
    -				UnitDef* ud;
    -				float3 cPos;
     				std::vector<Command>::const_iterator ci = cv.begin();
     				for(;ci != cv.end() && tbs; ci++){
    -					ud = unitDefHandler->GetUnitByID(-ci->id);
    -					cPos.x = ci->params[0];
    -					cPos.z = ci->params[2];
    -					if(max(cPos.x-x-SQUARE_SIZE,x-cPos.x)*2 < ud->xsize*SQUARE_SIZE
    -						&& max(cPos.z-z-SQUARE_SIZE,z-cPos.z)*2 < ud->ysize*SQUARE_SIZE){
    +					BuildInfo bc(*ci);
    +					if(max(bc.pos.x-x-SQUARE_SIZE,x-bc.pos.x)*2 < bc.GetXSize()*SQUARE_SIZE
    +						&& max(bc.pos.z-z-SQUARE_SIZE,z-bc.pos.z)*2 < bc.GetYSize()*SQUARE_SIZE){
     						tbs=0;
     					}
     				}
    
    diff file icon ShowUnitBuildSquare_semi.diff (949 bytes) 2007-05-02 11:14 +
  • jpg file icon ShowUnitBuildSquare_buildfacing_broken.jpg (351,235 bytes) 2007-05-02 11:14

-Relationships
+Relationships

-Notes

~0000902

tvo (reporter)

Looks fine and assuming it works fine too => Committed.

Thanks for your contribution!
+Notes

-Issue History
Date Modified Username Field Change
2007-05-02 11:14 semi New Issue
2007-05-02 11:14 semi File Added: ShowUnitBuildSquare_semi.diff
2007-05-02 11:14 semi File Added: ShowUnitBuildSquare_buildfacing_broken.jpg
2007-05-02 11:59 tvo Status new => assigned
2007-05-02 11:59 tvo Assigned To => tvo
2007-05-02 12:00 tvo Status assigned => resolved
2007-05-02 12:00 tvo Resolution open => fixed
2007-05-02 12:00 tvo Note Added: 0000902
+Issue History