Changed fow setting to use a property instead of lua method

This commit is contained in:
Mark Vejvoda 2010-04-23 14:08:19 +00:00
parent 2e702d8dd8
commit afcdc1209c
4 changed files with 11 additions and 15 deletions

View File

@ -71,8 +71,6 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
luaScript.registerFunction(getLastDeadUnitId, "lastDeadUnit");
luaScript.registerFunction(getUnitCount, "unitCount");
luaScript.registerFunction(getUnitCountOfType, "unitCountOfType");
luaScript.registerFunction(unfogMap, "unfogMap");
//load code
for(int i= 0; i<scenario->getScriptCount(); ++i){
@ -397,14 +395,4 @@ int ScriptManager::getUnitCountOfType(LuaHandle* luaHandle){
return luaArguments.getReturnCount();
}
void ScriptManager::unfogMap() {
world->setFogOfWar(false);
}
int ScriptManager::unfogMap(LuaHandle* luaHandle){
LuaArguments luaArguments(luaHandle);
thisScriptManager->unfogMap();
return luaArguments.getReturnCount();
}
}}//end namespace

View File

@ -136,7 +136,6 @@ private:
void disableAi(int factionIndex);
void setPlayerAsWinner(int factionIndex);
void endGame();
void unfogMap();
//wrappers, queries
Vec2i getStartLocation(int factionIndex);
@ -163,7 +162,6 @@ private:
static int disableAi(LuaHandle* luaHandle);
static int setPlayerAsWinner(LuaHandle* luaHandle);
static int endGame(LuaHandle* luaHandle);
static int unfogMap(LuaHandle* luaHandle);
//callbacks, queries
static int getStartLocation(LuaHandle* luaHandle);

View File

@ -46,6 +46,8 @@ struct ScenarioInfo
bool defaultVictoryConditions;
string desc;
bool fogOfWar;
};
class MenuState;

View File

@ -1,7 +1,7 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2005 Martiño Figueroa
// Copyright (C) 2001-2005 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
@ -198,6 +198,13 @@ void MenuStateScenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo
scenarioInfo->desc+= lang.get("Map") + ": " + formatString(scenarioInfo->mapName) + "\n";
scenarioInfo->desc+= lang.get("Tileset") + ": " + formatString(scenarioInfo->tilesetName) + "\n";
scenarioInfo->desc+= lang.get("TechTree") + ": " + formatString(scenarioInfo->techTreeName) + "\n";
if(scenarioNode->hasChild("fog-of-war") == true) {
scenarioInfo->fogOfWar = scenarioNode->getChild("fog-of-war")->getAttribute("value")->getBoolValue();
}
else {
scenarioInfo->fogOfWar = true;
}
}
void MenuStateScenario::loadGameSettings(const ScenarioInfo *scenarioInfo, GameSettings *gameSettings){
@ -229,6 +236,7 @@ void MenuStateScenario::loadGameSettings(const ScenarioInfo *scenarioInfo, GameS
}
gameSettings->setFactionCount(factionCount);
gameSettings->setFogOfWar(scenarioInfo->fogOfWar);
}
ControlType MenuStateScenario::strToControllerType(const string &str){