News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

[bug+fix] Enlarge map

Started by gerw, July 15, 2009, 06:26:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gerw

As mentioned in an other thread: If you choose ugly map sizes like 92x92, you can decrease you map size via the enlarge-map dialogue and simutrans will crash.

Fix:
Index: gui/enlarge_map_frame_t.cc
===================================================================
--- gui/enlarge_map_frame_t.cc (revision 2577)
+++ gui/enlarge_map_frame_t.cc (working copy)
@@ -145,40 +145,38 @@
bool enlarge_map_frame_t::action_triggered( gui_action_creator_t *komp,value_t /* */)
{
if(komp==x_size+0) {
- if(sets->get_groesse_x() > max(512,this->welt->get_groesse_x()) ) {
+ if( sets->get_groesse_x() > 512 ) {
sets->set_groesse_x( (sets->get_groesse_x()-1)&0x1F80 );
- update_preview();
- } else if(sets->get_groesse_x() > max(64,this->welt->get_groesse_x()) ) {
+ } else if(sets->get_groesse_x() > 64 ) {
sets->set_groesse_x( (sets->get_groesse_x()-1)&0x1FC0 );
- update_preview();
}
+ sets->set_groesse_x( max( welt->get_groesse_x(), sets->get_groesse_x() ) );
+ update_preview();
}
else if(komp==x_size+1) {
- if(sets->get_groesse_x() < 512 ) {
+ if( sets->get_groesse_x() < 512 ) {
sets->set_groesse_x( (sets->get_groesse_x()+64)&0x1FC0 );
- update_preview();
} else if(sets->get_groesse_x() < 4096 ) {
sets->set_groesse_x( (sets->get_groesse_x()+128)&0x1F80 );
- update_preview();
}
+ update_preview();
}
else if(komp==y_size+0) {
- if(sets->get_groesse_y() > max(512,this->welt->get_groesse_y()) ) {
+ if( sets->get_groesse_y() > 512 ) {
sets->set_groesse_y( (sets->get_groesse_y()-1)&0x1F80 );
- update_preview();
- } else if(sets->get_groesse_y() > max(64,this->welt->get_groesse_y()) ) {
+ } else if( sets->get_groesse_y() > 64 ) {
sets->set_groesse_y( (sets->get_groesse_y()-1)&0x1FC0 );
- update_preview();
}
+ sets->set_groesse_y( max( welt->get_groesse_y(), sets->get_groesse_y() ) );
+ update_preview();
}
else if(komp==y_size+1) {
if(sets->get_groesse_y() < 512 ) {
sets->set_groesse_y( (sets->get_groesse_y()+64)&0x1FC0 );
- update_preview();
} else if(sets->get_groesse_y() < 4096 ) {
sets->set_groesse_y( (sets->get_groesse_y()+128)&0x1F80 );
- update_preview();
}
+ update_preview();
}
else if(komp==number_of_towns+0) {
if(sets->get_anzahl_staedte()>0 ) {