Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Struct Komponenten Problem [Re: EvilSOB] #399627
04/17/12 20:20
04/17/12 20:20
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Also, try changing some or all of your referenced to "xxx->INIT" and
replace them with "xxx.INIT" instead...

I dont know if this is BAD or not... I still havent figured out the difference
properly yet. I thought you would only use "->INIT" if INIT was a pointer...
But I still dont truly get it...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Struct Komponenten Problem [Re: EvilSOB] #399629
04/17/12 20:34
04/17/12 20:34
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
had a couple of those mistakes where the word was used by the engine myself aswell like you said INIT to something else like hero_init....

the . is basicly how you would acces a array/structure like

VECTOR *bunch = malloc(sizeof(VECTOR)*10);//something like that not sure now
bunch[0].x=0;

the -> is pointer acces

i am so confused now between c++ and this ... but anyway hope something works
as i dont have gamestudio installed to test laugh


Compulsive compiler
Re: Struct Komponenten Problem [Re: Wjbender] #399705
04/18/12 18:49
04/18/12 18:49
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
this code works without a single problem
the problem is with your watched var's(or with var instead of int) theire not displayed correct!

Code:
typedef struct MONSTER
{
	int INIT_M;

}MONSTER;

typedef struct HERO
{
	int INIT;

}HERO;

MONSTER* create_enemies()
{
	MONSTER* enemy = malloc(sizeof(MONSTER));
	if(enemy)
	{
		enemy.INIT_M = 14;
		return enemy
	}
	return NULL;
}

int hero_order[3] = {0,1,2};
int cur_hr = 0;

HERO* create_hero()
{
		HERO* hero = malloc(sizeof(HERO));
		if(hero)
		{
			int cur_hero_order=hero_order[cur_hr];
			
			switch (cur_hero_order)
			{
				case 0:
					hero.INIT=16;
				break;

				case 1:
					hero.INIT=12;
				break;

				case 2:
					hero.INIT=15;
				break;
			}

			cur_hr+=1;
			return hero;
		}
		return NULL;
		
}

void create_battle_startup()
{
	
	HERO* hero0 = create_hero();
	HERO* hero1 = create_hero();
	HERO* hero2 = create_hero();
	MONSTER* monster0 = create_enemies();
	MONSTER* monster1 = create_enemies();
	MONSTER* monster2 = create_enemies();
	
 	int a = hero0.INIT; 
 	int b = hero1.INIT;
 	int c = hero2.INIT; 
   printf("%d,%d,%d",a,b,c);
 
}



Last edited by Wjbender; 04/18/12 18:53.

Compulsive compiler
Page 2 of 2 1 2

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