[Gcblue-commits] gcb_wx/src/scriptinterface tcScenarioLogger.cpp,NONE,1.1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-12-10 21:54:52
|
Update of /cvsroot/gcblue/gcb_wx/src/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26763/src/scriptinterface Added Files: tcScenarioLogger.cpp Log Message: --- NEW FILE: tcScenarioLogger.cpp --- /** ** @file tcScenarioLogger.cpp */ /* Copyright (C) 2005 Dewitt Colclough (de...@gc...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdwx.h" // precompiled header file #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include "tcScenarioLogger.h" #ifdef _DEBUG #define new DEBUG_NEW #endif namespace scriptinterface { void tcScenarioLogger::AddScenarioText(const std::string& s) { scenarioText << " "; scenarioText << s; scenarioText << "\n"; } void tcScenarioLogger::CreateHeaderText() { headerText.clear(); headerText << "from math import *\n"; headerText << "from random import *\n"; headerText << "from UnitCommands import *\n\n"; } void tcScenarioLogger::InitScenarioText() { scenarioText.clear(); scenarioText << "def CreateScenario(SM):\n\n"; scenarioText << " SM.SetScenarioDescription('Scenario description goes here')\n"; scenarioText << " SM.SetScenarioName('Scenario name goes here')\n"; scenarioText << " SM.SetUserAlliance(1)\n"; } void tcScenarioLogger::WriteAll() { scenario.WriteString(headerText.str().c_str()); scenario.WriteString(scenarioText.str().c_str()); } tcScenarioLogger::tcScenarioLogger(const std::string& fileName) : scenario(fileName + ".py") { CreateHeaderText(); InitScenarioText(); } tcScenarioLogger::~tcScenarioLogger() { } } |