mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 07:07:10 +00:00
CGE: Fix several allocation mismatches and Valgrind issues
This commit is contained in:
parent
ef83c248d3
commit
1870f09d31
@ -1715,7 +1715,9 @@ bool CGEEngine::showTitle(const char *name) {
|
||||
return false;
|
||||
|
||||
Bitmap::_pal = Vga::_sysPal;
|
||||
BMP_PTR LB[] = { new Bitmap(name, true), NULL };
|
||||
BMP_PTR *LB = new BMP_PTR[2];
|
||||
LB[0] = new Bitmap(name, true);
|
||||
LB[1] = NULL;
|
||||
Bitmap::_pal = NULL;
|
||||
bool usr_ok = false;
|
||||
|
||||
|
@ -154,7 +154,7 @@ Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0)
|
||||
_buttons = 0;
|
||||
_busy = NULL;
|
||||
_active = false;
|
||||
|
||||
_flags._kill = true;
|
||||
setSeq(ms);
|
||||
|
||||
BMP_PTR *MC = new BMP_PTR[3];
|
||||
|
@ -99,7 +99,8 @@ void Font::save() {
|
||||
|
||||
Talk::Talk(CGEEngine *vm, const char *tx, TBOX_STYLE mode)
|
||||
: Sprite(vm, NULL), _mode(mode), _vm(vm) {
|
||||
_ts[0] = _ts[1] = NULL;
|
||||
|
||||
_ts = NULL;
|
||||
_flags._syst = true;
|
||||
update(tx);
|
||||
}
|
||||
@ -107,7 +108,7 @@ Talk::Talk(CGEEngine *vm, const char *tx, TBOX_STYLE mode)
|
||||
|
||||
Talk::Talk(CGEEngine *vm)
|
||||
: Sprite(vm, NULL), _mode(PURE), _vm(vm) {
|
||||
_ts[0] = _ts[1] = NULL;
|
||||
_ts = NULL;
|
||||
_flags._syst = true;
|
||||
}
|
||||
|
||||
@ -141,7 +142,7 @@ void Talk::update(const char *tx) {
|
||||
const char *p;
|
||||
uint8 *m;
|
||||
|
||||
if (!_ts[0]) {
|
||||
if (!_ts) {
|
||||
uint16 k = 2 * hmarg;
|
||||
mh = 2 * vmarg + FONT_HIG;
|
||||
for (p = tx; *p; p++) {
|
||||
@ -155,7 +156,10 @@ void Talk::update(const char *tx) {
|
||||
}
|
||||
if (k > mw)
|
||||
mw = k;
|
||||
|
||||
_ts = new BMP_PTR[2];
|
||||
_ts[0] = box(mw, mh);
|
||||
_ts[1] = NULL;
|
||||
}
|
||||
|
||||
m = _ts[0]->_m + ln * mw + hmarg;
|
||||
@ -286,6 +290,11 @@ void Talk::putLine(int line, const char *text) {
|
||||
|
||||
|
||||
InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldTxt(NULL), _vm(vm) {
|
||||
if (!_ts) {
|
||||
_ts = new BMP_PTR[2];
|
||||
_ts[1] = NULL;
|
||||
}
|
||||
|
||||
_ts[0] = new Bitmap(w, FONT_HIG, TEXT_BG);
|
||||
setShapeList(_ts);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ enum TBOX_STYLE { PURE, RECT, ROUND };
|
||||
class Talk : public Sprite {
|
||||
protected:
|
||||
TBOX_STYLE _mode;
|
||||
Bitmap *_ts[2];
|
||||
BMP_PTR *_ts;
|
||||
Bitmap *box(uint16 w, uint16 h);
|
||||
public:
|
||||
Talk(CGEEngine *vm, const char *tx, TBOX_STYLE mode);
|
||||
|
@ -619,7 +619,7 @@ Sprite *Sprite::contract() {
|
||||
if (_flags._bDel && e->_shpList) {
|
||||
int i;
|
||||
for (i = 0; e->_shpList[i]; i++)
|
||||
delete e->_shpList[i];
|
||||
delete e->_shpList[i];
|
||||
delete[] e->_shpList;
|
||||
}
|
||||
if (memType(e->_seq) == NEAR_MEM)
|
||||
|
@ -59,8 +59,12 @@ MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) {
|
||||
p1 += w;
|
||||
p2 -= w;
|
||||
}
|
||||
|
||||
_ts = new BMP_PTR[2];
|
||||
_ts[0] = new Bitmap(w, h, p);
|
||||
_ts[1] = NULL;
|
||||
setShapeList(_ts);
|
||||
|
||||
_flags._slav = true;
|
||||
_flags._tran = true;
|
||||
_flags._kill = true;
|
||||
|
Loading…
Reference in New Issue
Block a user