2025-07-19 11:58 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000508Spring engineGeneralpublic2007-04-04 22:06
Reportersemi 
Assigned Totvo 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000508: [patch] Queueing buildings with varying buildfacings cancel each other when shouldn't and vice versa.
DescriptionFunction GetCancelQueued, which should check if two queued buildings would cancel each other, does not take into account that either of the two might have different than default buildfacing.

This bug is present in the latest public release 0.74b3 and also in svn trunk current revision 3511.

My patch fixes this bug.

Bug can be reproduced by queueing a radar tower and then flipping buildfacing once, then queueing a vehicle lab right next to the tower on left or right side. This will cancel both, instead of adding the lab to the queue like it should.

Also if you first queue a radar tower and then flip buildfacing once, then try to queue the lab on top or bottom of the tower so that it's border goes through the middle of the tower, it will be queued, even though the two buildings are overlapping each other.

More realistic situation is to first flip buildfacing once, then queue a fusion, then try to circle it with DT.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • diff file icon GetCancelQueued_semi.diff (1,338 bytes) 2007-03-31 22:40 -
    Index: rts/Sim/Units/CommandAI/CommandAI.cpp
    ===================================================================
    --- rts/Sim/Units/CommandAI/CommandAI.cpp	(revision 3508)
    +++ rts/Sim/Units/CommandAI/CommandAI.cpp	(working copy)
    @@ -821,18 +821,18 @@
     				}
     			}
     			else if (c.params.size() >= 3) {
    -				// assume this means that the first 3 makes a position
    -				float3 cp(c.params[0], c.params[1], c.params[2]);
    -				float3 tp(t.params[0], t.params[1], t.params[2]);
     				if (c.id < 0) {
    -					UnitDef* cu = unitDefHandler->GetUnitByID(-c.id);
    -					UnitDef* tu = unitDefHandler->GetUnitByID(-t.id);
    -					if (cu && tu
    -					    && fabs(cp.x - tp.x) * 2 <= max(cu->xsize, tu->xsize) * SQUARE_SIZE
    -					    && fabs(cp.z - tp.z) * 2 <= max(cu->ysize, tu->ysize) * SQUARE_SIZE) {
    +					BuildInfo bc(c);
    +					BuildInfo bt(t);
    +					if (bc.def && bt.def
    +					    && fabs(bc.pos.x - bt.pos.x) * 2 <= max(bc.GetXSize(), bt.GetXSize()) * SQUARE_SIZE
    +					    && fabs(bc.pos.z - bt.pos.z) * 2 <= max(bc.GetYSize(), bt.GetYSize()) * SQUARE_SIZE) {
     						return ci;
     					}
     				} else {
    +					// assume this means that the first 3 makes a position
    +					float3 cp(c.params[0], c.params[1], c.params[2]);
    +					float3 tp(t.params[0], t.params[1], t.params[2]);
     					if ((cp - tp).SqLength2D() < (17.0f * 17.0f)) {
     						return ci;
     					}
    
    diff file icon GetCancelQueued_semi.diff (1,338 bytes) 2007-03-31 22:40 +

-Relationships
+Relationships

-Notes

~0000861

tvo (reporter)

Committed, r3542 (or 3541 I feel like I'm swapping the two patches now ...)
+Notes

-Issue History
Date Modified Username Field Change
2007-03-31 22:39 semi New Issue
2007-03-31 22:40 semi File Added: GetCancelQueued_semi.diff
2007-04-04 22:05 tvo Status new => assigned
2007-04-04 22:05 tvo Assigned To => tvo
2007-04-04 22:06 tvo Status assigned => resolved
2007-04-04 22:06 tvo Resolution open => fixed
2007-04-04 22:06 tvo Note Added: 0000861
+Issue History