Browse Source

Minor fixes.

Michał W. Urbańczyk 15 years ago
parent
commit
88b4d69afa
2 changed files with 10 additions and 3 deletions
  1. 1 1
      client/CMessage.cpp
  2. 9 2
      client/GUIClasses.cpp

+ 1 - 1
client/CMessage.cpp

@@ -400,7 +400,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player, int
 	if(dynamic_cast<CSelWindow*>(ret)) //it's selection window, so we'll blit "or" between components
 		_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],zwykly);
 
-	const int sizes[][2] = {{400, 100}, {500, 150}, {600, 200}};
+	const int sizes[][2] = {{400, 125}, {500, 150}, {600, 200}};
 	for(int i = 0; 
 		i < ARRAY_COUNT(sizes) 
 			&& sizes[i][0] < conf.cc.resx - 150  

+ 9 - 2
client/GUIClasses.cpp

@@ -5615,7 +5615,7 @@ void CTextBox::showAll(SDL_Surface * to)
 	int dy = f.height; //line height
 	int base_y = pos.y;
 	if(alignment == CENTER)
-		base_y += (pos.h - maxH)/2;
+		base_y += std::max((pos.h - maxH)/2,0);
 
 	int howManyLinesToPrint = slider ? slider->capacity : lines.size();
 	int firstLineToPrint = slider ? slider->value : 0;
@@ -5625,9 +5625,13 @@ void CTextBox::showAll(SDL_Surface * to)
 		const std::string &line = lines[i + firstLineToPrint];
 		int x = pos.x;
 		if(alignment == CENTER)
+		{
 			x += (pos.w - f.getWidth(line.c_str())) / 2;
+			if(slider)
+				x -= slider->pos.w / 2 + 5;
+		}
 
-		printAt(line, pos.x, base_y + i*dy, font, color, to);
+		printAt(line, x, base_y + i*dy, font, color, to);
 	}
 
 }
@@ -5640,6 +5644,9 @@ void CTextBox::setTxt(const std::string &Txt)
 
 void CTextBox::sliderMoved(int to)
 {
+	if(!slider)
+		return;
+
 	if(redrawParentOnScrolling)
 		parent->redraw();
 	redraw();