- added a new lua method to add text on the console for Elimnator's scenario.
This commit is contained in:
parent
bca617cf18
commit
97017b2f1f
|
@ -78,6 +78,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera){
|
|||
//register functions
|
||||
luaScript.registerFunction(showMessage, "showMessage");
|
||||
luaScript.registerFunction(setDisplayText, "setDisplayText");
|
||||
luaScript.registerFunction(addConsoleText, "addConsoleText");
|
||||
luaScript.registerFunction(DisplayFormattedText, "DisplayFormattedText");
|
||||
luaScript.registerFunction(clearDisplayText, "clearDisplayText");
|
||||
luaScript.registerFunction(setCameraPosition, "setCameraPosition");
|
||||
|
@ -390,6 +391,11 @@ void ScriptManager::setDisplayText(const string &text){
|
|||
displayText= wrapString(Lang::getInstance().getScenarioString(text), displayTextWrapCount);
|
||||
}
|
||||
|
||||
void ScriptManager::addConsoleText(const string &text){
|
||||
ScriptManager_STREFLOP_Wrapper streflopWrapper;
|
||||
world->addConsoleText(text);
|
||||
}
|
||||
|
||||
void ScriptManager::DisplayFormattedText(const char *fmt, ...) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
|
@ -837,6 +843,12 @@ int ScriptManager::setDisplayText(LuaHandle* luaHandle){
|
|||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::addConsoleText(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
thisScriptManager->addConsoleText(luaArguments.getString(-1));
|
||||
return luaArguments.getReturnCount();
|
||||
}
|
||||
|
||||
int ScriptManager::clearDisplayText(LuaHandle* luaHandle){
|
||||
LuaArguments luaArguments(luaHandle);
|
||||
thisScriptManager->clearDisplayText();
|
||||
|
|
|
@ -173,6 +173,7 @@ private:
|
|||
void showMessage(const string &text, const string &header);
|
||||
void clearDisplayText();
|
||||
void setDisplayText(const string &text);
|
||||
void addConsoleText(const string &text);
|
||||
void DisplayFormattedText(const char *fmt,...);
|
||||
void setCameraPosition(const Vec2i &pos);
|
||||
void createUnit(const string &unitName, int factionIndex, Vec2i pos);
|
||||
|
@ -238,6 +239,7 @@ private:
|
|||
//callbacks, commands
|
||||
static int showMessage(LuaHandle* luaHandle);
|
||||
static int setDisplayText(LuaHandle* luaHandle);
|
||||
static int addConsoleText(LuaHandle* luaHandle);
|
||||
static int DisplayFormattedText(LuaHandle* luaHandle);
|
||||
static int clearDisplayText(LuaHandle* luaHandle);
|
||||
static int setCameraPosition(LuaHandle* luaHandle);
|
||||
|
|
|
@ -984,6 +984,10 @@ void World::togglePauseGame(bool pauseStatus) {
|
|||
game->setPaused(pauseStatus);
|
||||
}
|
||||
|
||||
void World::addConsoleText(const string &text) {
|
||||
game->getConsole()->addLine(text);
|
||||
}
|
||||
|
||||
void World::giveUpgradeCommand(int unitId, const string &upgradeName) {
|
||||
Unit *unit= findUnitById(unitId);
|
||||
if(unit != NULL) {
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
void stopAllSound();
|
||||
void moveToUnit(int unitId, int destUnitId);
|
||||
void togglePauseGame(bool pauseStatus);
|
||||
void addConsoleText(const string &text);
|
||||
|
||||
void giveResource(const string &resourceName, int factionIndex, int amount);
|
||||
int getResourceAmount(const string &resourceName, int factionIndex);
|
||||
|
|
Loading…
Reference in New Issue