View Issue Details

IDProjectCategoryView StatusLast Update
0002982FSSCPHUDpublic2014-06-16 15:36
Reporterm_m Assigned Tom_m  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.1 
Target Version3.7.2 
Summary0002982: ASSERTION: "x >= 0 && y >= 0" at hud.cpp:403 when using the training messages HUD gauge
DescriptionThis HUD gauge uses a negative offset to position itself so moving it to a place close to the screen borders where those offsets make the screen coordinates negative will cause the mentioned assertion.
That assertion is presumably not needed anymore and should be removed, see attached patch.
Steps To ReproducePlace the attached hud_gauges.tbl inside your tables folder and start FSO.
TagsNo tags attached.

Activities

m_m

2013-12-18 09:35

developer  

hud_gauges.tbl (2,138 bytes)

m_m

2013-12-18 09:35

developer  

hud.cpp.patch (310 bytes)   
Index: code/hud/hud.cpp
===================================================================
--- code/hud/hud.cpp	(revision 10248)
+++ code/hud/hud.cpp	(working copy)
@@ -400,8 +400,6 @@
 
 void HudGauge::initPosition(int x, int y)
 {
-	Assert(x >= 0 && y >= 0);
-
 	position[0] = x;
 	position[1] = y;
 }
hud.cpp.patch (310 bytes)   

niffiwan

2013-12-18 11:15

developer   ~0015521

Interesting... I'm thinking that the hud gauges should default to setting the offsets to {0, 0} if the Origin is set and the Offsets are not set in the table.

Alternatively, if the Origin is set then the Offsets become mandatory instead of optional, but that seems like it's making modders lives harder than they need to be.

Either way, I think the current behaviour is a little bit non-intuitive and needs to be changed somehow.

The Assertion is supposed to pick up on gauges that are specified to appear offscreen (fully or partially) so I think it should probably remain, although the wording of the Assertion could be improved to make this clearer.

niffiwan

2013-12-19 02:18

developer   ~0015523

Last edited: 2013-12-20 08:13

What do you think of this as a solution?
https://github.com/niffiwan/fs2open.github.com/commit/74a5e2c53e142c00e9bf27a62ba086df0a0a466a


Oops - check the 2nd commit as well, I forgot to make the changes to the two non-common gauges.

------------------

Actually - forget this, it's a bad idea as layouts using just the origin will probably have alignment issues

m_m

2014-03-01 12:38

developer   ~0015632

Is this still an issue? I remember a discussion about it but I can't remember if a solution was found.

The_E

2014-06-16 15:36

administrator   ~0015882

Fix committed to trunk@10820.

Related Changesets

fs2open: trunk r10820

2014-06-16 11:55

The_E


Ported: N/A

Details Diff
Fix for Mantis 2982: Removes superfluous Assert.
Affected Issues
0002982
mod - /trunk/fs2_open/code/hud/hud.cpp Diff File

Issue History

Date Modified Username Field Change
2013-12-18 09:35 m_m New Issue
2013-12-18 09:35 m_m Status new => assigned
2013-12-18 09:35 m_m Assigned To => m_m
2013-12-18 09:35 m_m File Added: hud_gauges.tbl
2013-12-18 09:35 m_m File Added: hud.cpp.patch
2013-12-18 09:35 m_m Status assigned => code review
2013-12-18 11:15 niffiwan Note Added: 0015521
2013-12-19 02:18 niffiwan Note Added: 0015523
2013-12-19 03:21 niffiwan Note Edited: 0015523
2013-12-20 08:13 niffiwan Note Edited: 0015523
2014-03-01 12:38 m_m Note Added: 0015632
2014-06-16 15:36 The_E Changeset attached => fs2open trunk r10820
2014-06-16 15:36 The_E Note Added: 0015882
2014-06-16 15:36 The_E Status code review => resolved
2014-06-16 15:36 The_E Resolution open => fixed