Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
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
3 registered members (7th_zorro, AndrewAMD, TedMar), 837 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
str_cpy bug? #436619
01/30/14 07:53
01/30/14 07:53
Joined: Dec 2010
Posts: 224
NRW, Germany
NeoJones Offline OP
Member
NeoJones  Offline OP
Member

Joined: Dec 2010
Posts: 224
NRW, Germany
Hi!
I have a problem with the multiplayer workshop from AUM 74.
In "multiplayer3.c" in line 80:
Code:
str_cpy(input_str, "#100"); // reset the input string


If I test it, there comes the text "#100" on enter key. But if I start the original server.bat and press the enter key, it works...!? I think, this is a bug?

I have Version A8.40.3 Com

Can anyone help me please?


Errors are the engine of progress.

Version: A8 Commercial
OS: Win 7 64bit
Models: Cinema 4D
Re: str_cpy bug? [Re: NeoJones] #436622
01/30/14 08:37
01/30/14 08:37
Joined: Dec 2010
Posts: 224
NRW, Germany
NeoJones Offline OP
Member
NeoJones  Offline OP
Member

Joined: Dec 2010
Posts: 224
NRW, Germany
Ok, I find it myself. Its not a bug. Here is my solution:

I changed:
Code:
str_cpy(input_str, "#100"); // reset the input string


with this:
Code:
str_cpy((input_txt.pstring)[0], str_create("#100")); // reset the input string



I think for TEXT objects its better you work with pstring.


Errors are the engine of progress.

Version: A8 Commercial
OS: Win 7 64bit
Models: Cinema 4D
Re: str_cpy bug? [Re: NeoJones] #436638
01/30/14 12:04
01/30/14 12:04
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I think #100 only works in str_create and when defining a string globally, and not in str_cpy which only copies a content to another string...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: str_cpy bug? [Re: sivan] #436650
01/30/14 18:00
01/30/14 18:00
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Ouh, your "solution" leaks memory.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: str_cpy bug? [Re: WretchedSid] #436655
01/30/14 19:09
01/30/14 19:09
Joined: Dec 2010
Posts: 224
NRW, Germany
NeoJones Offline OP
Member
NeoJones  Offline OP
Member

Joined: Dec 2010
Posts: 224
NRW, Germany
Thanks for your replies. yes, but it works for Me. sid Do you know a better way?

Last edited by Dragonfly; 01/30/14 19:13.

Errors are the engine of progress.

Version: A8 Commercial
OS: Win 7 64bit
Models: Cinema 4D
Re: str_cpy bug? [Re: NeoJones] #436715
01/31/14 18:07
01/31/14 18:07
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: Dragonfly
yes, but it works for Me.

That sounds like a fundamental lack of knowledge in regards to memory management. Which is bad the second you start playing with dynamically allocated memory.

Originally Posted By: Dragonfly
sid Do you know a better way?

Yes. But you should google "memory leak" and use the manual to find out why it is a memory leak, what's so bad about it and how it's fixed.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: str_cpy bug? [Re: WretchedSid] #436750
02/01/14 05:16
02/01/14 05:16
Joined: Dec 2010
Posts: 224
NRW, Germany
NeoJones Offline OP
Member
NeoJones  Offline OP
Member

Joined: Dec 2010
Posts: 224
NRW, Germany
Ok, but I really don't understand, why you can't explain me about the problem.
I asked google for that, but I dont understand, whats the problem here.
This line:
Code:
str_cpy(input_str, "#100"); // reset the input string


is the original code of the workshop in AUM 74.


Errors are the engine of progress.

Version: A8 Commercial
OS: Win 7 64bit
Models: Cinema 4D
Re: str_cpy bug? [Re: NeoJones] #436756
02/01/14 10:47
02/01/14 10:47
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Yes, this code creates the string once. Yours creates a new string every time you call it.


POTATO-MAN saves the day! - Random

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