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