LAB: Fix several cppcheck errors
This commit is contained in:
parent
93e3ba9edd
commit
b76a624c9a
7 changed files with 26 additions and 32 deletions
|
@ -99,7 +99,7 @@ static void freeRoom(uint16 RMarker) {
|
||||||
Rooms[RoomNum].WestView = NULL;
|
Rooms[RoomNum].WestView = NULL;
|
||||||
|
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = Rooms[RoomNum].rules;
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++)
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule)
|
||||||
delete *rule;
|
delete *rule;
|
||||||
Rooms[RoomNum].rules->clear();
|
Rooms[RoomNum].rules->clear();
|
||||||
delete Rooms[RoomNum].rules;
|
delete Rooms[RoomNum].rules;
|
||||||
|
@ -119,28 +119,25 @@ static void freeRoom(uint16 RMarker) {
|
||||||
/* Gets a chunk of memory from the buffer. */
|
/* Gets a chunk of memory from the buffer. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void *getCurMem(uint16 Size) {
|
static void *getCurMem(uint16 Size) {
|
||||||
uint16 counter;
|
|
||||||
void *Ptr, *Start0, *Start1, *End0, *End1;
|
|
||||||
|
|
||||||
if (((int32) Size) > MemLeftInBuffer) {
|
if (((int32) Size) > MemLeftInBuffer) {
|
||||||
MemPlace = RoomBuffer;
|
MemPlace = RoomBuffer;
|
||||||
MemLeftInBuffer = ROOMBUFFERSIZE;
|
MemLeftInBuffer = ROOMBUFFERSIZE;
|
||||||
NextMemPlace = NULL;
|
NextMemPlace = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr = MemPlace;
|
void *Ptr = MemPlace;
|
||||||
MemPlace = (char *)MemPlace + Size;
|
MemPlace = (char *)MemPlace + Size;
|
||||||
MemLeftInBuffer -= Size;
|
MemLeftInBuffer -= Size;
|
||||||
|
|
||||||
if (MemPlace > NextMemPlace) {
|
if (MemPlace > NextMemPlace) {
|
||||||
NextMemPlace = NULL;
|
NextMemPlace = NULL;
|
||||||
|
|
||||||
for (counter = 0; counter < MAXMARKERS; counter++) {
|
for (uint16 counter = 0; counter < MAXMARKERS; counter++) {
|
||||||
if (RoomMarkers[counter].RoomNum != EMPTYROOM) {
|
if (RoomMarkers[counter].RoomNum != EMPTYROOM) {
|
||||||
Start0 = RoomMarkers[counter].Start0;
|
void *Start0 = RoomMarkers[counter].Start0;
|
||||||
Start1 = RoomMarkers[counter].Start1;
|
void *Start1 = RoomMarkers[counter].Start1;
|
||||||
End0 = RoomMarkers[counter].End0;
|
void *End0 = RoomMarkers[counter].End0;
|
||||||
End1 = RoomMarkers[counter].End1;
|
void *End1 = RoomMarkers[counter].End1;
|
||||||
|
|
||||||
if (((Start0 >= Ptr) && (Start0 < MemPlace)) ||
|
if (((Start0 >= Ptr) && (Start0 < MemPlace)) ||
|
||||||
((End0 >= Ptr) && (End0 < MemPlace)) ||
|
((End0 >= Ptr) && (End0 < MemPlace)) ||
|
||||||
|
|
|
@ -186,7 +186,7 @@ SaveStateList LabMetaEngine::listSaves(const char *target) const {
|
||||||
|
|
||||||
SaveStateList saveList;
|
SaveStateList saveList;
|
||||||
|
|
||||||
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
|
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
|
||||||
// Obtain the last 3 digits of the filename, since they correspond to the save slot
|
// Obtain the last 3 digits of the filename, since they correspond to the save slot
|
||||||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||||
|
|
||||||
|
|
|
@ -1307,10 +1307,8 @@ from_crumbs:
|
||||||
|
|
||||||
|
|
||||||
void LabEngine::go() {
|
void LabEngine::go() {
|
||||||
bool mem, dointro = false;
|
|
||||||
uint16 counter;
|
uint16 counter;
|
||||||
|
bool dointro = true;
|
||||||
dointro = true;
|
|
||||||
|
|
||||||
IsHiRes = ((getFeatures() & GF_LOWRES) == 0);
|
IsHiRes = ((getFeatures() & GF_LOWRES) == 0);
|
||||||
|
|
||||||
|
@ -1320,6 +1318,8 @@ void LabEngine::go() {
|
||||||
else
|
else
|
||||||
warning("Running in LowRes mode");
|
warning("Running in LowRes mode");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool mem = false;
|
||||||
if (initBuffer(BUFFERSIZE, true)) {
|
if (initBuffer(BUFFERSIZE, true)) {
|
||||||
mem = true;
|
mem = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1345,7 +1345,6 @@ void LabEngine::go() {
|
||||||
|
|
||||||
if (dointro && mem) {
|
if (dointro && mem) {
|
||||||
Intro intro;
|
Intro intro;
|
||||||
|
|
||||||
intro.introSequence();
|
intro.introSequence();
|
||||||
} else
|
} else
|
||||||
DoBlack = true;
|
DoBlack = true;
|
||||||
|
|
|
@ -64,10 +64,10 @@ Gadget *createButton(uint16 x, uint16 y, uint16 id, uint16 key, Image *im, Image
|
||||||
|
|
||||||
|
|
||||||
void freeButtonList(Gadget *gptrlist) {
|
void freeButtonList(Gadget *gptrlist) {
|
||||||
Gadget *gptr, *next = gptrlist;
|
Gadget *next = gptrlist;
|
||||||
|
|
||||||
while (next) {
|
while (next) {
|
||||||
gptr = next;
|
Gadget *gptr = next;
|
||||||
next = next->NextGadget;
|
next = next->NextGadget;
|
||||||
|
|
||||||
free(gptr);
|
free(gptr);
|
||||||
|
|
|
@ -619,7 +619,7 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
|
||||||
rules = Rooms[roomNum].rules;
|
rules = Rooms[roomNum].rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == ACTION) &&
|
if (((*rule)->RuleType == ACTION) &&
|
||||||
(((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) {
|
(((*rule)->Param1 == action) || (((*rule)->Param1 == 0) && AllowDefaults))) {
|
||||||
if ((((*rule)->Param2 == LCPtr->CloseUpType) ||
|
if ((((*rule)->Param2 == LCPtr->CloseUpType) ||
|
||||||
|
@ -676,7 +676,7 @@ static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, C
|
||||||
rules = Rooms[roomNum].rules;
|
rules = Rooms[roomNum].rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == OPERATE) &&
|
if (((*rule)->RuleType == OPERATE) &&
|
||||||
(((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) &&
|
(((*rule)->Param1 == ItemNum) || (((*rule)->Param1 == 0) && AllowDefaults)) &&
|
||||||
(((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) {
|
(((*rule)->Param2 == LCPtr->CloseUpType) || (((*rule)->Param2 == 0) && AllowDefaults))) {
|
||||||
|
@ -731,7 +731,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {
|
||||||
bool doGoForward(CloseDataPtr *LCPtr) {
|
bool doGoForward(CloseDataPtr *LCPtr) {
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = Rooms[RoomNum].rules;
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
|
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
|
||||||
if (checkConditions((*rule)->Condition)) {
|
if (checkConditions((*rule)->Condition)) {
|
||||||
doActions((*rule)->ActionList, LCPtr);
|
doActions((*rule)->ActionList, LCPtr);
|
||||||
|
@ -752,7 +752,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
|
||||||
|
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = Rooms[RoomNum].rules;
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == TURN) ||
|
if (((*rule)->RuleType == TURN) ||
|
||||||
(((*rule)->RuleType == TURNFROMTO) &&
|
(((*rule)->RuleType == TURNFROMTO) &&
|
||||||
((*rule)->Param1 == from) && ((*rule)->Param2 == to))) {
|
((*rule)->Param1 == from) && ((*rule)->Param2 == to))) {
|
||||||
|
@ -771,7 +771,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool doMainView(CloseDataPtr *LCPtr) {
|
bool doMainView(CloseDataPtr *LCPtr) {
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = Rooms[RoomNum].rules;
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); rule++) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if ((*rule)->RuleType == GOMAINVIEW) {
|
if ((*rule)->RuleType == GOMAINVIEW) {
|
||||||
if (checkConditions((*rule)->Condition)) {
|
if (checkConditions((*rule)->Condition)) {
|
||||||
doActions((*rule)->ActionList, LCPtr);
|
doActions((*rule)->ActionList, LCPtr);
|
||||||
|
|
|
@ -373,7 +373,6 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
|
||||||
/* Changes the combination number of one of the slots */
|
/* Changes the combination number of one of the slots */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
static void changeTile(uint16 col, uint16 row) {
|
static void changeTile(uint16 col, uint16 row) {
|
||||||
bool check;
|
|
||||||
int16 scrolltype = -1;
|
int16 scrolltype = -1;
|
||||||
|
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
|
@ -417,7 +416,7 @@ static void changeTile(uint16 col, uint16 row) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
check = true;
|
bool check = true;
|
||||||
row = 0;
|
row = 0;
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,10 @@ bool LabEngine::WSDL_HasNextChar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
||||||
int n;
|
|
||||||
int lastMouseAtEdge;
|
|
||||||
int flags = 0;
|
|
||||||
|
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
|
|
||||||
if (1 /*!g_IgnoreProcessInput*/) {
|
if (1 /*!g_IgnoreProcessInput*/) {
|
||||||
|
int flags = 0;
|
||||||
while (g_system->getEventManager()->pollEvent(event)) {
|
while (g_system->getEventManager()->pollEvent(event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case Common::EVENT_RBUTTONDOWN:
|
case Common::EVENT_RBUTTONDOWN:
|
||||||
|
@ -101,8 +98,8 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
||||||
mouseHandler(flags, _mouseX, _mouseY);
|
mouseHandler(flags, _mouseX, _mouseY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_MOUSEMOVE:
|
case Common::EVENT_MOUSEMOVE: {
|
||||||
lastMouseAtEdge = _mouseAtEdge;
|
int lastMouseAtEdge = _mouseAtEdge;
|
||||||
_mouseAtEdge = false;
|
_mouseAtEdge = false;
|
||||||
_mouseX = event.mouse.x;
|
_mouseX = event.mouse.x;
|
||||||
if (event.mouse.x <= 0) {
|
if (event.mouse.x <= 0) {
|
||||||
|
@ -127,6 +124,7 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
||||||
if (!lastMouseAtEdge || !_mouseAtEdge)
|
if (!lastMouseAtEdge || !_mouseAtEdge)
|
||||||
mouseHandler(1, _mouseX, _mouseY);
|
mouseHandler(1, _mouseX, _mouseY);
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_KEYDOWN:
|
case Common::EVENT_KEYDOWN:
|
||||||
|
@ -143,14 +141,15 @@ void LabEngine::WSDL_ProcessInput(bool can_delay) {
|
||||||
//saveSettings();
|
//saveSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: {
|
||||||
n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F)
|
int n = ((((unsigned int)((_nextKeyIn + 1) >> 31) >> 26) + (byte)_nextKeyIn + 1) & 0x3F)
|
||||||
- ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26);
|
- ((unsigned int)((_nextKeyIn + 1) >> 31) >> 26);
|
||||||
if (n != _nextKeyOut) {
|
if (n != _nextKeyOut) {
|
||||||
_keyBuf[_nextKeyIn] = event.kbd.keycode;
|
_keyBuf[_nextKeyIn] = event.kbd.keycode;
|
||||||
_nextKeyIn = n;
|
_nextKeyIn = n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_QUIT:
|
case Common::EVENT_QUIT:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue