[colobot] 273/390: Don't crash when there are too many images in SatCom

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit f0d32125e9b7ecaa9d0f313686d94edec5fa12f2
Author: krzys-h <krzys_h at interia.pl>
Date:   Wed Mar 18 21:39:35 2015 +0100

    Don't crash when there are too many images in SatCom
    
    This limit will be removed during UI refactoring in the future.
    Also, I've increased the limit to 100 lines.
    issue #411
---
 src/ui/edit.cpp | 4 ++++
 src/ui/edit.h   | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 6ac60a3..676b80e 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -1636,6 +1636,10 @@ bool CEdit::ReadText(std::string filename, int addSize)
                 // A part of image per line of text.
                 for ( iCount=0 ; iCount<iLines ; iCount++ )
                 {
+                    if(iIndex >= EDITIMAGEMAX) {
+                        CLogger::GetInstancePointer()->Warn("Too many images, current limit is %d image lines. This limit will be removed in the future.\n", EDITIMAGEMAX);
+                        break;
+                    }
                     m_image[iIndex].name = iName;
                     m_image[iIndex].offset = static_cast<float>(iCount/iLines);
                     m_image[iIndex].height = 1.0f/iLines;
diff --git a/src/ui/edit.h b/src/ui/edit.h
index cbad394..385ee2b 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -55,7 +55,7 @@ const int EDITSTUDIOMAX     = 20000;
 //! maximum total number of lines
 const int EDITLINEMAX       = 1000;
 //! maximum total number of lines with images
-const int EDITIMAGEMAX      = 50;
+const int EDITIMAGEMAX      = 100;
 //! maximum number of links
 const int EDITLINKMAX       = 100;
 //! max number of levels preserves

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list