(svn r23622) -Add: a set of events to trigger in a GameScript

This commit is contained in:
truebrain
2011-12-19 20:59:36 +00:00
parent e7cd301d3c
commit 77b7366c29
15 changed files with 310 additions and 13 deletions

View File

@@ -39,6 +39,7 @@
#include "subsidy_func.h"
#include "core/backup_type.hpp"
#include "object_base.h"
#include "game/game.hpp"
#include "table/strings.h"
#include "table/industry_land.h"
@@ -482,6 +483,7 @@ static CommandCost ClearTile_Industry(TileIndex tile, DoCommandFlag flags)
if (flags & DC_EXEC) {
AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index));
Game::NewEvent(new ScriptEventIndustryClose(i->index));
delete i;
}
return CommandCost(EXPENSES_CONSTRUCTION, indspec->GetRemovalCost());
@@ -1876,6 +1878,7 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
}
AddIndustryNewsItem(indspec->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new ScriptEventIndustryOpen(ind->index));
Game::NewEvent(new ScriptEventIndustryOpen(ind->index));
}
return CommandCost(EXPENSES_OTHER, indspec->GetConstructionCost());
@@ -1989,6 +1992,7 @@ static void AdvertiseIndustryOpening(const Industry *ind)
}
AddIndustryNewsItem(ind_spc->new_industry_text, NS_INDUSTRY_OPEN, ind->index);
AI::BroadcastNewEvent(new ScriptEventIndustryOpen(ind->index));
Game::NewEvent(new ScriptEventIndustryOpen(ind->index));
}
/**
@@ -2597,6 +2601,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
if (closeit) {
ns = NS_INDUSTRY_CLOSE;
AI::BroadcastNewEvent(new ScriptEventIndustryClose(i->index));
Game::NewEvent(new ScriptEventIndustryClose(i->index));
} else {
switch (WhoCanServiceIndustry(i)) {
case 0: ns = NS_INDUSTRY_NOBODY; break;