Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SSH on Sat 03/12/2005 22:49:11

Title: SUGGESTION: Detect the impossible!
Post by: SSH on Sat 03/12/2005 22:49:11
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...
Title: Re: SUGGESTION: Detect the impossible!
Post by: Pumaman on Sat 03/12/2005 23:59:49
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.
Title: Re: SUGGESTION: Detect the impossible!
Post by: scotch on Sun 04/12/2005 00:19:54
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.
Title: Re: SUGGESTION: Detect the impossible!
Post by: Ginny on Sun 04/12/2005 14:23:48
Heh, exactly what I used. :D Btw, it's probably the same with walkable areas, walkbehinds and regions, right?