- updated to add isGameOver
This commit is contained in:
parent
c02c90427b
commit
fa31fed5bd
|
@ -3345,7 +3345,7 @@ void Game::checkWinnerStandard() {
|
|||
}
|
||||
|
||||
void Game::checkWinnerScripted() {
|
||||
if(scriptManager.getGameOver()) {
|
||||
if(scriptManager.getIsGameOver()) {
|
||||
gameOver= true;
|
||||
for(int i= 0; i<world.getFactionCount(); ++i) {
|
||||
if(scriptManager.getPlayerModifiers(i)->getWinner()) {
|
||||
|
|
|
@ -315,6 +315,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
|
|||
luaScript.registerFunction(getUnitCount, "unitCount");
|
||||
luaScript.registerFunction(getUnitCountOfType, "unitCountOfType");
|
||||
|
||||
luaScript.registerFunction(getIsGameOver, "isGameOver");
|
||||
luaScript.registerFunction(getGameWon, "gameWon");
|
||||
|
||||
luaScript.registerFunction(getSystemMacroValue, "getSystemMacroValue");
|
||||
|
@ -1207,11 +1208,16 @@ int ScriptManager::getWorldFrameCount() {
|
|||
return world->getFrameCount();
|
||||
}
|
||||
|
||||
bool ScriptManager::getGameWon() {
|
||||
bool ScriptManager::getGameWon() const {
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return gameWon;
|
||||
}
|
||||
|
||||
bool ScriptManager::getIsGameOver() const {
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
return gameOver;
|
||||
}
|
||||
|
||||
int ScriptManager::getLastCreatedUnitId() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
|
@ -2076,6 +2082,12 @@ int ScriptManager::getGameWon(LuaHandle* luaHandle){
|
|||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::getIsGameOver(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
luaArguments.returnInt(thisScriptManager->getIsGameOver());
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::loadScenario(LuaHandle* luaHandle) {
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
thisScriptManager->loadScenario(luaArguments.getString(-2),luaArguments.getInt(-1));
|
||||
|
|
|
@ -202,8 +202,6 @@ public:
|
|||
bool getMessageBoxEnabled() const {return !messageQueue.empty();}
|
||||
GraphicMessageBox* getMessageBox() {return &messageBox;}
|
||||
string getDisplayText() const {return displayText;}
|
||||
bool getGameOver() const {return gameOver;}
|
||||
bool getGameWon() const {return gameWon;}
|
||||
const PlayerModifiers *getPlayerModifiers(int factionIndex) const {return &playerModifiers[factionIndex];}
|
||||
|
||||
//events
|
||||
|
@ -217,6 +215,9 @@ public:
|
|||
void onCellTriggerEvent(Unit *movingUnit);
|
||||
void onTimerTriggerEvent();
|
||||
|
||||
bool getGameWon() const;
|
||||
bool getIsGameOver() const;
|
||||
|
||||
void saveGame(XmlNode *rootNode);
|
||||
void loadGame(const XmlNode *rootNode);
|
||||
|
||||
|
@ -311,8 +312,6 @@ private:
|
|||
int getUnitCount(int factionIndex);
|
||||
int getUnitCountOfType(int factionIndex, const string &typeName);
|
||||
|
||||
bool getGameWon();
|
||||
|
||||
const string getSystemMacroValue(const string &key);
|
||||
const string getPlayerName(int factionIndex);
|
||||
|
||||
|
@ -412,6 +411,7 @@ private:
|
|||
static int getUnitCountOfType(LuaHandle* luaHandle);
|
||||
|
||||
static int getGameWon(LuaHandle* luaHandle);
|
||||
static int getIsGameOver(LuaHandle* luaHandle);
|
||||
|
||||
static int getSystemMacroValue(LuaHandle* luaHandle);
|
||||
static int getPlayerName(LuaHandle* luaHandle);
|
||||
|
|
Loading…
Reference in New Issue