[Scummvm-git-logs] scummvm master -> c84a78852188f4ef4925858611ea6ebfb24cd165

sev- noreply at scummvm.org
Mon Sep 16 21:56:35 UTC 2024


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
50061e51ed JANITORIAL: Code formatting
c84a788521 QDENGINE: Fix text wrapper


Commit: 50061e51ed60f2a4e892e3c071adfa0ae757066e
    https://github.com/scummvm/scummvm/commit/50061e51ed60f2a4e892e3c071adfa0ae757066e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-16T23:56:22+02:00

Commit Message:
JANITORIAL: Code formatting

Changed paths:
    engines/qdengine/qdcore/qd_interface_counter.cpp
    engines/qdengine/qdcore/qd_screen_text.cpp


diff --git a/engines/qdengine/qdcore/qd_interface_counter.cpp b/engines/qdengine/qdcore/qd_interface_counter.cpp
index 5a2c04ddf1d..42c63c4af78 100644
--- a/engines/qdengine/qdcore/qd_interface_counter.cpp
+++ b/engines/qdengine/qdcore/qd_interface_counter.cpp
@@ -182,14 +182,12 @@ bool qdInterfaceCounter::post_redraw() {
 }
 
 int qdInterfaceCounter::size_x() const {
-	const grFont *font = qdGameDispatcher::get_dispatcher()->
-	                     find_font(_textFormat.font_type());
+	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(_textFormat.font_type());
 	return grDispatcher::instance()->textWidth(data().c_str(), 0, font);
 }
 
 int qdInterfaceCounter::size_y() const {
-	const grFont *font = qdGameDispatcher::get_dispatcher()->
-	                     find_font(_textFormat.font_type());
+	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(_textFormat.font_type());
 	return grDispatcher::instance()->textHeight(data().c_str(), 0, font);
 }
 
diff --git a/engines/qdengine/qdcore/qd_screen_text.cpp b/engines/qdengine/qdcore/qd_screen_text.cpp
index 69ecabc4bd2..8bd16109398 100644
--- a/engines/qdengine/qdcore/qd_screen_text.cpp
+++ b/engines/qdengine/qdcore/qd_screen_text.cpp
@@ -162,8 +162,7 @@ void qdScreenText::redraw(const Vect2i &owner_pos) const {
 
 	uint32 col = _hover_mode ? _text_format.hover_color() : _text_format.color();
 
-	const grFont *font = qdGameDispatcher::get_dispatcher()->
-	                     find_font(_text_format.font_type());
+	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(_text_format.font_type());
 
 	grDispatcher::instance()->drawAlignedText(x, y, _size.x, _size.y, col, data(), grTextAlign(_text_format.alignment()), 0, 0, font);
 	if (g_engine->_debugDraw)
@@ -173,8 +172,7 @@ void qdScreenText::redraw(const Vect2i &owner_pos) const {
 void qdScreenText::set_data(const char *p) {
 	_data = p;
 
-	const grFont *font = qdGameDispatcher::get_dispatcher()->
-	                     find_font(_text_format.font_type());
+	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(_text_format.font_type());
 	_size.x = grDispatcher::instance()->textWidth(data(), 0, font);
 	_size.y = grDispatcher::instance()->textHeight(data(), 0, font);
 }
@@ -184,9 +182,9 @@ bool qdScreenText::is_owned_by(const qdNamedObject *p) const {
 }
 
 bool qdScreenText::format_text(int max_width) {
-	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(
-	                         text_format().font_type());
-	if (NULL == font) font = grDispatcher::get_default_font();
+	const grFont *font = qdGameDispatcher::get_dispatcher()->find_font(text_format().font_type());
+	if (NULL == font)
+		font = grDispatcher::get_default_font();
 
 	bool correct = true;
 	int safe_space = -1;


Commit: c84a78852188f4ef4925858611ea6ebfb24cd165
    https://github.com/scummvm/scummvm/commit/c84a78852188f4ef4925858611ea6ebfb24cd165
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-16T23:56:22+02:00

Commit Message:
QDENGINE: Fix text wrapper

Changed paths:
    engines/qdengine/qdcore/qd_screen_text.cpp


diff --git a/engines/qdengine/qdcore/qd_screen_text.cpp b/engines/qdengine/qdcore/qd_screen_text.cpp
index 8bd16109398..bebd5d77285 100644
--- a/engines/qdengine/qdcore/qd_screen_text.cpp
+++ b/engines/qdengine/qdcore/qd_screen_text.cpp
@@ -198,10 +198,10 @@ bool qdScreenText::format_text(int max_width) {
 			if (cur_wid > max_width) {
 				// Safe space is present, so it is safe to split it (e.g. everything fits max_width)
 				if (safe_space >= 0) {
-					_data.setChar(safe_space, '\n');
+					_data.setChar('\n', safe_space);
 					i = safe_space; // in for(...) we will move to safe_space + 1
 				} else { // it didn't fit (no safe space). But we split it anyway, it is at least something...
-					_data.setChar(i, '\n');
+					_data.setChar('\n', i);
 					correct = false;
 				}
 			}
@@ -209,7 +209,7 @@ bool qdScreenText::format_text(int max_width) {
 			safe_space = -1;
 			cur_wid = 0;
 		} else if (' ' != _data[i]) { // Not a space -- we accumulate width
-			cur_wid += font->find_char(_data[i]).size_x();
+			cur_wid += font->find_char((byte)_data[i]).size_x();
 		} else { // // Space - it is safe to split here (we remember this position or split here)
 			cur_wid += font->size_x() / 2;
 
@@ -219,10 +219,10 @@ bool qdScreenText::format_text(int max_width) {
 				continue;
 			} else { // The width is exceeded, and we saw a safe space -- have to split. (Everything fits max_width)
 				if (safe_space >= 0) {
-					_data.setChar(safe_space, '\n');
+					_data.setChar('\n', safe_space);
 					i = safe_space; // in for(...) we will move to safe_space + 1
 				} else { // it didn't fit (no safe space). But we split it anyway, it is at least something...
-					_data.setChar(i, '\n');
+					_data.setChar('\n', i);
 					correct = false;
 				}
 				safe_space = -1; // We have split -- no more safe space




More information about the Scummvm-git-logs mailing list