Gamestudio Links
Zorro Links
Newest Posts
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,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Array of pointers to structures. #348902
12/01/10 17:27
12/01/10 17:27
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Hey guys I'm having a but of a problem. I hope it doesn't get to confusing so I'll try to explain it as simple as possible. I'm trying to make a pretty complicated inventory system and in order to do so each item slot needed a struct. I then wanted to keep the different items organized inside another struct (the inventory). The best way I could think of doing this was to create an array where each array element was a pointer to an item. I'm having a real hard time defining this can someone help please I keep getting syntax errors.
Code:
typedef struct { 
	int itemNum; 
	int itemID; 
	int iSpell; 
	int minD;
	int maxD;
	int arm;
	
	int quant;
	int pref;
	int suf;
	int sock1;
	int sock2;
	int sock3;
	
} _item;

typedef struct {
	_item* item[31];
}_inventory



Last edited by PrenceOfDarkness; 12/01/10 17:50.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: Array of pointers to structures. [Re: PrenceOfDarkness] #348904
12/01/10 17:36
12/01/10 17:36
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
Last line where is a semicolon missing.
Error messages would help.

EDIT:
I don't understand your way how you want to organize the items.

muffel

Last edited by muffel; 12/01/10 17:37.
Re: Array of pointers to structures. [Re: muffel] #348909
12/01/10 17:52
12/01/10 17:52
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
yea I muffel I'm sorry it's a bit complicated, that's why I was a afraid of even asking on here. I'm trying to think of a better way to word it but I can't come up with one.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: Array of pointers to structures. [Re: PrenceOfDarkness] #348913
12/01/10 18:49
12/01/10 18:49
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Your concept is completely right and there is nothing wrong with the code, except of the missing semicolon at the end.
It compiles fine here and works like expected, so you probably just redefined something existing or did some other things wrong? The Lite-C compiler isn't a real help when trying to track down the correct line which causes the error.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: Array of pointers to structures. [Re: WretchedSid] #348928
12/01/10 21:41
12/01/10 21:41
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Thank you so much Sid you were completely right! thank you!


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.

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