edmisc.cpp File Reference

various functions for the mapeditor More...

#include <string>
#include <iostream>
#include <math.h>
#include "sdl/graphics.h"
#include "vehicletype.h"
#include "buildingtype.h"
#include "edmisc.h"
#include "loadbi3.h"
#include "edgen.h"
#include "edselfnt.h"
#include "edglobal.h"
#include "dialogs/pwd_dlg.h"
#include "mapdisplay.h"
#include "graphicset.h"
#include "itemrepository.h"
#include "textfileparser.h"
#include "textfile_evaluation.h"
#include "textfiletags.h"
#include "clipboard.h"
#include "dialogs/cargowidget.h"
#include "dialogs/fieldmarker.h"
#include "dialogs/newmap.h"
#include "stack.h"
#include "unitset.h"
#include "maped-mainscreen.h"
#include "gameevents.h"
#include "gameevent_dialogs.h"
#include "dialogs/fileselector.h"
#include "pgeventsupplier.h"
#include "dialogs/edittechadapter.h"
#include "spfst-legacy.h"
#include "lua/luarunner.h"
#include "lua/luastate.h"
#include "widgets/multilistbox.h"

Include dependency graph for edmisc.cpp:

Go to the source code of this file.

Classes

class  tplayerchange
class  ShowPolygonUsingTemps
class  PolygonEditor
class  BuildingValues
class  StringSelector
class  EditAiParam
class  UnitPropertyEditor
class  tres
class  tminestrength
class  SelectUnitSetFilter
class  UnitTypeTransformation
class  UnitTypeTransformation::UnitSetSelection
class  UnitTypeTransformation::TranslationTableSelection
class  EditArchivalInformation
class  ItemLocator
class  MirrorMap
class  CopyMap

Functions

void placeCurrentItem ()
bool removeCurrentItem ()
bool mousePressedOnField (const MapCoordinate &pos, const SPoint &mousePos, bool cursorChanged, int button, int prio)
bool mouseDraggedToField (const MapCoordinate &pos, const SPoint &mousePos, bool cursorChanged, int prio)
char checkobject (MapField *pf)
void lines (int x1, int y1, int x2, int y2)
void playerchange (void)
void exchg (int *a1, int *a2)
void k_savemap (char saveas)
void k_loadmap (void)
void selectUnitFromMap (GameMap *gamemap, MapCoordinate &pos)
void setstartvariables (void)
void editpolygon (Poly_gon &poly)
void newmap (void)
void changebuildingvalues (Building &b)
int selectString (int lc, const char *title, const char **text, int itemNum)
void changeunitvalues (Vehicle *ae)
void changeresource (void)
void changeminestrength (void)
VehicleselectUnitFromContainer (ContainerBase *container)
void movebuilding (void)
void selectunitsetfilter (void)
void unitsettransformation (void)
VehicleTypetransform (int id, const vector< int > &translation)
void transformMap ()
 replaces the terrain and the objects on a map according to a translation table
void editArchivalInformation ()
void resourceComparison ()
 displays a textmessage comparing the resources of all players
void readClipboard ()
void saveClipboard ()
void setweatherall (int weather)
ASCString printTech (int id)
void editResearch ()
void editResearchPoints ()
void generateTechTree ()
void editTechAdapter ()
MapFieldgetactfield (void)
void locateItemByID ()
void copyVehicleData (Vehicle *source, Vehicle *target, GameMap *targetMap, int *playerTranslation)
void copyBuildingData (Building *source, Building *target, GameMap *targetMap, int *playerTranslation, bool mirrorUnits)
void copyFieldStep1 (MapField *sourceField, MapField *targetField, bool mirrorTerrain, bool mirrorResources, bool mirrorWeather)
void copyFieldStep2 (MapField *sourceField, MapField *targetField, GameMap *targetMap, int *directionTranslation, int *playerTranslation, bool mirrorObjects, bool mirrorBuildings, bool mirrorUnits, bool mirrorMines)
void mirrorMap ()
void copyArea ()
void pasteArea ()
void selectAndRunLuaScript (const ASCString &filenamewildcard)
void testDebugFunction ()

Variables

bool mapsaved
MapSwitcher mapSwitcher
CopyMapcopyMap = NULL


Detailed Description

various functions for the mapeditor

Definition in file edmisc.cpp.


Function Documentation

void changebuildingvalues ( Building b  ) 

Definition at line 1198 of file edmisc.cpp.

References displaymap(), tdialogbox::done(), BuildingValues::init(), and BuildingValues::run().

Referenced by execaction().

void changeminestrength ( void   ) 

Definition at line 1956 of file edmisc.cpp.

References tdialogbox::done(), getactfield(), tminestrength::init(), and tminestrength::run().

Referenced by execaction().

void changeresource ( void   ) 

Definition at line 1881 of file edmisc.cpp.

References tdialogbox::done(), tres::init(), and tres::run().

Referenced by execaction().

void changeunitvalues ( Vehicle ae  ) 

Definition at line 1799 of file edmisc.cpp.

References ae, tdialogbox::done(), UnitPropertyEditor::init(), and UnitPropertyEditor::run().

Referenced by execaction().

char checkobject ( MapField pf  ) 

Definition at line 113 of file edmisc.cpp.

References MapField::objects.

void copyArea (  ) 

Definition at line 4670 of file edmisc.cpp.

References copyMap.

Referenced by execaction_pg().

void copyBuildingData ( Building source,
Building target,
GameMap targetMap,
int *  playerTranslation,
bool  mirrorUnits 
)

Definition at line 3843 of file edmisc.cpp.

References Building::actstorage, ContainerBase::addProductionLine(), ContainerBase::addToCargo(), Building::ammo, copyVehicleData(), ContainerBase::damage, ContainerBase::deleteAllProductionLines(), ContainerBase::getCargo(), ContainerBase::getProduction(), Building::lastmineddist, ContainerBase::name, Building::netcontrol, Building::visible, and waffenanzahl.

Referenced by copyFieldStep2().

void copyFieldStep1 ( MapField sourceField,
MapField targetField,
bool  mirrorTerrain,
bool  mirrorResources,
bool  mirrorWeather 
)

Definition at line 3877 of file edmisc.cpp.

References MapField::bdt, MapField::deleteeverything(), MapField::fuel, MapField::getWeather(), MapField::material, MapField::objects, MapField::removeObject(), MapField::setWeather(), and MapField::typ.

Referenced by CopyMap::fieldOperator(), MirrorMap::mirrorX(), MirrorMap::mirrorY(), and CopyMap::paste().

void copyFieldStep2 ( MapField sourceField,
MapField targetField,
GameMap targetMap,
int *  directionTranslation,
int *  playerTranslation,
bool  mirrorObjects,
bool  mirrorBuildings,
bool  mirrorUnits,
bool  mirrorMines 
)

Definition at line 3897 of file edmisc.cpp.

References MapField::addobject(), MapField::building, copyBuildingData(), copyVehicleData(), Vehicle::direction, Building::getEntryField(), MapField::getMine(), ContainerBase::getOwner(), MapField::getx(), MapField::gety(), MapField::mines, MapField::objects, MapField::putmine(), Vehicle::setnewposition(), Vehicle::typ, Building::typ, and MapField::vehicle.

Referenced by CopyMap::fieldOperator(), MirrorMap::mirrorX(), MirrorMap::mirrorY(), and CopyMap::paste().

void copyVehicleData ( Vehicle source,
Vehicle target,
GameMap targetMap,
int *  playerTranslation 
)

Definition at line 3808 of file edmisc.cpp.

References ContainerBase::addProductionLine(), ContainerBase::addToCargo(), Vehicle::ammo, ContainerBase::damage, ContainerBase::deleteAllProductionLines(), Vehicle::ReactionFire::disable(), Vehicle::ReactionFire::enable(), Vehicle::experience, ContainerBase::getCargo(), ContainerBase::getProduction(), Vehicle::ReactionFire::getStatus(), Vehicle::getTank(), Vehicle::height, ContainerBase::name, Vehicle::ReactionFire::off, Vehicle::reactionfire, and Vehicle::tank.

Referenced by copyBuildingData(), and copyFieldStep2().

void editArchivalInformation (  ) 

Definition at line 3370 of file edmisc.cpp.

References actmap, tdialogbox::done(), EditArchivalInformation::init(), and EditArchivalInformation::run().

Referenced by execaction().

void editpolygon ( Poly_gon poly  ) 

Definition at line 864 of file edmisc.cpp.

Referenced by CopyMap::selectArea(), and FieldAddressing::setup().

void editResearch (  ) 

Definition at line 3473 of file edmisc.cpp.

References actmap, chooseString(), Research::developedTechnologies, Player::getName(), infoMessage(), ItemFiltrationSystem::isFiltered(), GameMap::player, printTech(), Player::research, strrr(), ItemFiltrationSystem::Technology, and technologyRepository.

Referenced by execaction().

void editResearchPoints (  ) 

Definition at line 3541 of file edmisc.cpp.

References actmap, chooseString(), editInt(), Player::getName(), GameMap::player, Research::progress, Player::research, and strrr().

Referenced by execaction().

void editTechAdapter (  ) 

Definition at line 3664 of file edmisc.cpp.

References actmap, chooseString(), editTechAdapter(), Player::getName(), GameMap::player, and strrr().

void exchg ( int *  a1,
int *  a2 
)

Definition at line 497 of file edmisc.cpp.

void generateTechTree (  ) 

Definition at line 3563 of file edmisc.cpp.

References choice_dlg(), chooseString(), ItemFiltrationSystem::isFiltered(), Technology::name, printTech(), selectFile(), Technology::techDependency, ItemFiltrationSystem::Technology, technologyRepository, TechDependency::writeInvertTreeOutput(), tnstream::writeString(), and tnstream::writing.

Referenced by execaction().

MapField* getactfield ( void   ) 

Definition at line 3695 of file edmisc.cpp.

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

Referenced by changeminestrength(), execaction(), execaction_pg(), tminestrength::init(), tres::init(), movebuilding(), and CopyMap::paste().

void k_loadmap ( void   ) 

Definition at line 628 of file edmisc.cpp.

Referenced by execaction_pg().

void k_savemap ( char  saveas  ) 

Definition at line 606 of file edmisc.cpp.

Referenced by execaction_pg(), and mapeditorMainThread().

void lines ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 222 of file edmisc.cpp.

References darkgray, line(), and white.

void locateItemByID (  ) 

Definition at line 3793 of file edmisc.cpp.

References ASC_PG_Dialog::RunModal().

Referenced by execaction_pg().

void mirrorMap (  ) 

Definition at line 4170 of file edmisc.cpp.

References actmap, displaymap(), tdialogbox::done(), MirrorMap::init(), mapChanged, and MirrorMap::run().

Referenced by execaction_pg().

bool mouseDraggedToField ( const MapCoordinate pos,
const SPoint mousePos,
bool  cursorChanged,
int  prio 
)

Definition at line 102 of file edmisc.cpp.

References act_primaryAction, and execaction_ev().

Referenced by Maped_MainScreenWidget::Maped_MainScreenWidget().

bool mousePressedOnField ( const MapCoordinate pos,
const SPoint mousePos,
bool  cursorChanged,
int  button,
int  prio 
)

Definition at line 90 of file edmisc.cpp.

References act_primaryAction, and execaction_ev().

Referenced by Maped_MainScreenWidget::Maped_MainScreenWidget().

void movebuilding ( void   ) 

Definition at line 2585 of file edmisc.cpp.

References MapField::building, Building::chainbuildingtofield(), displaymap(), displaymessage(), getactfield(), Building::getEntry(), getfield(), mapsaved, selectfield(), Vehicle::setnewposition(), terrainaccessible(), Building::unchainbuildingfromfield(), MapField::vehicle, warningMessage(), MapCoordinate::x, Vehicle::xpos, MapCoordinate::y, and Vehicle::ypos.

Referenced by execaction().

void newmap ( void   ) 

Definition at line 884 of file edmisc.cpp.

References actmap, createNewMap(), and mapChanged.

Referenced by execaction_pg().

void pasteArea (  ) 

Definition at line 4680 of file edmisc.cpp.

References actmap, copyMap, displaymap(), and mapChanged.

Referenced by execaction_pg().

void placeCurrentItem (  ) 

Definition at line 69 of file edmisc.cpp.

References actmap, SelectionHolder::brushSize, circularFieldIterator(), GameMap::getCursor(), SelectionHolder::getSelection(), mapChanged, Placeable::place(), selection, Placeable::supportMultiFieldPlacement(), MapCoordinate::valid(), and Placeable::vPlace().

Referenced by execaction().

void playerchange ( void   ) 

Definition at line 484 of file edmisc.cpp.

References actmap, tdialogbox::done(), tplayerchange::init(), mapChanged, and tplayerchange::run().

Referenced by execaction().

ASCString printTech ( int  id  ) 

Definition at line 3462 of file edmisc.cpp.

References ASCString::format(), Technology::name, and technologyRepository.

Referenced by editResearch(), and generateTechTree().

void readClipboard (  ) 

Definition at line 3421 of file edmisc.cpp.

References clipboardFileExtension, errorMessage(), ASCmsgException::getMessage(), oldClipboardFileExtension, patimat(), tnstream::reading, TextFormatParser::run(), and selectFile().

Referenced by execaction().

bool removeCurrentItem (  ) 

Definition at line 81 of file edmisc.cpp.

References actmap, GameMap::getCursor(), SelectionHolder::getSelection(), Placeable::remove(), selection, and MapCoordinate::valid().

Referenced by execaction().

void resourceComparison (  ) 

displays a textmessage comparing the resources of all players

Definition at line 3378 of file edmisc.cpp.

References GameMap::_resourcemode, actmap, Player::buildingList, displaymessage(), Resources::fuel, MapField::fuel, GameMap::getField(), Resources::material, MapField::material, GameMap::player, Resources::resource(), resourceNames, resourceTypeNum, strrr(), GameMap::xsize, and GameMap::ysize.

Referenced by execaction().

void saveClipboard (  ) 

Definition at line 3444 of file edmisc.cpp.

References clipboardFileExtension, selectFile(), and tnstream::writing.

Referenced by execaction().

void selectAndRunLuaScript ( const ASCString filenamewildcard  ) 

Definition at line 4691 of file edmisc.cpp.

Referenced by execaction_pg(), and executeUserAction().

int selectString ( int  lc,
const char *  title,
const char **  text,
int  itemNum 
)

Definition at line 1411 of file edmisc.cpp.

References tstringselect::done(), tstringselect::init(), StringSelector::lastchoice, tstringselect::redline, and StringSelector::run().

Referenced by EditAiParam::buttonpressed().

Vehicle* selectUnitFromContainer ( ContainerBase container  ) 

Definition at line 2421 of file edmisc.cpp.

void selectUnitFromMap ( GameMap gamemap,
MapCoordinate pos 
)

Definition at line 663 of file edmisc.cpp.

References ASC_PG_Dialog::RunModal(), and SelectFromMap::Show().

void selectunitsetfilter ( void   ) 

Definition at line 2702 of file edmisc.cpp.

References displaymessage(), filtersChangedSignal, ItemFiltrationSystem::itemFilters, and ASC_PG_Dialog::RunModal().

Referenced by execaction().

void setstartvariables ( void   ) 

Definition at line 680 of file edmisc.cpp.

References activefontsettings, tfontsettings::color, tfontsettings::font, mapsaved, schriften, and Schriften::smallarial.

Referenced by mapeditorMainThread().

void setweatherall ( int  weather  ) 

Definition at line 3454 of file edmisc.cpp.

References actmap, GameMap::getField(), MapField::setWeather(), GameMap::xsize, and GameMap::ysize.

Referenced by execaction().

void testDebugFunction (  ) 

Definition at line 4714 of file edmisc.cpp.

References MapField::a, actmap, GameMap::cleartemps(), GameMap::getField(), repaintMap, visible_now, GameMap::xsize, and GameMap::ysize.

Referenced by execaction_pg().

VehicleType* transform ( int  id,
const vector< int > &  translation 
)

Definition at line 3010 of file edmisc.cpp.

References vehicleTypeRepository.

Referenced by MegaBlitter< BytesPerSourcePixel, BytesPerTargetPixel, SourceColorTransform, ColorMerger, SourcePixelSelector, TargetPixelSelector, MyColorConverter >::blit(), and transformMap().

void transformMap (  ) 

replaces the terrain and the objects on a map according to a translation table

Definition at line 3018 of file edmisc.cpp.

References actmap, PropertyContainer::addIntegerArray(), PropertyContainer::addStringArray(), Player::buildingList, buildingTypeRepository, calculateallobjects(), cbbuildingentry, Building::chainbuildingtofield(), displaymap(), displaymessage(), PropertyContainer::find(), Building::getEntry(), GameMap::getField(), ASCmsgException::getMessage(), getNeighbouringFieldCoordinate(), GameMap::getPlayer(), GameMap::getPlayerCount(), getTerrainBitType(), objectTypeRepository, Research::predefinedTechAdapter, tnstream::reading, Player::research, TextFormatParser::run(), selectFile(), terrainTypeRepository, transform(), Research::triggeredTechAdapter, Building::typ, Building::unchainbuildingfromfield(), Player::vehicleList, TerrainType::weather, GameMap::xsize, and GameMap::ysize.

Referenced by execaction_pg().

void unitsettransformation ( void   ) 

Definition at line 2932 of file edmisc.cpp.

References UnitTypeTransformation::run().

Referenced by execaction().


Variable Documentation

CopyMap* copyMap = NULL

Definition at line 4668 of file edmisc.cpp.

Referenced by copyArea(), and pasteArea().

bool mapsaved

Definition at line 65 of file edmisc.cpp.

Referenced by EditArchivalInformation::buttonpressed(), tminestrength::buttonpressed(), tres::buttonpressed(), UnitPropertyEditor::buttonpressed(), execaction(), execaction_pg(), k_loadmap(), k_savemap(), mapeditorMainThread(), movebuilding(), tmapgenerator::setmap(), setSaveNotification(), setstartvariables(), and MapSwitcher::toggle().

MapSwitcher mapSwitcher

Definition at line 3007 of file edmisc.cpp.

Referenced by execaction(), execaction_pg(), main(), and mapeditorMainThread().


Generated on Mon May 21 01:34:09 2012 for Advanced Strategic Command by  doxygen 1.5.1