mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 19:04:00 +02:00
Ported 3.3.4.2 fixes to trunk
This commit is contained in:
@@ -71,6 +71,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
|||||||
luaScript.registerFunction(getLastDeadUnitId, "lastDeadUnit");
|
luaScript.registerFunction(getLastDeadUnitId, "lastDeadUnit");
|
||||||
luaScript.registerFunction(getUnitCount, "unitCount");
|
luaScript.registerFunction(getUnitCount, "unitCount");
|
||||||
luaScript.registerFunction(getUnitCountOfType, "unitCountOfType");
|
luaScript.registerFunction(getUnitCountOfType, "unitCountOfType");
|
||||||
|
luaScript.registerFunction(unfogMap, "unfogMap");
|
||||||
|
|
||||||
|
|
||||||
//load code
|
//load code
|
||||||
@@ -396,4 +397,14 @@ int ScriptManager::getUnitCountOfType(LuaHandle* luaHandle){
|
|||||||
return luaArguments.getReturnCount();
|
return luaArguments.getReturnCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptManager::unfogMap() {
|
||||||
|
world->setFogOfWar(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ScriptManager::unfogMap(LuaHandle* luaHandle){
|
||||||
|
LuaArguments luaArguments(luaHandle);
|
||||||
|
thisScriptManager->unfogMap();
|
||||||
|
return luaArguments.getReturnCount();
|
||||||
|
}
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "vec.h"
|
|
||||||
|
|
||||||
#include "components.h"
|
#include "components.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
@@ -122,7 +121,6 @@ public:
|
|||||||
void onUnitDied(const Unit* unit);
|
void onUnitDied(const Unit* unit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string wrapString(const string &str, int wrapCount);
|
string wrapString(const string &str, int wrapCount);
|
||||||
|
|
||||||
//wrappers, commands
|
//wrappers, commands
|
||||||
@@ -138,6 +136,7 @@ private:
|
|||||||
void disableAi(int factionIndex);
|
void disableAi(int factionIndex);
|
||||||
void setPlayerAsWinner(int factionIndex);
|
void setPlayerAsWinner(int factionIndex);
|
||||||
void endGame();
|
void endGame();
|
||||||
|
void unfogMap();
|
||||||
|
|
||||||
//wrappers, queries
|
//wrappers, queries
|
||||||
Vec2i getStartLocation(int factionIndex);
|
Vec2i getStartLocation(int factionIndex);
|
||||||
@@ -164,6 +163,7 @@ private:
|
|||||||
static int disableAi(LuaHandle* luaHandle);
|
static int disableAi(LuaHandle* luaHandle);
|
||||||
static int setPlayerAsWinner(LuaHandle* luaHandle);
|
static int setPlayerAsWinner(LuaHandle* luaHandle);
|
||||||
static int endGame(LuaHandle* luaHandle);
|
static int endGame(LuaHandle* luaHandle);
|
||||||
|
static int unfogMap(LuaHandle* luaHandle);
|
||||||
|
|
||||||
//callbacks, queries
|
//callbacks, queries
|
||||||
static int getStartLocation(LuaHandle* luaHandle);
|
static int getStartLocation(LuaHandle* luaHandle);
|
||||||
|
@@ -39,6 +39,8 @@ const float World::airHeight= 5.f;
|
|||||||
World::World(){
|
World::World(){
|
||||||
Config &config= Config::getInstance();
|
Config &config= Config::getInstance();
|
||||||
|
|
||||||
|
fogOfWarOverride = false;
|
||||||
|
|
||||||
fogOfWarSmoothing= config.getBool("FogOfWarSmoothing");
|
fogOfWarSmoothing= config.getBool("FogOfWarSmoothing");
|
||||||
fogOfWarSmoothingFrameSkip= config.getInt("FogOfWarSmoothingFrameSkip");
|
fogOfWarSmoothingFrameSkip= config.getInt("FogOfWarSmoothingFrameSkip");
|
||||||
|
|
||||||
@@ -57,11 +59,23 @@ void World::end(){
|
|||||||
for(int i= 0; i<factions.size(); ++i){
|
for(int i= 0; i<factions.size(); ++i){
|
||||||
factions[i].end();
|
factions[i].end();
|
||||||
}
|
}
|
||||||
|
fogOfWarOverride = false;
|
||||||
//stats will be deleted by BattleEnd
|
//stats will be deleted by BattleEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================== init ===============================================
|
// ========================== init ===============================================
|
||||||
|
|
||||||
|
void World::setFogOfWar(bool value) {
|
||||||
|
fogOfWar = value;
|
||||||
|
fogOfWarOverride = true;
|
||||||
|
|
||||||
|
if(game != NULL && game->getGameSettings() != NULL) {
|
||||||
|
game->getGameSettings()->setFogOfWar(fogOfWar);
|
||||||
|
initCells(fogOfWar); //must be done after knowing faction number and dimensions
|
||||||
|
initMinimap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void World::init(Game *game, bool createUnits){
|
void World::init(Game *game, bool createUnits){
|
||||||
|
|
||||||
this->game = game;
|
this->game = game;
|
||||||
@@ -70,7 +84,9 @@ void World::init(Game *game, bool createUnits){
|
|||||||
unitUpdater.init(game);
|
unitUpdater.init(game);
|
||||||
|
|
||||||
GameSettings *gs = game->getGameSettings();
|
GameSettings *gs = game->getGameSettings();
|
||||||
fogOfWar = gs->getFogOfWar();
|
if(fogOfWarOverride == false) {
|
||||||
|
fogOfWar = gs->getFogOfWar();
|
||||||
|
}
|
||||||
|
|
||||||
initFactionTypes(gs);
|
initFactionTypes(gs);
|
||||||
initCells(fogOfWar); //must be done after knowing faction number and dimensions
|
initCells(fogOfWar); //must be done after knowing faction number and dimensions
|
||||||
|
@@ -84,6 +84,7 @@ private:
|
|||||||
int nextUnitId;
|
int nextUnitId;
|
||||||
|
|
||||||
//config
|
//config
|
||||||
|
bool fogOfWarOverride;
|
||||||
bool fogOfWar;
|
bool fogOfWar;
|
||||||
int fogOfWarSmoothingFrameSkip;
|
int fogOfWarSmoothingFrameSkip;
|
||||||
bool fogOfWarSmoothing;
|
bool fogOfWarSmoothing;
|
||||||
@@ -149,6 +150,8 @@ public:
|
|||||||
|
|
||||||
Game * getGame() { return game; }
|
Game * getGame() { return game; }
|
||||||
|
|
||||||
|
void setFogOfWar(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void initCells(bool fogOfWar);
|
void initCells(bool fogOfWar);
|
||||||
|
@@ -407,6 +407,8 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
|||||||
default:
|
default:
|
||||||
//throw std::runtime_error("Mouse Button > 3 not handled.");
|
//throw std::runtime_error("Mouse Button > 3 not handled.");
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",__FILE__,__FUNCTION__,__LINE__,sdlButton);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",__FILE__,__FUNCTION__,__LINE__,sdlButton);
|
||||||
|
|
||||||
|
return mbUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user