AVALANCHE: Make Graphics::drawPicture more safe. Fix an index-bug regarding Gyro::_objectList.

This commit is contained in:
uruk 2013-09-16 16:18:02 +02:00
parent 5f6fc0de6b
commit fe72db6c85
4 changed files with 4 additions and 4 deletions

View file

@ -629,7 +629,7 @@ void Dropdown::runMenuAction() {
}
void Dropdown::runMenuObjects() {
_vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum + 1], Gyro::kThing);
_vm->_lucerna->thinkAbout(_vm->_gyro->_objectList[_activeMenuItem._choiceNum], Gyro::kThing);
}
void Dropdown::runMenuPeople() {

View file

@ -291,7 +291,7 @@ void Graphics::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16
}
}
void Graphics::drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY) {
void Graphics::drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY) {
// Copy the picture to the given place on the screen.
for (uint16 y = 0; y < picture.h; y++) {
for (uint16 x = 0; x < picture.w; x++) {

View file

@ -85,7 +85,7 @@ public:
::Graphics::Surface loadPictureRow(Common::File &file, uint16 width, uint16 height); // Reads Row-planar EGA data.
void drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y);
void drawPicture(::Graphics::Surface &target, ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example.
void drawPicture(::Graphics::Surface &target, const ::Graphics::Surface &picture, uint16 destX, uint16 destY); // Can't call .free() here. See Lucerna::showscore() for example.
void refreshScreen();
void refreshBackground();

View file

@ -1004,8 +1004,8 @@ void Lucerna::refreshObjectList() {
for (byte i = 0; i < kObjectNum; i++) {
if (_vm->_gyro->_objects[i]) {
_vm->_gyro->_carryNum++;
_vm->_gyro->_objectList[_vm->_gyro->_carryNum] = i + 1;
_vm->_gyro->_carryNum++;
}
}
}