Fix some of the GCC 4.6.1 compiler warnings with -Wall -Werror triggered by [-Werror=unused-but-set-variable].

This commit is contained in:
feb 2011-07-08 21:42:53 +00:00
parent d923dca483
commit c196f1809d
6 changed files with 5 additions and 19 deletions

View file

@ -145,7 +145,6 @@ static void SpellMoveToTarget(CUnit *unit)
*/
void HandleActionSpellCast(CUnit *unit)
{
int flags;
const SpellType *spell;
if (unit->Wait) {
@ -201,7 +200,7 @@ void HandleActionSpellCast(CUnit *unit)
case 2: // Cast spell on the target.
// FIXME: should use AnimateActionSpellCast here
if (unit->Type->Animations->Attack) {
flags = UnitShowAnimation(unit, unit->Type->Animations->Attack);
UnitShowAnimation(unit, unit->Type->Animations->Attack);
if (unit->Anim.Unbreakable) { // end of animation
return;
}

View file

@ -628,7 +628,7 @@ static void AiReduceMadeInBuilt(PlayerAi *pai, const CUnitType *type)
//
equivnb = AiFindUnitTypeEquiv(type, equivs);
for (size_t i = 0; i < AiHelpers.Equiv[type->Slot].size(); ++i)
for (size_t i = 0; i < (size_t)equivnb; ++i)
{
if (AiReduceMadeInBuilt2(pai, UnitTypes[equivs[i]]))
{

View file

@ -143,7 +143,6 @@ int AiFindUnitTypeEquiv(const CUnitType *unittype, int *result)
int AiFindAvailableUnitTypeEquiv(const CUnitType *unittype, int *usableTypes)
{
int usableTypesCount;
int playerid;
int bestlevel;
int curlevel;
@ -151,8 +150,6 @@ int AiFindAvailableUnitTypeEquiv(const CUnitType *unittype, int *usableTypes)
usableTypesCount = AiFindUnitTypeEquiv(unittype, usableTypes);
// 2 - Sort by level
playerid = AiPlayer->Player->Index;
// We won't have usableTypesCount>4, so simple sort should do it
for (int i = 0; i < usableTypesCount - 1; ++i)
{
@ -496,11 +493,11 @@ void AiAttackWithForce(int force)
aiunit->Wait = i;
if (aiunit->Type->CanAttack)
{
CommandAttack(aiunit, enemy->X, enemy->Y, NULL, FlushCommands);
CommandAttack(aiunit, x, y, NULL, FlushCommands);
}
else
{
CommandMove(aiunit, enemy->X, enemy->Y, FlushCommands);
CommandMove(aiunit, x, y, FlushCommands);
}
}
}

View file

@ -970,11 +970,10 @@ static int CclDefineAiPlayer(lua_State *l)
for (subk = 0; subk < subsubargs; ++subk)
{
int num;
const char *ident;
num = LuaToNumber(l, -1, subk + 1);
++subk;
ident = LuaToString(l, -1, subk + 1);
LuaToString(l, -1, subk + 1);
ai->Force[i].Units.push_back(UnitSlots[num]);
}
lua_pop(l, 1);

View file

@ -1559,7 +1559,6 @@ static void EditorCallbackMouse(int x, int y)
int bx, by;
static int LastMapX = 0;
static int LastMapY = 0;
enum _cursor_on_ OldCursorOn;
int cursorMapX, cursorMapY;
HandleCursorMove(&x, &y); // Reduce to screen
@ -1649,7 +1648,6 @@ static void EditorCallbackMouse(int x, int y)
return;
}
OldCursorOn = CursorOn;
MouseScrollState = ScrollNone;
GameCursor = UI.Point.Cursor;

View file

@ -252,11 +252,6 @@ static void InitGameCallbacks(void)
*/
void GameMainLoop(void)
{
#ifdef DEBUG // removes the setjmp warnings
static bool showtip;
#else
bool showtip;
#endif
int player;
const EventCallback *old_callbacks;
@ -271,8 +266,6 @@ void GameMainLoop(void)
CParticleManager::init();
showtip = false;
MultiPlayerReplayEachCycle();
CclCommand("GameStarting()");