|
Problem with line break
#402521
06/06/12 15:17
06/06/12 15:17
|
Joined: Mar 2006
Posts: 1,993 Karlsruhe
PadMalcom
OP
Serious User
|
OP
Serious User
Joined: Mar 2006
Posts: 1,993
Karlsruhe
|
Hi, I have to following code:
ent_create("graphics\\npc\\EarpYellow.tga", nullvector, actEarp);
The compiler tells me the image could not be found because it recognizes a line break at "\n" behind graphics. How can I avoid that?
|
|
|
Re: Problem with line break
[Re: PadMalcom]
#402609
06/07/12 15:56
06/07/12 15:56
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
You could write the string into a textfile and read it out with txt_load. Then "\n" characters will not be converted to line feeds.
Edit:
TEXT* txt = { strings = 1; flags = SHOW; }
...
txt_load(txt,"paths.txt"); ent_create((txt.pstring)[0], nullvector, actEarp);
no science involved
|
|
|
Re: Problem with line break
[Re: GameScore]
#402613
06/07/12 16:35
06/07/12 16:35
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
It doesnt appear to be the '\n' causing the issue, it just looks like it because the '\n' gets procss by the error message...
Putting in ANY sort of path into the ent-create seems to generate the error. its like ent_create cant handle any paths in the string...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with line break
[Re: Lukas]
#402617
06/07/12 17:02
06/07/12 17:02
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
That dont work (for me) either... Where did that idea come from Lukas? I had to got this far to get it to go...
ENTITY* ent_create2(STRING* filename, VECTOR* pos, VOID* actionn)
{
int size; void* pFile = file_load(filename, NULL, &size);
STRING* shortname=str_create(_chr(filename));
while(str_stri(shortname,"\\")) str_clip(shortname, str_stri(shortname,"\\"));
add_buffer(shortname, pFile, size);
ENTITY* ent = ent_create(shortname, pos, actionn);
add_buffer(shortname, NULL, 0); file_load(NULL, pFile, 0);
str_remove(shortname); return(ent);
}
And I have no idea whats going to happen if you try to load files from different folders that have the same name.... I suspect the first one to be opened will keep on being reused...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Problem with line break
[Re: PadMalcom]
#402622
06/07/12 18:40
06/07/12 18:40
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Try renaming the folder as a test....
Then I would think about logging a bug report...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|