[Question] Splitting gamemode, found weird problem
#1

Hi there.

I've found this strange problem while I was trying to organize a gamemode that me and a friend were scripting by seperating it by files, such as placing the callbacks in each seperate file, like
Код:
#include "../src/Callbacks/OnPlayerSpawn.pwn"
and so on.

I also made a folder for definitions, such as macros, variables and others
For now I got these two files
Код:
#include "../src/Definitions/Macros/colors.pwn"
#include "../src/Definitions/Macros/general.pwn"
the file colors.pwn only has defined colors while general.pwn has all other defines such as dialogIDs, redifinition of max_players and such.

The problem being, the colors.pwn works perfectly fine, while general.pwn, even though the compiler knows that the file exists, it gives errors when compiling because of undefined stuff, which they exist in this file.

Even more strange, when I change that file to another place, such as
Код:
#include "../src/Definitions/general.pwn"
it works perfectly fine.

Has anyone ever happened a similar case? or even the same one?
Know any solutions or workarounds?

Thanks for reading and thanks in advance for any replies.
Reply
#2

Order matters with includes seems to be the problem here.
Reply
#3

Weird, if I change
Код:
#include "../src/Definitions/Macros/colors.pwn"
#include "../src/Definitions/Macros/general.pwn"
to
Код:
#include "../src/Definitions/Macros/general.pwn"
#include "../src/Definitions/Macros/colors.pwn"
It says that the colors arent defined.

Why does this happen?
Reply
#4

oh wow, I feel like an ignorant now. Thanks for pointing that one out.

But another issue that popped now:

in general.pwn, I had a define that was basically a macro of another file
Код:
#define BoughtCars_Dir "Vehicles\BoughtCars.txt"
And that shows me these kind of errors
Код:
error 027: invalid character constant
These dont show up if I use "/", why is that?

Plus, why on my first question, the first file worked correctly and the second one didnt?
Reply
#5

I see, thanks for your help, I appreciate it.

Just one last thing, sorry for being persistent:

Why does it work with "/" on the string? (Atleast I think it's working, last I checked)
Reply
#6

Huh? Forward slashes have always worked fine as directory separators. For me, at least.
Reply
#7

Ok, thanks for all your replies. You can lock this thread if you wish.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)