when in doubt, decompile it and see what you get.
Announcement
Collapse
No announcement yet.
Runaway loops
Collapse
X
-
-
I get a lot of warnings about variable declarations with no references. Not quite sure that that means, but if I initialise them with a value it solves the problem. This is lengthy though. Is there an easier way?
-r0t.uk- cOOp - Mapvote - r0t.uk:26001
-r0t.uk- DM - Mapvote - r0t.uk:26000
Comment
-
SVN revision 4745 from today.Originally posted by PrimalLove View PostEDIT2: Which version fteqcc you use?
Code:svn co http://svn.code.sf.net/p/fteqw/code/trunk fte/ cd fte/engine/qclib make
AddingOriginally posted by slackhead View PostI get a lot of warnings about variable declarations with no references. Not quite sure that that means, but if I initialise them with a value it solves the problem. This is lengthy though. Is there an easier way?
to progs.src.Code:#pragma warning disable Q302
FTEQCC FAQ - FTELast edited by golden_boy; 09-05-2014, 02:50 PM.
Comment
-
ROFL! Yeah they are just kinda there. You'll get like 140 or so references like that. They are perfectly fine but if you want you can simply comment them out or in most cases just completely get rid of them to clean up the code. They are more or less placeholders for something that either no long is in the code or like a just in case we want to use it here thing. ID has pretty sloppy code.Originally posted by slackhead View PostOh sorry I'm an idiot. It means that a variable has been declared and not used.
I'm guessing frikqcc just ignores them.
Comment
-
For a funny example of left over code check this out in ai.qc:
What is monster_dragon you ask? No dragon in Quake! Well unless you have mission pack 2Code:/* ============= ai_walk The monster is walking it's beat ============= */ void(float dist) ai_walk = { [COLOR="Red"]local vector mtemp; movedist = dist;[/COLOR] [COLOR="Red"]if (self.classname == "monster_dragon") { movetogoal (dist); return;[/COLOR] } // check for noticing a player if (FindTarget ()) return; movetogoal (dist); };
And the local vector? Da Fuq?
This is left over code from earlier versions of Quake. This is sloppy code so you can clean it up if you want with this:
That cleans it right up.Code:/* ============= ai_walk The monster is looking for an collecting items. ============= */ void(float dist) ai_walk = { // check for noticing a player if (FindTarget ()) return; movetogoal(dist); };
Last edited by PrimalLove; 09-05-2014, 03:10 PM.
Comment
-
I'll just remove the bits that get warnings in the compiler for now.
Anyone got a way of fixing this mismatch?:
Got a few of those.Code:in function PutClientInServer (line 77), client.qc:433: warning F307: type mismatch: void() to void(entity attacker, float damage) entity .th_pain
-r0t.uk- cOOp - Mapvote - r0t.uk:26001
-r0t.uk- DM - Mapvote - r0t.uk:26000
Comment
-
This means that the code has a function expecting two arguments (attacker, damage) but the actual function doesn't use those. Or the other way around.Originally posted by slackhead View PostI'll just remove the bits that get warnings in the compiler for now.
Anyone got a way of fixing this mismatch?:
Got a few of those.Code:in function PutClientInServer (line 77), client.qc:433: warning F307: type mismatch: void() to void(entity attacker, float damage) entity .th_pain
Comment
-
Pastebin.com the code please, I really can't remember what this looks like in vanilla QC.Originally posted by slackhead View PostYes, but how fix those? My C is a little shakey.
Comment
-
Pasted code - client.qc
Line 433
compiling client.qc
in function PutClientInServer (line 77),
client.qc:433: warning F307: type mismatch: void() to void(entity attacker, float damage) entity
.th_pain
-r0t.uk- cOOp - Mapvote - r0t.uk:26001
-r0t.uk- DM - Mapvote - r0t.uk:26000
Comment
-
*cough*
*cough* *cough*
#pragma warning disable F307
*cough*
add the extra arguments to the function in question. you don't have to use them.
alternatively self.th_pain = (void(entity, float)) Player_Pain;
or whatever the function is.Last edited by Spike; 09-05-2014, 03:42 PM.
Comment
-
Originally posted by slackhead View PostYes, but how fix those? My C is a little shakey.
In that particular case you can't fix it. Otherwise you would competely have to change the way the code works. As is, it allows for the player to go into pain animations based on being hurt. But if you place the additional parameters the routine will become specific and you'd have to come up with some code to compensate. Off the top of my head I can't think of a fix that wouldn't just lead to more bloat so why bother? PutClientInServer() basically resets the player with all the beginning params he needs when spawning in. Changing this would require prediction of information that isn't stored anymore I think. So it just isn't going to work. The good news here is this is a one way exchange. So it doesn't need the additional params. If any of that makes sense?
Let me explain why it catches this as an error. Functions not matching field types quickly leads to functions being called with the wrong number of parameters. You can imagine such a thing very quickly leading to a debugging nightmare especially the more complex your code gets. That is why this compiler throws up warnings about this issue. It's really to protect you from writing functions that simply can't possibly work or using the wrong parameters leading to bugs and crashes.
In short, it depends on the circumstance. In some cases you could define the additional params and its all good. But in this case you would seriously muck up the code and would do more damage than good. It's one of those errors you should ignore.
@Spike
Ah yes you can do that too!
I like to keep mine on for debugging.
But yeah most might find it annoying having all those warnings.
Last edited by PrimalLove; 09-05-2014, 03:47 PM.
Comment
Comment