Browse Source

rather show buggy graphics than crash!

Gesche 1 year ago
parent
commit
0681f02d87
2 changed files with 9 additions and 4 deletions
  1. 2
    1
      README.md
  2. 7
    3
      src/client/thingtype.cpp

+ 2
- 1
README.md View File

@@ -1,4 +1,5 @@
1
-[![Build Status](https://secure.travis-ci.org/edubart/otclient.svg?branch=master)](http://travis-ci.org/edubart/otclient) [![Join the chat at https://gitter.im/edubart/otclient](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/edubart/otclient?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\
1
+This is a fork from [otclient](https://github.com/edubart/otclient)
2
+
2 3
 
3 4
 ### What is otclient?
4 5
 

+ 7
- 3
src/client/thingtype.cpp View File

@@ -544,8 +544,12 @@ uint ThingType::getSpriteIndex(int w, int h, int l, int x, int y, int z, int a)
544 544
         * m_layers + l)
545 545
         * m_size.height() + h)
546 546
         * m_size.width() + w;
547
-    assert(index < m_spritesIndex.size());
548
-    return index;
547
+    if (index >= m_spritesIndex.size()) {
548
+	return m_spritesIndex.size()-1;
549
+    } else {
550
+	//assert(Iindex < m_spritesIndex.size());
551
+    	return index;
552
+    }
549 553
 }
550 554
 
551 555
 uint ThingType::getTextureIndex(int l, int x, int y, int z) {
@@ -571,4 +575,4 @@ void ThingType::setPathable(bool var)
571 575
         m_attribs.remove(ThingAttrNotPathable);
572 576
     else
573 577
         m_attribs.set(ThingAttrNotPathable, true);
574
-}
578
+}

Loading…
Cancel
Save