Scripts: Fix ambiguous base class (#1216)

This commit is contained in:
David Markowitz 2023-10-09 13:31:25 -07:00 committed by GitHub
parent 094797881b
commit 500ae4d6e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 33 deletions

View File

@ -1,7 +1,7 @@
#pragma once
#include "CppScripts.h"
class BaseEnemyApe : public CppScripts::Script {
class BaseEnemyApe : virtual public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;

View File

@ -2,7 +2,7 @@
#include "ActivityManager.h"
#include "ZoneAgProperty.h"
class ZoneAgSpiderQueen : ZoneAgProperty, ActivityManager {
class ZoneAgSpiderQueen : public ZoneAgProperty, ActivityManager {
public:
void OnStartup(Entity* self) override;
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,

View File

@ -17,7 +17,7 @@ static std::map<std::u16string, uint32_t> ElementMissions = {
{u"fire", 1962},
};
class NjNPCMissionSpinjitzuServer : public CppScripts::Script {
class NjNPCMissionSpinjitzuServer : virtual public CppScripts::Script {
public:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
private:

View File

@ -8,7 +8,7 @@ struct ActivityTimer {
float_t runTime = 0;
};
class ActivityManager : public CppScripts::Script {
class ActivityManager : virtual public CppScripts::Script {
public:
static bool IsPlayerInActivity(Entity* self, LWOOBJID playerID);
static void UpdatePlayer(Entity* self, LWOOBJID playerID, bool remove = false);

View File

@ -1,7 +1,7 @@
#pragma once
#include "CppScripts.h"
class BasePropertyServer : public CppScripts::Script {
class BasePropertyServer : virtual public CppScripts::Script {
public:
virtual void SetGameVariables(Entity* self);

View File

@ -1,7 +1,7 @@
#pragma once
#include "CppScripts.h"
class BaseWavesGenericEnemy : public CppScripts::Script {
class BaseWavesGenericEnemy : virtual public CppScripts::Script {
public:
void OnStartup(Entity* self) override;
void OnDie(Entity* self, Entity* killer) override;

View File

@ -312,22 +312,17 @@
#include "WildNinjaSensei.h"
#include "WildNinjaBricks.h"
//Big bad global bc this is a namespace and not a class:
InvalidScript* invalidToReturn = new InvalidScript();
std::map<std::string, CppScripts::Script*> m_Scripts;
// yeah sorry darwin ill fix the global later
namespace {
InvalidScript* invalidToReturn = new InvalidScript();
std::map<std::string, CppScripts::Script*> m_Scripts;
};
CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scriptName) {
Script* script;
if (m_Scripts.find(scriptName) != m_Scripts.end()) {
script = m_Scripts[scriptName];
return script;
return m_Scripts[scriptName];
}
script = invalidToReturn;
Script* script = invalidToReturn;
//VE / AG:
if (scriptName == "scripts\\ai\\AG\\L_AG_SHIP_PLAYER_DEATH_TRIGGER.lua")
@ -411,7 +406,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\02_server\\Map\\AG\\L__AG_MONUMENT_RACE_CANCEL.lua")
script = new AgMonumentRaceCancel();
else if (scriptName == "scripts\\02_server\\Map\\AG_Spider_Queen\\L_ZONE_AG_SPIDER_QUEEN.lua")
script = (ZoneAgProperty*)new ZoneAgSpiderQueen();
script = new ZoneAgSpiderQueen();
else if (scriptName == "scripts\\02_server\\Map\\AG_Spider_Queen\\L_SPIDER_BOSS_TREASURE_CHEST_SERVER.lua")
script = new SpiderBossTreasureChestServer();
else if (scriptName == "scripts\\02_server\\Map\\AG\\L_NPC_COWBOY_SERVER.lua")
@ -475,7 +470,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\02_server\\Enemy\\Waves\\L_WAVES_BOSS_HAMMERLING_ENEMY_SERVER.lua")
script = new WaveBossHammerling();
else if (scriptName == "scripts\\02_server\\Enemy\\Waves\\L_WAVES_BOSS_APE_ENEMY_SERVER.lua")
script = (BaseEnemyApe*) new WaveBossApe();
script = new WaveBossApe();
else if (scriptName == "scripts\\02_server\\Enemy\\Waves\\L_WAVES_BOSS_DARK_SPIDERLING_ENEMY_SERVER.lua")
script = new WaveBossSpiderling();
else if (scriptName == "scripts\\02_server\\Enemy\\Waves\\L_WAVES_BOSS_HORESEMEN_ENEMY_SERVER.lua")
@ -636,7 +631,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\02_server\\Map\\General\\L_PROP_PLATFORM.lua")
script = new PropertyPlatform();
else if (scriptName == "scripts\\02_server\\Map\\VE\\L_VE_BRICKSAMPLE_SERVER.lua")
return new VeBricksampleServer();
script = new VeBricksampleServer();
else if (scriptName == "scripts\\02_server\\Map\\General\\L_MAIL_BOX_SERVER.lua")
script = new MailBoxServer();
else if (scriptName == "scripts\\ai\\ACT\\L_ACT_MINE.lua")
@ -771,7 +766,7 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_COLE_NPC.lua")
script = new NjColeNPC();
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_JAY_MISSION_ITEMS.lua")
script = (NjNPCMissionSpinjitzuServer*) new NjJayMissionItems();
script = new NjJayMissionItems();
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_NPC_MISSION_SPINJITZU_SERVER.lua")
script = new NjNPCMissionSpinjitzuServer();
else if (scriptName == "scripts\\02_server\\Map\\njhub\\L_ENEMY_SKELETON_SPAWNER.lua")
@ -952,11 +947,3 @@ std::vector<CppScripts::Script*> CppScripts::GetEntityScripts(Entity* entity) {
}
return scripts;
}
CppScripts::Script::Script() {
}
CppScripts::Script::~Script() {
}

View File

@ -29,9 +29,6 @@ namespace CppScripts {
*/
class Script {
public:
Script();
~Script();
/**
* Invoked one frame after the script is loaded.
*

View File

@ -10,7 +10,7 @@ struct ItemSetting {
/**
* Scripts that allows for the addition and removal of sets of items by an NPC
*/
class NPCAddRemoveItem : public CppScripts::Script {
class NPCAddRemoveItem : virtual public CppScripts::Script {
protected:
void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override;
virtual std::map<uint32_t, std::vector<ItemSetting>> GetSettings();