How to have includes that depend on each other? (Modular programming) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to have includes that depend on each other? (Modular programming) (
/showthread.php?tid=663625)
How to have includes that depend on each other? (Modular programming) -
PeanutButter - 07.02.2019
Hello, I'm having trouble with including files because they depend on each other. Instead of having all the code in one file I decided to split them up in multiple include files. So I have a main file called
main.pwn and I'm trying to include 2 files called
Events.inc and
Player.inc.
But the problem is that
Events.inc uses variables that were defined in
Player.inc and
Player.inc uses macro's that were defined in
Events.inc. I know there's an easy fix for this, but I'm trying to split up the files according to their topic, and not their code type.
So no matter what I include first, there's always going to be a problem
Код:
#include "Models/Player.inc"
#include <NewEvents>
or
Код:
#include <NewEvents>
#include "Models/Player.inc"
Is there a way to fix this problem?
Re: How to have includes that depend on each other? (Modular programming) -
Kaliber - 07.02.2019
Hahahaha
Dude hahah xD I have no words xD
There is only one solution, obviously xD
You have to decide which one you wanna include first.
And the part you need in the first one, you have to take out of the second one
#Fin
Re: How to have includes that depend on each other? (Modular programming) -
PeanutButter - 07.02.2019
Yeah, obviously lol. Go easy on me man I haven't done this in years

I was expecting some dark magic method that I've never heard about.