Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


function argument problem

This topic is 5332 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all, this problem might seem a little hard to believe but hear me out. i''ve got a function that takes care of all the game play in my game (drawing, destroying, all those sorts of things). when i use it with one set of variables (all are referenced by the function) it works fine, the game plays as it should, but when i use another set of functions that are pretty much the same as the first set (i.e. they are designed for 2nd player data so they are just named differently), none of the stuff that''s supposed to happen happens... the function is called with the first set of variables, then the second set, but no matter which order, the first set will work and the second won''t. please, anyone who can, shed some light on this for me (and help me if you can) thanx

Share this post

Link to post
Share on other sites
Sorry. You have not described your problem in a way that will even let us begin to figure out what the problem may be. There is no way for us to help you until you do so. A minimal (we don''t want your whole project) but complete (compiles, runs, demonstrates the bug) code example would be a good place to start.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
— Brian W. Kernighan

Share this post

Link to post
Share on other sites
sorry i tried to explain it as best i could without giving code for two reasons:
1. even a sample of just the code that is messing up is will be a lot,
2. either way i give the code (whole or just the problem) you wont be able to run it because like i said, its a game, you wont have the graphics etc.

since you say you cant help though ill ignore my first reason for now. hope it can help show the problem.

this is the function that gets called twice:

void Play(Block &preview, Block &control, Switcher &swap,
Field &playf, int fieldnum, BBlock &firstsplit,
BBlock &secondsplit, int &breaknum, int &fallnum,
int &score, int &oppdamage, int &storenum, int &storefall,
bool &freeze, int &stopup, int &move, POINT &boom,
int &playmode, bool &change, bool &playit,
int &total, bool &explode, int &dropsp)
//Show PL preview blocks

//Show PL controlled blocks

if(playmode == 1)
//Store the block data in the field object

if (!control.CollisionTest(0,1,playf))
playf.dropping = TRUE;
if (dropsp == 0 && breaknum == 0)
{//Drop blocks

{for (int count2 = 1; count2 <= 126; ++count2)
(count2,playf.blockdata[count2].colour) >= 4)
{for (int count = 1; count <= 126; ++count)
{if (playf.blockdata[count].linked == 1)
{playf.blockdata[count].linked = 0;}
if(playf.blockdata[count2].colour > 0 &&
count2 == 122)
if(dropsp == 0)
{if(fallnum > 1)
fallnum = 0;
{if(playmode == 1 && !end)
{//Setup position of PL1 new blocks

{if(playmode == 1)
{playmode = 2;
{playmode = 1;}
change = FALSE;
dropsp = 8;
if(playmode == 1)
{animspeed = 11;}
if(playmode == 2)
{animspeed = 18;}
POINT *spare = &boom;
for (int count = 1; count <= total; ++count)
{int cell = blockdie.Animate(lpddsback,lptemp,animspeed,
if(cell == 0)
{explode = TRUE;
breaknum = 0;
total = 0;}
if(cell == 1)
if(explode && state == story)
{int cell = blueboom.Animate(lpddsback,lpanims,4,spare[2].x,
if(cell == 0)
{explode = FALSE;}
if(breaknum > 3)
{storenum = breaknum;
stopup = 75;
move = 0;
storefall = fallnum;
if(fallnum > 1)
{if(playmode == 1)
{score = score+((storefall*7)^2);}
if(playmode == 2)
{score = score+((storefall)^2);}
if(stopup > 0)
{if(move != -50)
if(storenum > 4)
if(storefall > 1 && storenum > 3)
{storenum = 0;
storefall = 0;
playit = FALSE;
fallnum = 0;}

and this is how it is called:


as you can see in both calls the variables are just named differently.

thanx again for any suggestions

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!