Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Problem with creating struct object dynamically [Re: pegamode] #219358
08/02/08 11:29
08/02/08 11:29
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

Quote:
STRING* objName = "";

Perhaps the length of the string is not altered by file_str_read, so the string is always empty. You could try to initialize a longer string.

Re: Problem with creating struct object dynamically [Re: Fenriswolf] #219363
08/02/08 11:42
08/02/08 11:42
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi Fenriswolf,

I tried that already ... no change at all.

If it would be always the same name or always an empty string, the size of my hashmap would rise.

I also printed out all values that come into the dll and everything seems to be ok, but it looks like I get always the same pointer to my struct and this is overwriting itself in the loop.

Re: Problem with creating struct object dynamically [Re: pegamode] #219370
08/02/08 12:11
08/02/08 12:11
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
There is another thing I realized just a moment ago. Dont know if this causes the problem though. : )

Quote:
((USEABLE_OBJECT*)tmpObj).description = strTemp;

This just stores a pointer to the local variable. Have you already tried to use str_cpy or str_create here?

Re: Problem with creating struct object dynamically [Re: Fenriswolf] #219377
08/02/08 12:43
08/02/08 12:43
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hmm ... good hint ... I'll try that.

Re: Problem with creating struct object dynamically [Re: pegamode] #219495
08/02/08 20:43
08/02/08 20:43
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Thanks a lot Fenriswolf ... now it's working fine.

The problem was that I used str_cpy, but it has to be str_create ...

file_str_read(fhandle,str);
((USEABLE_OBJECT*)tmpObj).description = str_create(str);

So it wasn't a problem with the struct object, but how the data of the struct was set. I stored a pointer to a pointer.

Now I can easily read all the additional data for my entities from my csv-file, put it into my GSHashmap and can get it back from there when I need them. A big advantage is that I also can save a lot of state data for my entities and don't lose them when changing the levels.

As I am currently working on a point&click adventure I made a big step forwards with the base implementation.

Thanks to everyone who helped ... @everyone ... feel free to use my GSHashmap.
If you have questions or tips for improvement just contact me or better write into this thread so that everyone can discuss.

Best regards,
Pegamode.

Re: Problem with creating struct object dynamically [Re: pegamode] #219539
08/03/08 03:44
08/03/08 03:44
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Btw: thank you for sharing your hashmap dll. : )
I haven't tried it out yet, but it will come in handy for sure.

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