sg.cpp File Reference

THE main program: ASC. More...

#include "global.h"
#include <stdio.h>
#include <stdlib.h>
#include <new>
#include <cstdlib>
#include <ctype.h>
#include <algorithm>
#include <memory>
#include <fstream>
#include <boost/regex.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
#include "paradialog.h"
#include "vehicletype.h"
#include "buildingtype.h"
#include "ai/ai.h"
#include "misc.h"
#include "events.h"
#include "typen.h"
#include "spfst.h"
#include "loaders.h"
#include "dlg_box.h"
#include "controls.h"
#include "dialog.h"
#include "strtmesg.h"
#include "gamedlg.h"
#include "sg.h"
#include "gameoptions.h"
#include "loadimage.h"
#include "astar2.h"
#include "errors.h"
#include "dialogs/pwd_dlg.h"
#include "viewcalculation.h"
#include "replay.h"
#include "graphicset.h"
#include "loadbi3.h"
#include "itemrepository.h"
#include "music.h"
#include "messagedlg.h"
#include "statisticdialog.h"
#include "clipboard.h"
#include "guifunctions.h"
#include "iconrepository.h"
#include "dashboard.h"
#include "gamedialog.h"
#include "unitset.h"
#include "applicationstarter.h"
#include "replaymapdisplay.h"
#include "asc-mainscreen.h"
#include "dialogs/unitinfodialog.h"
#include "util/messaginghub.h"
#include "cannedmessages.h"
#include "memorycheck.cpp"
#include "networkinterface.h"
#include "resourcenet.h"
#include "mapimageexport.h"
#include "loadpcx.h"
#include "gameeventsystem.h"
#include "sdl/sound.h"
#include "soundList.h"
#include "turncontrol.h"
#include "networksupervisor.h"
#include "dialogs/newgame.h"
#include "dialogs/soundsettings.h"
#include "dialogs/alliancesetup.h"
#include "dialogs/unitcounting.h"
#include "dialogs/editgameoptions.h"
#include "dialogs/nextcampaignmap.h"
#include "dialogs/terraininfo.h"
#include "dialogs/editplayerdata.h"
#include "dialogs/locatefile.h"
#include "dialogs/infodialogs.h"
#include "stdio-errorhandler.h"
#include "widgets/textrenderer.h"
#include "dialogs/productionanalysis.h"
#include "dialogs/fileselector.h"
#include "containerbase-functions.h"
#include "memory-measurement.h"
#include "dialogs/mailoptionseditor.h"
#include "dialogs/unitguidedialog.h"
#include "actions/cancelresearchcommand.h"
#include "actions/diplomacycommand.h"
#include "gameevent_dialogs.h"
#include "actions/commandwriter.h"
#include "dialogs/actionmanager.h"
#include "dialogs/gotoposition.h"
#include "loggingoutput.h"
#include "contextutils.h"
#include "actions/taskinterface.h"
#include "tasks/taskcontainer.h"
#include "dialogs/taskmanager.h"
#include "autotraining.h"
#include "spfst-legacy.h"
#include "lua/luarunner.h"
#include "lua/luastate.h"
#include "luacommandwriter.h"
#include "campaignactionrecorder.h"
#include "textfiletags.h"
#include "dataversioncheck.h"
#include "packagemanager.h"
#include "i18n.h"
#include "clparser/asc.cpp"

Include dependency graph for sg.cpp:

Go to the source code of this file.

Classes

class  CommandAllianceSetupStrategy
class  GameThreadParams
class  ResourceLogger
class  ScreenResolutionSetup

Defines

#define mmaintainence

Enumerations

enum  MapTypeLoaded { None, Map, Savegame, Mailfile }

Functions

MapFieldgetSelectedField (void)
bool maintainencecheck (void)
void positionCursor (Player &player)
void viewcomp (Player &player)
void runOpenTasks ()
void runPendingTasks (Player &player)
void hookGuiToMap (GameMap *map)
bool loadGameFromFile (const ASCString &filename)
bool loadGame (bool mostRecent)
void saveGame (bool as)
void loadmap (const ASCString &name, bool campaign)
MapTypeLoaded loadStartupMap (const char *gameToLoad=NULL)
void startnextcampaignmap (int id)
void benchgame (bool withViewCalc)
void changePassword (GameMap *gamemap)
void helpAbout ()
void undo ()
void redo ()
bool continueAndStartMultiplayerGame (bool mostRecent=false)
void writeLuaCommands ()
void selectAndRunLuaScript ()
void showUnitAiProperties ()
void showUsedPackages ()
void editAlliances ()
void chooseTechnologyIfAvail (Player &player)
 this performs some check if a technology may be choosen right now and than either calls chooseTechnology or displays some informational messages
void executeUserAction (tuseractions action)
bool mainloopidle (PG_MessageObject *msgObj)
void resetActions (GameMap &map)
void resetActmap (GameMap &map)
pfont load_font (const char *name)
void loadLegacyFonts ()
void checkGameEvents (GameMap *map, const Command &command)
int gamethread (void *data)
static void __runResearch (Player &player)
void deployMapPlayingHooks (GameMap *map)
int main (int argc, char *argv[])


Detailed Description

THE main program: ASC.

Definition in file sg.cpp.


Define Documentation

#define mmaintainence

Definition at line 204 of file sg.cpp.


Enumeration Type Documentation

enum MapTypeLoaded

Enumerator:
None 
Map 
Savegame 
Mailfile 

Definition at line 410 of file sg.cpp.


Function Documentation

static void __runResearch ( Player player  )  [static]

Definition at line 1518 of file sg.cpp.

References runResearch().

Referenced by deployMapPlayingHooks().

void benchgame ( bool  withViewCalc  ) 

Definition at line 526 of file sg.cpp.

References actmap, computeview(), infoMessage(), repaintMap, and ticker.

Referenced by executeUserAction().

void changePassword ( GameMap gamemap  ) 

Definition at line 551 of file sg.cpp.

References enterpassword(), Player::getHumanPlayerNum(), infoMessage(), and viewtextquery().

Referenced by executeUserAction().

void checkGameEvents ( GameMap map,
const Command command 
)

Definition at line 1359 of file sg.cpp.

References checkevents(), checktimedevents(), and getDefaultMapDisplay().

void chooseTechnologyIfAvail ( Player player  ) 

this performs some check if a technology may be choosen right now and than either calls chooseTechnology or displays some informational messages

Definition at line 737 of file sg.cpp.

References Research::activetechnology, checkForNewResearch(), infoMessage(), Technology::name, Research::progress, and Player::research.

Referenced by executeUserAction().

bool continueAndStartMultiplayerGame ( bool  mostRecent = false  ) 

Definition at line 608 of file sg.cpp.

References actmap, GameMap::actplayer, continueNetworkGame(), displaymap(), hookGuiToMap(), GameMap::player, and GameMap::sigPlayerUserInteractionBegins.

Referenced by executeUserAction().

void deployMapPlayingHooks ( GameMap map  ) 

Definition at line 1522 of file sg.cpp.

References __runResearch(), initReplayLogging(), GameMap::sigPlayerTurnBegins, and transfer_all_outstanding_tribute().

Referenced by main().

void editAlliances (  ) 

Definition at line 723 of file sg.cpp.

References actmap, computeview(), displaymap(), GameMap::getCurrentPlayer(), setupalliances(), Player::stat, and Player::supervisor.

Referenced by executeUserAction().

void executeUserAction ( tuseractions  action  ) 

Definition at line 755 of file sg.cpp.

Referenced by GameDialog::eventKeyDown(), ASC_MainScreenWidget::eventKeyDown(), Menu::execAction(), and GuiFunctions::UnitInfo::execute().

int gamethread ( void *  data  ) 

Definition at line 1365 of file sg.cpp.

References actmap, GameMap::actplayer, automaticTrainig(), GameMap::Campaign::avail, GameMap::campaign, choice_dlg(), GameMap::continueplaying, dataLoaderTicker, displayLogMessage(), errorMessage(), GameThreadParams::exitMainloop, fatalError(), GameThreadParams::filename, GameDialog::gameDialog(), getDefaultMapDisplay(), tfileerror::getFileName(), ASCmsgException::getMessage(), getPGApplication(), LoadNextMap::id, tvirtualscreenbuf::init(), loaddata(), loadLegacyFonts(), loadpalette(), loadStartupMap(), Mailfile, mainScreenWidget, next_turn(), None, GameMap::player, TaskContainer::registerHooks(), repaintDisplay, repaintMap, GameMap::replayinfo, resetActions(), resetActmap(), ASC_PG_App::Run(), setResearchPresenter(), GameMap::sigMapDeletion, GameMap::sigPlayerTurnEndsStatic, GameMap::sigPlayerUserInteractionBegins, startMusic(), startnextcampaignmap(), suppressMapTriggerExecution, updateFieldInfo, viewtext2(), virtualscreenbuf, GameMap::xsize, and GameMap::ysize.

Referenced by initializeEventHandling(), and main().

MapField* getSelectedField ( void   ) 

Definition at line 198 of file sg.cpp.

References actmap, GameMap::getCursor(), and GameMap::getField().

Referenced by executeUserAction(), and showUnitAiProperties().

void helpAbout (  ) 

Definition at line 569 of file sg.cpp.

References getVersionAndCompilation(), readtextmessage(), and ASC_PG_Dialog::RunModal().

Referenced by executeUserAction().

void hookGuiToMap ( GameMap map  ) 

Definition at line 285 of file sg.cpp.

Referenced by continueAndStartMultiplayerGame(), loadGameFromFile(), loadmap(), loadStartupMap(), StartMultiplayerGame::start(), and startnextcampaignmap().

pfont load_font ( const char *  name  ) 

Definition at line 1317 of file sg.cpp.

References loadfont(), and tnstream::reading.

bool loadGame ( bool  mostRecent  ) 

Definition at line 337 of file sg.cpp.

References actmap, tfindfile::FileInfo::date, displaymap(), MapDisplayInterface::displayPosition(), GameMap::getCurrentPlayer(), GameMap::getCursor(), getDefaultMapDisplay(), tfindfile::getnextname(), loadGameFromFile(), tfindfile::FileInfo::name, positionCursor(), s1, savegameextension, selectSavegame(), and updateFieldInfo.

Referenced by executeUserAction().

bool loadGameFromFile ( const ASCString filename  ) 

Definition at line 307 of file sg.cpp.

Referenced by loadGame(), loadGameLua(), and loadStartupMap().

void loadLegacyFonts (  ) 

Definition at line 1323 of file sg.cpp.

References activefontsettings, Schriften::arial8, Schriften::guicolfont, Schriften::guifont, Schriften::large, load_font(), tfontsettings::markfont, Schriften::monogui, schriften, shrinkfont(), Schriften::smallarial, and Schriften::smallsystem.

Referenced by gamethread().

void loadmap ( const ASCString name,
bool  campaign 
)

Definition at line 398 of file sg.cpp.

References actmap, GameMap::Campaign::avail, GameMap::campaign, computeview(), hookGuiToMap(), tmaploaders::loadmap(), and mapLoadingExceptionChecker().

Referenced by loadStartupMap(), and GameMap::ReplayInfo::read().

MapTypeLoaded loadStartupMap ( const char *  gameToLoad = NULL  ) 

Definition at line 412 of file sg.cpp.

References actmap, computeview(), continueNetworkGame(), displayLogMessage(), displaymessage(), tinvalidversion::expected, fatalError(), tinvalidversion::found, tfileerror::getFileName(), ASCmsgException::getMessage(), tfindfile::getnextname(), hookGuiToMap(), CGameOptions::Instance(), loadGameFromFile(), loadmap(), Mailfile, Map, mapextension, None, patimat(), Savegame, savegameextension, CGameOptions::startupMap, tournamentextension, validateemlfile(), validatemapfile(), and validatesavfile().

Referenced by gamethread().

int main ( int  argc,
char *  argv[] 
)

Definition at line 1644 of file sg.cpp.

References checkDataVersion(), cursorMoved, deployMapPlayingHooks(), displayLogMessage(), displaymessage(), exit_asc(), fatalError(), GameThreadParams::filename, gamethread(), tfileerror::getFileName(), ScreenResolutionSetup::getHeight(), GetVideoModes::getList(), getSearchPath(), getstartupmessage(), ScreenResolutionSetup::getWidth(), GetVideoModes::getx(), GetVideoModes::gety(), initFileIO(), initializeEventHandling(), ASC_PG_App::InitScreen(), CGameOptions::Instance(), ScreenResolutionSetup::isFullscreen(), mainloopidle(), tspfldloaders::mapLoaded, CGameOptions::SoundSettings::muteMusic, CGameOptions::SoundSettings::off, ASC_PG_App::setIcon(), setWindowCaption(), CGameOptions::sound, and updateFieldInfo.

bool mainloopidle ( PG_MessageObject *  msgObj  ) 

Definition at line 1284 of file sg.cpp.

References actmap, GameMap::actplayer, checkevents(), checkforvictory(), checktimedevents(), getDefaultMapDisplay(), GameMap::player, and Player::queuedEvents.

Referenced by main().

bool maintainencecheck ( void   ) 

Definition at line 206 of file sg.cpp.

References actmap, GameMap::campaign, Player::exist(), Player::human, GameMap::network, GameMap::player, and Player::stat.

Referenced by executeUserAction().

void positionCursor ( Player player  ) 

Definition at line 236 of file sg.cpp.

References MapDisplayInterface::displayPosition(), GameMap::getCursor(), getDefaultMapDisplay(), and Player::getParentMap().

Referenced by hookGuiToMap(), and loadGame().

void redo (  ) 

Definition at line 596 of file sg.cpp.

References actmap, createContext(), displaymap(), mapChanged, resetActiveGuiAction(), and updateFieldInfo.

Referenced by executeUserAction().

void resetActions ( GameMap map  ) 

Definition at line 1302 of file sg.cpp.

References NewGuiHost::pendingCommand.

Referenced by gamethread().

void resetActmap ( GameMap map  ) 

Definition at line 1310 of file sg.cpp.

References actmap.

Referenced by gamethread().

void runOpenTasks (  ) 

Definition at line 247 of file sg.cpp.

References actmap, createFollowerContext(), dispmessage2(), TaskInterface::operatable(), TaskContainer::pendingCommands, and GameMap::tasks.

Referenced by executeUserAction(), and runPendingTasks().

void runPendingTasks ( Player player  ) 

Definition at line 271 of file sg.cpp.

References choice_dlg(), Player::getParentMap(), TaskContainer::pendingCommands, runOpenTasks(), and GameMap::tasks.

Referenced by hookGuiToMap().

void saveGame ( bool  as  ) 

Definition at line 371 of file sg.cpp.

References actmap, GameMap::actplayer, GameMap::preferredFileNames, s1, GameMap::PreferredFilenames::savegame, savegame(), savegameextension, and selectSavegame().

Referenced by executeUserAction().

void selectAndRunLuaScript (  ) 

Definition at line 634 of file sg.cpp.

References errorMessage(), LuaRunner::getErrors(), LuaRunner::runFile(), selectFile(), and updateFieldInfo.

void showUnitAiProperties (  ) 

Definition at line 648 of file sg.cpp.

References AIjobs, Vehicle::aiparam, AItasks, fieldvisiblenow(), getSelectedField(), Vehicle::networkid, ASC_PG_Dialog::RunModal(), ASCString::toString(), and MapField::vehicle.

Referenced by executeUserAction().

void showUsedPackages (  ) 

Definition at line 680 of file sg.cpp.

References actmap, GameMap::packageData, PackageData::packages, ASC_PG_Dialog::RunModal(), and PackageManager::storeData().

Referenced by executeUserAction().

void startnextcampaignmap ( int  id  ) 

Definition at line 508 of file sg.cpp.

References actmap, computeview(), hookGuiToMap(), CGameOptions::Instance(), nextCampaignMap(), and repaintMap.

Referenced by gamethread().

void undo (  ) 

Definition at line 585 of file sg.cpp.

References actmap, createContext(), displaymap(), mapChanged, resetActiveGuiAction(), and updateFieldInfo.

Referenced by executeUserAction().

void viewcomp ( Player player  ) 

Definition at line 241 of file sg.cpp.

References computeview(), and Player::getParentMap().

Referenced by hookGuiToMap().

void writeLuaCommands (  ) 

Definition at line 625 of file sg.cpp.

References GameMap::actions, actmap, ActionContainer::getCommands(), and selectFile().

Referenced by executeUserAction().


Generated on Mon May 21 01:42:31 2012 for Advanced Strategic Command by  doxygen 1.5.1