- map editor bugfixes (proper deletion of arrays and tooltip painting)

- updated vc++ 2008 project files (and new win32 dependency archive uploaded to sourceforge) so that all projects can be built in debug mode now
This commit is contained in:
Mark Vejvoda 2010-07-18 05:09:30 +00:00
parent add0275120
commit bd3cb7f9bb
3 changed files with 75 additions and 56 deletions

View File

@ -40,14 +40,14 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd&quot;;&quot;..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc&quot;;..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;&quot;..\..\source\win32_deps\wxWidgets-2.8.10\include&quot;;..\..\source\shared_lib\include\xml;&quot;../../source/win32_deps/xerces-c-3.0.1/src&quot;"
PreprocessorDefinitions="MWIN;__WXMSW__;__WXDEBUG__"
AdditionalIncludeDirectories="&quot;..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd&quot;;&quot;..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc&quot;;..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;&quot;..\..\source\win32_deps\wxWidgets-2.8.10\include&quot;;..\..\source\shared_lib\include\xml;&quot;../../source/win32_deps/xerces-c-3.0.1/src&quot;;..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/platform/common;&quot;../../source/win32_deps/SDL-1.2.14/include&quot;;&quot;../../source/win32_deps/curl-7.20.1/include&quot;"
PreprocessorDefinitions="MWIN;__WXMSW__;__WXDEBUG__;CURL_STATICLIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="1"
UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
PrecompiledHeaderFile="c:\temp\$(TargetName).pch"
PrecompiledHeaderFile=""
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
@ -63,7 +63,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28d_adv.lib wxmsw28d_aui.lib wxmsw28d_core.lib wxmsw28d_gl.lib wxmsw28d_html.lib wxmsw28d_media.lib wxmsw28d_qa.lib wxmsw28d_richtext.lib wxmsw28d_xrc.lib wxpngd.lib wxregexd.lib wxtiffd.lib wxzlibd.lib ..\libglest.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib winmm.lib rpcrt4.lib"
AdditionalDependencies="wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28d_adv.lib wxmsw28d_aui.lib wxmsw28d_core.lib wxmsw28d_gl.lib wxmsw28d_html.lib wxmsw28d_media.lib wxmsw28d_qa.lib wxmsw28d_richtext.lib wxmsw28d_xrc.lib wxpngd.lib wxregexd.lib wxtiffd.lib wxzlibd.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib xerces-c_3.lib"
OutputFile="$(OutDir)\Glest_Configurator.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;../../build/$(ConfigurationName)/libglest&quot;;../../source/win32_deps/lib"

View File

@ -54,7 +54,9 @@ MainWindow::MainWindow()
, enabledGroup(ctHeight)
, fileModified(false)
, menuBar(NULL)
, panel(NULL) {
, panel(NULL)
, glCanvas(NULL)
, program(NULL) {
this->panel = new wxPanel(this, wxID_ANY);
@ -332,11 +334,16 @@ void MainWindow::onClose(wxCloseEvent &event) {
}
MainWindow::~MainWindow() {
delete glCanvas;
delete program;
program = NULL;
delete glCanvas;
glCanvas = NULL;
}
void MainWindow::setDirty(bool val) {
wxPaintEvent ev;
onPaint(ev);
if (fileModified && val) {
return;
}
@ -380,16 +387,20 @@ void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) {
}
void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) {
bool repaint = false;
int dif;
if (event.LeftIsDown()) {
change(x, y);
repaint = true;
} else if (event.MiddleIsDown()) {
dif = (y - lastY);
if (dif != 0) {
program->incCellSize(dif / abs(dif));
repaint = true;
}
} else if (event.RightIsDown()) {
program->setOfset(x - lastX, y - lastY);
repaint = true;
} else {
int currResource = program->getResource(x, y);
if (currResource > 0) {
@ -406,8 +417,10 @@ void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) {
lastX = x;
lastY = y;
wxPaintEvent ev;
onPaint(ev);
if (repaint) {
wxPaintEvent ev;
onPaint(ev);
}
event.Skip();
}
@ -423,6 +436,7 @@ void MainWindow::onPaint(wxPaintEvent &event) {
program->renderMap(glCanvas->GetClientSize().x, glCanvas->GetClientSize().y);
glCanvas->SwapBuffers();
event.Skip();
}
void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
@ -1021,42 +1035,42 @@ int App::OnExit() {
return 0;
}
MsgDialog::MsgDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
long style,
MsgDialog::MsgDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
long style,
const wxPoint& pos) {
m_sizerText = NULL;
// TODO: should we use main frame as parent by default here?
if ( !wxDialog::Create(parent, wxID_ANY, caption,
pos, wxDefaultSize,
style) ) {
return;
}
m_sizerText = new wxBoxSizer(wxVERTICAL);
wxStaticText *label = new wxStaticText(this, wxID_ANY, message);
wxFont font(*wxNORMAL_FONT);
font.SetPointSize(font.GetPointSize());
font.SetWeight(wxFONTWEIGHT_NORMAL);
label->SetFont(font);
m_sizerText->Add(label, wxSizerFlags().Centre().Border());
wxSizer *sizerIconAndText = new wxBoxSizer(wxHORIZONTAL);
sizerIconAndText->Add(m_sizerText, wxSizerFlags(1).Expand());
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(sizerIconAndText, wxSizerFlags(1).Expand().Border());
wxSizer *sizerBtns = CreateButtonSizer(wxOK);
if ( sizerBtns )
{
sizerTop->Add(sizerBtns, wxSizerFlags().Expand().Border());
}
SetSizerAndFit(sizerTop);
CentreOnScreen();
m_sizerText = NULL;
// TODO: should we use main frame as parent by default here?
if ( !wxDialog::Create(parent, wxID_ANY, caption,
pos, wxDefaultSize,
style) ) {
return;
}
m_sizerText = new wxBoxSizer(wxVERTICAL);
wxStaticText *label = new wxStaticText(this, wxID_ANY, message);
wxFont font(*wxNORMAL_FONT);
font.SetPointSize(font.GetPointSize());
font.SetWeight(wxFONTWEIGHT_NORMAL);
label->SetFont(font);
m_sizerText->Add(label, wxSizerFlags().Centre().Border());
wxSizer *sizerIconAndText = new wxBoxSizer(wxHORIZONTAL);
sizerIconAndText->Add(m_sizerText, wxSizerFlags(1).Expand());
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(sizerIconAndText, wxSizerFlags(1).Expand().Border());
wxSizer *sizerBtns = CreateButtonSizer(wxOK);
if ( sizerBtns )
{
sizerTop->Add(sizerBtns, wxSizerFlags().Expand().Border());
}
SetSizerAndFit(sizerTop);
CentreOnScreen();
}
MsgDialog::~MsgDialog() {

View File

@ -41,10 +41,13 @@ Map::Map() {
Map::~Map() {
delete [] startLocations;
startLocations = NULL;
for (int i = 0; i < h; i++) {
delete cells[i];
delete [] cells[i];
}
delete cells;
delete [] cells;
cells = NULL;
}
@ -284,9 +287,9 @@ void Map::flipX() {
}
for (int i = 0; i < w; i++) {
delete oldCells[i];
delete [] oldCells[i];
}
delete oldCells;
delete [] oldCells;
}
void Map::flipY() {
@ -308,9 +311,9 @@ void Map::flipY() {
}
for (int i = 0; i < w; i++) {
delete oldCells[i];
delete [] oldCells[i];
}
delete oldCells;
delete [] oldCells;
}
void Map::changeSurface(int x, int y, int surface, int radius) {
@ -411,9 +414,9 @@ void Map::reset(int w, int h, float alt, int surf) {
if (cells != NULL) {
for (int i = 0; i < this->w; i++) {
delete cells[i];
delete [] cells[i];
}
delete cells;
delete [] cells;
}
this->w = w;
@ -493,8 +496,8 @@ void Map::resize(int w, int h, float alt, int surf) {
//delete old cells
if (oldCells != NULL) {
for (int i = 0; i < oldW; i++)
delete oldCells[i];
delete oldCells;
delete [] oldCells[i];
delete [] oldCells;
}
}
@ -503,8 +506,10 @@ void Map::resetFactions(int maxPlayers) {
throw runtime_error("Max Players must be in the range 1-8");
}
if (startLocations != NULL)
delete startLocations;
if (startLocations != NULL) {
delete [] startLocations;
startLocations = NULL;
}
maxFactions = maxPlayers;