SUGGESTION: Detect the impossible!

Started by SSH, Sat 03/12/2005 22:49:11

Previous topic - Next topic

SSH

It is quite easy to use the code:

if (Hotspot.GetAtScreenXY == null) ...

which can NEVER be true, becasue it alwasy returns a valid ptr, even if for Hotspot 0. AGS should warn if someone uses the above code, as the code would work for Chars or Objects...
12

Pumaman

Interesting point, though there's currently two issues with this:

1. AGS does not currently have the facility to generate warnings in the script compiler
2. As far as the compiler is concerned, Hotspot.GetAtScreenXY is a function just like any other, I wouldn't really want to modify it specifically for that function.

However, you raise a good point and I can see how people could easily get confused about this.

scotch

Confused me for a couple of minutes, you mean if (Hotspot.GetAtScreenXY(x,y) == null) right? I was reading it as if you meant Hotspot.GetAtScreenXY would be a pointer to the function... which seemed unlikely.  Anyway, I think a warnings system would be nice, because I have had people in #ags expecting that exact line to work before.

Ginny

Heh, exactly what I used. :D Btw, it's probably the same with walkable areas, walkbehinds and regions, right?
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

SMF spam blocked by CleanTalk