Gamestudio Links
Zorro Links
Newest Posts
A simple game ...
by bbn1982. 06/18/24 10:42
Face player all the time ...
by bbn1982. 06/18/24 10:25
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, bbn1982, vicknick), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pan_remove is making me angry. help plz #261635
04/19/09 01:43
04/19/09 01:43
Joined: Mar 2009
Posts: 17
warkarma Offline OP
Newbie
warkarma  Offline OP
Newbie

Joined: Mar 2009
Posts: 17
i am trying to make a simple thing by creating panel and after its on the screen deleting it. But then i create panel and try to remove it the program sends me an error message which is W1516 Invalid pointer freed -




!!! HELP !!!

This is my code:

#include <acknex.h>;
#include <default.c>;


BMAP* bullet_png = "missile.png";
PANEL* panel;


function main()
{
video_mode = 7;
video_screen = 2;

while(1)
{
if(key_p)
{
panel = pan_create("bmap = bullet_png;",1);
panel.pos_x = 300;
panel.pos_y = 300;
panel.layer = 5;
panel.flags = VISIBLE;
}
if(key_r)
{
pan_remove(panel);
}

wait(1);
}


}


P.S. Oh yeah i am using 1.70.1 V

Last edited by warkarma; 04/19/09 12:26.

Trust NoOne (only me =])
_________________________
Re: pan_remove is making me angry. help plz [Re: warkarma] #261655
04/19/09 09:24
04/19/09 09:24
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
i think you can remove panel that you create with pan_create smile and whay to remove, just make it invisible,it's easier wink


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: pan_remove is making me angry. help plz [Re: warkarma] #261656
04/19/09 09:26
04/19/09 09:26
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this (untested) instead.
Code:
#include <acknex.h>;
#include <default.c>;


BMAP* bullet_png = "missile.png";
PANEL* panel = NULL;


function main()
{
   video_mode = 7;
   video_screen = 2;

   while(1)
   {
      if((key_p)&&(panel==NULL))
      {
         panel = pan_create("bmap = bullet_png;",1);
         panel.pos_x = 300;
         panel.pos_y = 300;
         panel.layer = 5;
         panel.flags = VISIBLE;
      }
      if((key_r)&&(panel))
      {
         pan_remove(panel);
         panel = NULL;
      }

      wait(1);
   }

}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: pan_remove is making me angry. help plz [Re: EvilSOB] #261679
04/19/09 12:22
04/19/09 12:22
Joined: Mar 2009
Posts: 17
warkarma Offline OP
Newbie
warkarma  Offline OP
Newbie

Joined: Mar 2009
Posts: 17
No. This doesn't work. I get this error now.


Trust NoOne (only me =])
_________________________
Re: pan_remove is making me angry. help plz [Re: Jaxas] #261680
04/19/09 12:24
04/19/09 12:24
Joined: Mar 2009
Posts: 17
warkarma Offline OP
Newbie
warkarma  Offline OP
Newbie

Joined: Mar 2009
Posts: 17
If i am going to create a million panels and hide them all its would be just wrong. So i want to learn how to remove it then i create it.


Trust NoOne (only me =])
_________________________
Re: pan_remove is making me angry. help plz [Re: warkarma] #261683
04/19/09 12:34
04/19/09 12:34
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Code:
if((key_r)&&(panel))

Change it to this:
Code:
if((key_r)&&(panel != NULL))


Now it should work!

Re: pan_remove is making me angry. help plz [Re: Ralph] #261684
04/19/09 12:37
04/19/09 12:37
Joined: Mar 2009
Posts: 17
warkarma Offline OP
Newbie
warkarma  Offline OP
Newbie

Joined: Mar 2009
Posts: 17
IT WORKS. THANKS A LOT


Trust NoOne (only me =])
_________________________
Re: pan_remove is making me angry. help plz [Re: warkarma] #261689
04/19/09 13:21
04/19/09 13:21
Joined: Jan 2009
Posts: 9
Russia
O
Olorin Offline
Newbie
Olorin  Offline
Newbie
O

Joined: Jan 2009
Posts: 9
Russia
When you create the new panel also it is necessary to check that the panel has not been created earlier. As consider that when you press a key on the keyboard, the condition "if (key_p)" is equally True in the several iterations of a cycle "while".

Re: pan_remove is making me angry. help plz [Re: Olorin] #261690
04/19/09 13:25
04/19/09 13:25
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Sorry warkarma, Im getting sloppy...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: pan_remove is making me angry. help plz [Re: EvilSOB] #261694
04/19/09 13:46
04/19/09 13:46
Joined: Mar 2009
Posts: 17
warkarma Offline OP
Newbie
warkarma  Offline OP
Newbie

Joined: Mar 2009
Posts: 17
Its ok EvilSOB smile it works now perfectly.


Trust NoOne (only me =])
_________________________

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1