Calling a method of methodmap1 from methodmap2, while still being able to call a method of methodmap2 from methodmap1 is not something that you can do on sourcepawn. But if you are desperate to do so, I found a workaround (that does not break the compiler
).
Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo = {
name = "",
author = "",
description = "",
version = "0.0.0",
url = ""
};
//we'll define MM2 as a enum, since we won't be calling its functions directly,
//and it can be overwritten by the methodmap later
enum MM2 { }
methodmap MM1 {
public MM1()
{
//because the methodmap MM2 does not exist yet for sourcepawn, we need to call a function that calls the method
//functions can be called first and defined later, methods can't
InstatiateMM2();
return view_as<MM1>(0);
}
}
methodmap MM2 {
public MM2()
{
//since MM1 was already defined, we can call it without problems
MM1 mm1 = MM1();
return view_as<MM2>(0);
}
}
//this wraps the MM2 constructor allowing us to call it before it being defined
//this needs to be defined AFTER the method we are trying to call
MM2 InstatiateMM2()
{
return MM2();
}
public void OnPluginStart()
{
//infinite loop
MM1 mm1 = MM1();
}
Note: You'll get a missing tag waring on places where the compiler expected a the methodmap to be returned but the enum was given instead (and vice versa).
__________________