r7087 - in packages/trunk/simutrans/debian: . patches
Ansgar Burchardt
ansgar-guest at alioth.debian.org
Sat May 17 08:11:00 UTC 2008
Author: ansgar-guest
Date: 2008-05-17 08:11:00 +0000 (Sat, 17 May 2008)
New Revision: 7087
Added:
packages/trunk/simutrans/debian/patches/fix-bug-481264
Modified:
packages/trunk/simutrans/debian/changelog
packages/trunk/simutrans/debian/patches/series
Log:
* new patch fix-bug-481264 (Closes: #481264)
+ fix crash if starting_year is set to a low value (below 1800)
+ fix crash in simcity.cc(stadt_t::gib_zufallspunkt)
Modified: packages/trunk/simutrans/debian/changelog
===================================================================
--- packages/trunk/simutrans/debian/changelog 2008-05-17 07:43:54 UTC (rev 7086)
+++ packages/trunk/simutrans/debian/changelog 2008-05-17 08:11:00 UTC (rev 7087)
@@ -7,6 +7,9 @@
* Link makeobj with g++ instead of ld (should fix build on mipsel)
* fix crash when calling 'makeobj dump' (Closes: #473245)
+ new patch: fix-makeobj-dump-crash
+ * new patch fix-bug-481264 (Closes: #481264)
+ + fix crash if starting_year is set to a low value (below 1800)
+ + fix crash in simcity.cc(stadt_t::gib_zufallspunkt)
-- Ansgar Burchardt <ansgar at 43-1.org> Sun, 23 Mar 2008 21:15:39 +0100
Added: packages/trunk/simutrans/debian/patches/fix-bug-481264
===================================================================
--- packages/trunk/simutrans/debian/patches/fix-bug-481264 (rev 0)
+++ packages/trunk/simutrans/debian/patches/fix-bug-481264 2008-05-17 08:11:00 UTC (rev 7087)
@@ -0,0 +1,51 @@
+Fix bug #481264:
+ - simutrans crashes if starting_year is set to a low value
+ - simutrans crashes in simcity.cc: stadt_t::gib_zufallspunkt
+
+Patches retrieved from upstream commit 1796 and 1801
+
+Index: simutrans-99.18~0.svn1664.obsolete.0.385152425224991/simcity.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.obsolete.0.385152425224991.orig/simcity.cc
++++ simutrans-99.18~0.svn1664.obsolete.0.385152425224991/simcity.cc
+@@ -1520,6 +1520,9 @@
+ if (step_count >= buildings.get_count()) {
+ step_count = 0;
+ }
++ if(buildings.get_count() == 0) {
++ return;
++ }
+ const gebaeude_t* gb = buildings[step_count];
+
+ // prissi: since now backtravels occur, we damp the numbers a little
+@@ -1720,16 +1723,20 @@
+ */
+ koord stadt_t::gib_zufallspunkt() const
+ {
+- assert(!buildings.empty());
+- const gebaeude_t* gb = buildings.at_weight(simrand(buildings.get_sum_weight()));
+- koord k = gb->gib_pos().gib_2d();
+- if(!welt->ist_in_kartengrenzen(k)) {
+- // this building should not be in this list, since it has been already deleted!
+- dbg->error("stadt_t::gib_zufallspunkt()", "illegal building in city list of %s: %p removing!", this->gib_name(), gb);
+- const_cast<stadt_t*>(this)->buildings.remove(gb);
+- k = koord(0, 0);
+- }
+- return k;
++ if(!buildings.empty()) {
++ const gebaeude_t* gb = buildings.at_weight(simrand(buildings.get_sum_weight()));
++ koord k = gb->gib_pos().gib_2d();
++ if(!welt->ist_in_kartengrenzen(k)) {
++ // this building should not be in this list, since it ha s been already deleted!
++ dbg->error("stadt_t::gib_zufallspunkt()", "illegal building in city list of %s: %p removing!", this->gib_name(), gb);
++ const_cast<stadt_t*>(this)->buildings.remove(gb);
++ k = koord(0, 0);
++ }
++ return k;
++ }
++ // might happen on slow computers during creation of new cities or start of map
++ return koord(0,0);
++
+ }
+
+
Modified: packages/trunk/simutrans/debian/patches/series
===================================================================
--- packages/trunk/simutrans/debian/patches/series 2008-05-17 07:43:54 UTC (rev 7086)
+++ packages/trunk/simutrans/debian/patches/series 2008-05-17 08:11:00 UTC (rev 7087)
@@ -4,4 +4,5 @@
gcc-4.3-fixes
fix-stdarg-calls
makeobj-endianness
+fix-bug-481264
fix-makeobj-dump-crash
More information about the Pkg-games-commits
mailing list