Kurosu a écrit :
Maybe this cache is storing twice something.
Yes, this is what happens. I have found at least 3 such risky situations.
I've added something to track duplicated entries in
Map::ToRedrawOnScreen. It has spotted the following contexts when this
duplicate insertion occurs:
1) GameLoop::Draw() -> ExplosionSmoke::Draw() -> Sprite::Draw() ->
Sprite::DrawXY -> Sprite::Blit (several) -> Map::ToRedrawOnScreen()
2) Game::MessageEndOfGame() -> Menu::Display() -> WidgetList::Update()
-> Widget::Update() -> Label::Draw() -> Text::DrawCenterTop() ->
Text::DrawTopLeft(int, int) -> Text::DrawTopLeft(const Point2i&)
3) ButtonText::Draw -> Text::DrawCenter()
The attached patch removes all of the asserts in std::sort for MSVC, but
the solution is hardly better (having to go through a list and matching
rectangles). Instead, determining the source of the duplication above
might be better...
Best regards,
Kurosu
Index: map.cpp
===================================================================
--- map.cpp (rvision 3051)
+++ map.cpp (copie de travail)
@@ -29,7 +29,11 @@
#include "wind.h"
#include "game/time.h"
#include "object/objbox.h"
+#include "tool/debug.h"
#include "tool/i18n.h"
+#ifdef _MSC_VER
+# include <algorithm>
+#endif
const double MINIMUM_DISTANCE_BETWEEN_CHARACTERS = 50.0;
@@ -103,6 +107,19 @@
void Map::ToRedrawOnScreen(Rectanglei r)
{
r.SetPosition( r.GetPosition() + camera.GetPosition() );
+#ifdef DEBUG
+ for (std::list<Rectanglei>::const_iterator it = to_redraw->begin(); it !=
to_redraw->end(); ++it)
+ {
+ if (*it == r)
+ {
+ Point2i cam = camera.GetPosition();
+
+ MSG_DEBUG("redraw", "Duplicated addition of %ix%i rectangle at (%i,%i)
from camera at position (%i,%i)\n",
+ r.GetSizeX(), r.GetSizeY(), r.GetPositionX(),
r.GetPositionY(), cam.x, cam.y);
+ return;
+ }
+ }
+#endif
to_redraw->push_back( r );
}
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev