Advanced Strategic Command
edmisc.h
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 #ifndef edmiscH
22 #define edmiscH
23 
24 #include <string.h>
25 #include <stdlib.h>
26 #include <cstdlib>
27 #include <ctype.h>
28 
29 #include "pgpopupmenu.h"
30 
31 #include "typen.h"
32 #include "basegfx.h"
33 #include "mappolygons.h"
34 #include "misc.h"
35 #include "newfont.h"
36 #include "events.h"
37 #include "loaders.h"
38 #include "dlg_box.h"
39 #include "spfst.h"
40 #include "dialog.h"
41 #include "strtmesg.h"
42 #include "palette.h"
43 #include "mapalgorithms.h"
44 
45 
46 extern bool mousePressedOnField( const MapCoordinate& pos, const SPoint& mousePos, bool cursorChanged, int button, int prio );
47 extern bool mouseDraggedToField( const MapCoordinate& pos, const SPoint& mousePos, bool cursorChanged, int prio );
48 
49  class tputresources : public SearchFields {
50  int resourcetype;
51  int maxresource;
52  int minresource;
53  int maxdst;
54  MapCoordinate centerPos;
55  public:
56  void init ( int sx , int sy, int dst, int restype, int resmax, int resmin );
57  virtual void testfield ( const MapCoordinate& mc );
58  tputresources ( GameMap* _gamemap ) : SearchFields ( _gamemap ) {};
59  };
60 
61  class tputresourcesdlg : public tdialogbox {
62  int resourcetype;
63  int restp2;
64  int maxresource;
65  int minresource;
66  int dist;
67  int status;
68  public:
69  void init ( void );
70  void run ( void );
71  void buttonpressed ( int id );
72  };
73 
74 
75 
76  extern bool mapsaved;
77 
78 extern void setstartvariables(void);
79 extern void exchg(int *a1,int *a2);
80 extern void k_savemap(bool saveas);
81 extern void k_loadmap(void);
82 extern void lines(int x1,int y,int x2,int y2);
83 
84 extern void changeresource(void);
85 extern void changebuildingvalues( Building& b);
86 extern void changeminestrength(void);
87 extern void newmap(void);
88 extern void cargoEditor ( ContainerBase* container );
89 // extern int selectfield(int * cx ,int * cy);
90 extern void playerchange(void);
91 
92 //extern void setpolytemps (int value, ppolygon poly1); //* setzt in diesem Polygon den Tempvalue auf value
93 extern void editpolygon (Poly_gon& poly);
94 // extern int getpolygon(ppolygon *poly); //return Fehlerstatus
95 
96 extern MapField* getactfield();
97 
98 
99 extern void selectunitsetfilter ( void );
100 extern void movebuilding();
101 extern void unitsettransformation( void );
102 
104 class MapSwitcher {
105  int active;
106  class Mappntr {
107  public:
108  GameMap* map;
109  bool changed;
110  MapCoordinate cursorpos;
111  MapCoordinate windowpos;
112  Mappntr ( ) : map ( NULL ), changed ( false ) {};
113  } maps[2];
114  public:
115  enum Action { select, set };
116 
118  void toggle ();
119  string getName ();
120  void deleteMaps();
121  MapSwitcher ( ) : active ( 0 ) {};
122 };
123 
124 extern MapSwitcher mapSwitcher;
125 
127 extern void transformMap();
128 
129 extern void editArchivalInformation();
130 
132 extern void resourceComparison ( );
133 
135 extern void unitProductionLimitation();
136 
137 
138 extern void saveClipboard();
139 extern void readClipboard();
140 extern void setweatherall ( int weather );
141 extern void editResearch();
142 extern void editResearchPoints();
143 extern void generateTechTree();
144 extern void editTechAdapter();
145 
146 extern void placeCurrentItem();
147 extern bool removeCurrentItem();
148 
149 extern void locateItemByID();
150 extern void mirrorMap();
151 extern void copyArea();
152 extern void pasteArea();
153 extern void testDebugFunction();
154 
155 extern void selectAndRunLuaScript( const ASCString& filenamewildcard );
156 
157 #endif
void readClipboard()
Definition: edmisc.cpp:2485
string getName()
Definition: edmisc.cpp:2046
void movebuilding()
Definition: edmisc.cpp:1649
virtual void testfield(const MapCoordinate &mc)
Definition: edmisc.cpp:134
map accessing and usage routines used by ASC and the mapeditor
miscellaneous functions which are used by ASC and all its tools
void setstartvariables(void)
Definition: edmisc.cpp:681
Action getDefaultAction()
Definition: edmisc.cpp:2062
void setweatherall(int weather)
Definition: edmisc.cpp:2518
void changeresource(void)
Definition: edmisc.cpp:1561
void init(void)
Definition: edmisc.cpp:146
MapSwitcher mapSwitcher
Definition: edmisc.cpp:2071
void buttonpressed(int id)
Definition: edmisc.cpp:183
void unitsettransformation(void)
Definition: edmisc.cpp:1996
bool mouseDraggedToField(const MapCoordinate &pos, const SPoint &mousePos, bool cursorChanged, int prio)
Definition: edmisc.cpp:103
void changeminestrength(void)
Definition: edmisc.cpp:1636
void editTechAdapter()
Definition: edmisc.cpp:2728
void k_loadmap(void)
Definition: edmisc.cpp:629
void k_savemap(bool saveas)
Definition: edmisc.cpp:607
void editResearchPoints()
Definition: edmisc.cpp:2605
operating with polygons on tje map
Interface for some basic classes from which all of ASC's dialogs are derived.
The class that manages the switching between the primary map (for editing) and the secondary map (for...
Definition: edmisc.h:104
a single field of the map
Definition: mapfield.h:26
void selectAndRunLuaScript(const ASCString &filenamewildcard)
Definition: edmisc.cpp:3756
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
void mirrorMap()
Definition: edmisc.cpp:3235
void lines(int x1, int y, int x2, int y2)
Definition: edmisc.cpp:223
void exchg(int *a1, int *a2)
Definition: edmisc.cpp:498
void playerchange(void)
Definition: edmisc.cpp:485
void locateItemByID()
Definition: edmisc.cpp:2857
Coordinate on the twodimensional map.
Definition: typen.h:202
void cargoEditor(ContainerBase *container)
searches fields in hexagonal "circles" around a field and calls testfield for each field ...
Definition: mapalgorithms.h:28
void editpolygon(Poly_gon &poly)
Definition: edmisc.cpp:807
void resourceComparison()
displays a textmessage comparing the resources of all players
Definition: edmisc.cpp:2442
void deleteMaps()
Definition: edmisc.cpp:2003
void newmap(void)
Definition: edmisc.cpp:827
tputresources(GameMap *_gamemap)
Definition: edmisc.h:58
SDLmm::SPoint SPoint
Definition: surface.h:27
void selectunitsetfilter(void)
Definition: edmisc.cpp:1766
void toggle()
Definition: edmisc.cpp:2012
void pasteArea()
Definition: edmisc.cpp:3745
basegfx.h is the interface for the legacy graphic routines (of which some are platform dependent)...
Interface for all the dialog boxes used by the game and the mapeditor.
void transformMap()
replaces the terrain and the objects on a map according to a translation table
Definition: edmisc.cpp:2082
bool mapsaved
Definition: edmisc.cpp:66
bool removeCurrentItem()
Definition: edmisc.cpp:82
MapSwitcher()
Definition: edmisc.h:121
void run(void)
Definition: edmisc.cpp:206
procedure for loading and writing savegames, maps etc.
void changebuildingvalues(Building &b)
Definition: edmisc.cpp:1141
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
void placeCurrentItem()
Definition: edmisc.cpp:70
The color palette and various color translation tables.
bool mousePressedOnField(const MapCoordinate &pos, const SPoint &mousePos, bool cursorChanged, int button, int prio)
Definition: edmisc.cpp:91
void editResearch()
Definition: edmisc.cpp:2537
void init(int sx, int sy, int dst, int restype, int resmax, int resmin)
Definition: edmisc.cpp:123
void editArchivalInformation()
Definition: edmisc.cpp:2434
void testDebugFunction()
Definition: edmisc.cpp:3779
void generateTechTree()
Definition: edmisc.cpp:2627
void copyArea()
Definition: edmisc.cpp:3735
MapField * getactfield()
Definition: edmisc.cpp:2759
void saveClipboard()
Definition: edmisc.cpp:2508
void unitProductionLimitation()
the function to edit the vehicle type that are allowed to be build by units
The map. THE central structure of ASC, which holds everything not globally available together...
Definition: gamemap.h:182