=== modified file 'Rules.make.in' --- Rules.make.in 2010-08-10 09:35:43 +0000 +++ Rules.make.in 2010-09-10 15:30:29 +0000 @@ -21,7 +21,7 @@ PKGDATADIR=@PKGDATADIR@ -CPPFLAGS=@DEFS@ @CPPFLAGS@ -DUSE_ZLIB -I$(TOPDIR) -I$(TOPDIR)/src/include -I$(TOPDIR)/src/guichan/include -DSTRATAGUS_LIB_PATH="\"@PKGDATADIR@\"" +CPPFLAGS=@DEFS@ @CPPFLAGS@ -DUSE_ZLIB -I$(TOPDIR) -I$(TOPDIR)/src/include -I$(TOPDIR)/src/guichan/include -DSTRATAGUS_LIB_PATH="\"@PKGDATADIR@\"" -Wextra -Wno-long-long -pedantic CXXFLAGS=@CXXFLAGS@ LDFLAGS=@LDFLAGS@ -lpng -lz -lm === modified file 'src/action/action_attack.cpp' --- src/action/action_attack.cpp 2008-10-03 15:34:05 +0000 +++ src/action/action_attack.cpp 2010-09-10 15:54:31 +0000 @@ -146,15 +146,13 @@ } COrderPtr order = unit->CurrentOrder(); - int wall; // // No goal: if meeting enemy attack it. // - wall = 0; - if (!order->HasGoal() && + if (!order->HasGoal() && order->Action != UnitActionAttackGround && - !(wall = Map.WallOnMap(order->X, order->Y))) { + !Map.WallOnMap(order->X, order->Y)) { CUnit *goal = AttackUnitsInReactRange(unit); if (goal) { #ifdef DEBUG @@ -299,7 +297,7 @@ { Assert(unit); - Assert(unit->CurrentOrder()->HasGoal() || + Assert(unit->CurrentOrder()->HasGoal() || (unit->CurrentOrder()->X != -1 && unit->CurrentOrder()->Y != -1)); AnimateActionAttack(unit); === modified file 'src/action/action_spellcast.cpp' --- src/action/action_spellcast.cpp 2008-09-14 12:11:38 +0000 +++ src/action/action_spellcast.cpp 2010-09-10 15:54:55 +0000 @@ -143,14 +143,12 @@ */ void HandleActionSpellCast(CUnit *unit) { - int flags; - if (unit->Wait) { unit->Wait--; return; } COrderPtr order = unit->CurrentOrder(); - const SpellType *spell = order->Arg1.Spell; + const SpellType *spell = order->Arg1.Spell; switch (unit->SubAction) { case 0: // @@ -196,7 +194,7 @@ case 2: // Cast spell on the target. // FIXME: should use AnimateActionSpellCast here if (unit->Type->Animations->Attack && !spell->IsCasterOnly()) { - flags = UnitShowAnimation(unit, unit->Type->Animations->Attack); + UnitShowAnimation(unit, unit->Type->Animations->Attack); if (unit->Anim.Unbreakable) { // end of animation return; } === modified file 'src/ai/ai_building.cpp' --- src/ai/ai_building.cpp 2008-09-26 18:53:53 +0000 +++ src/ai/ai_building.cpp 2010-09-10 15:55:32 +0000 @@ -81,7 +81,7 @@ int dir; int obstacle; int y_offset; - + x0 = x - 1; y0 = y - 1; x1 = x0 + type->TileWidth + 1; @@ -98,17 +98,17 @@ (unsigned)y < (unsigned)Map.Info.MapHeight) { if (worker && x == worker->X && y == worker->Y) { surrounding[surroundingnb++] = 1; - } else if ( Map.CheckMask(x + y_offset, + } else if ( Map.CheckMask(x + y_offset, (MapFieldUnpassable | MapFieldWall | MapFieldRocks | MapFieldForest | MapFieldBuilding)) ) { surrounding[surroundingnb++] = 0; } else{ // Can pass there - surrounding[surroundingnb++] = Map.CheckMask(x + y_offset, - (MapFieldWaterAllowed + + surrounding[surroundingnb++] = Map.CheckMask(x + y_offset, + (MapFieldWaterAllowed + MapFieldCoastAllowed + MapFieldLandAllowed)); - + } } else { surrounding[surroundingnb++] = 0; @@ -197,10 +197,10 @@ backupy = y; } } - + size = Map.Info.MapWidth * Map.Info.MapHeight / 4; points = new p[size]; - + // // Make movement matrix. // @@ -319,8 +319,8 @@ */ static int AiFindHallPlace(const CUnit *worker, const CUnitType *type, - int nx, int ny, - int *dx, int *dy, + int nx, int ny, + int *dx, int *dy, int resource = GoldCost) { static const int xoffset[] = { 0, -1, +1, 0, -1, +1, -1, +1 }; @@ -344,11 +344,9 @@ unsigned char *morg; unsigned char *matrix; CUnit *mine; - int destx; - int desty; - destx = x = (nx != -1 ? nx : worker->X); - desty = y = (ny != -1 ? ny : worker->Y); + x = (nx != -1 ? nx : worker->X); + y = (ny != -1 ? ny : worker->Y); size = Map.Info.MapWidth * Map.Info.MapHeight / 4; points = new p[size]; @@ -401,7 +399,7 @@ // minx = mine->X - 5; miny = mine->Y - 5; - maxx = mine->X + mine->Type->TileWidth + 5; + maxx = mine->X + mine->Type->TileWidth + 5; maxy = mine->Y + mine->Type->TileHeight + 5; Map.FixSelectionArea(minx, miny, maxx, maxy); nunits = Map.SelectFixed(minx, miny, maxx, maxy, units); @@ -479,7 +477,7 @@ ** @todo FIXME: This is slow really slow, using two flood ** fills, is not a perfect solution. */ -static int AiFindLumberMillPlace(const CUnit *worker, const CUnitType *type, +static int AiFindLumberMillPlace(const CUnit *worker, const CUnitType *type, int nx,int ny, int *dx, int *dy) { static const int xoffset[] = { 0, -1, +1, 0, -1, +1, -1, +1 }; @@ -581,8 +579,8 @@ static int AiFindMiningPlace(const CUnit *worker, const CUnitType *type, - int nx, int ny, - int *dx, int *dy, + int nx, int ny, + int *dx, int *dy, int resource) { static const int xoffset[] = { 0, -1, +1, 0, -1, +1, -1, +1 }; @@ -606,11 +604,9 @@ unsigned char *morg; unsigned char *matrix; CUnit *mine; - int destx; - int desty; - destx = x = (nx != -1 ? nx : worker->X); - desty = y = (ny != -1 ? ny : worker->Y); + x = (nx != -1 ? nx : worker->X); + y = (ny != -1 ? ny : worker->Y); size = Map.Info.MapWidth * Map.Info.MapHeight / 4; points = new p[size]; @@ -701,13 +697,13 @@ ** @todo Better and faster way to find building place of oil ** platforms Special routines for special buildings. */ -int AiFindBuildingPlace(const CUnit *worker, const CUnitType *type, +int AiFindBuildingPlace(const CUnit *worker, const CUnitType *type, int nx, int ny, int *dx, int *dy) { // // Find a good place for a new hall // - DebugPrint("%d: Want to build a %s(%s)\n" _C_ AiPlayer->Player->Index + DebugPrint("%d: Want to build a %s(%s)\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str() _C_ type->Name.c_str()); //Mines and Depots @@ -728,14 +724,14 @@ return AiFindMiningPlace(worker, type, nx, ny, dx, dy, i); } else { //Mine can be build without resource restrictions: solar panels, etc - return AiFindBuildingPlace2(worker, type, + return AiFindBuildingPlace2(worker, type, (nx != -1 ? nx : worker->X), (ny != -1 ? ny : worker->Y), dx, dy); } } } - - return AiFindBuildingPlace2(worker, type, + + return AiFindBuildingPlace2(worker, type, (nx != -1 ? nx : worker->X), (ny != -1 ? ny : worker->Y), dx, dy); } === modified file 'src/ai/ai_force.cpp' --- src/ai/ai_force.cpp 2010-07-14 07:25:03 +0000 +++ src/ai/ai_force.cpp 2010-09-10 15:55:57 +0000 @@ -55,12 +55,12 @@ template struct AiForceEnemyFinder { const CUnit *enemy; - + inline bool found(void) { return enemy != NULL; } - - inline bool operator() (const CUnit *const unit) + + inline bool operator() (const CUnit *const unit) { if(IN_REACT_RANGE) { if (unit->Type->CanAttack) @@ -70,28 +70,28 @@ enemy = AttackUnitsInDistance(unit, MaxMapWidth); } return enemy == NULL; - } + } AiForceEnemyFinder(int force): enemy(NULL) { AiPlayer->Force[force].Units.for_each_if(*this); } - + AiForceEnemyFinder(AiForce *force): enemy(NULL) { force->Units.for_each_if(*this); } - + }; struct AiForceAttackSender { int goalX; int goalY; int delta; - + inline void operator() (CUnit *const unit) { // this may be problem if units are in bunker and we want sent // them to attack if (unit->Container == NULL) { - // To avoid lot of CPU consuption, send them with a small time difference. + // To avoid lot of CPU consuption, send them with a small time difference. unit->Wait = delta; ++delta; if (unit->Type->CanTransport() && unit->BoardCount > 0) { @@ -102,7 +102,7 @@ CommandMove(unit, goalX, goalY, FlushCommands); } } - } + } // // Send all units in the force to enemy at x,y. @@ -117,7 +117,7 @@ AiForceAttackSender(AiForce *force, int x, int y): goalX(x), goalY(y), delta(0) { - + DebugPrint("%d: Attacking with force #%lu\n" _C_ AiPlayer->Player->Index _C_ (long unsigned int)(force - &(AiPlayer->Force[0]))); force->Attacking = true; @@ -223,7 +223,6 @@ int i; int j; int tmp; - int playerid; int bestlevel; int curlevel; @@ -242,8 +241,6 @@ } // 3 - Sort by level - playerid = AiPlayer->Player->Index; - // We won't have usableTypesCount>4, so simple sort should do it for (i = 0; i < usableTypesCount - 1; ++i) { bestlevel = UnitTypes[usableTypes[i]]->Priority; @@ -268,7 +265,7 @@ struct AiForceCounter { unsigned int *data;//[UnitTypeMax + 1]; - + inline void operator() (CUnit *const unit) { data[UnitTypeEquivs[unit->Type->Slot]]++; } @@ -277,7 +274,7 @@ { memset(data, 0, len); units.for_each(*this); - } + } }; void AiForce::CountTypes(unsigned int *counter, const size_t len) { @@ -351,23 +348,23 @@ void AiForce::Attack(int goalX, int goalY) { Clean(); - + Attacking = false; if (Units.size() > 0) { Attacking = true; if(goalX == -1 || goalY == -1) { /* Search in entire map */ - const CUnit *enemy = AiForceEnemyFinder(this).enemy; + const CUnit *enemy = AiForceEnemyFinder(this).enemy; if (enemy) { goalX = enemy->X; goalY = enemy->Y; } } - + GoalX = goalX; GoalY = goalY; - + if(goalX == -1 || goalY == -1) { DebugPrint("%d: Need to plan an attack with transporter\n" _C_ AiPlayer->Player->Index); if (State == AI_FORCE_STATE_WAITING && !PlanAttack()) { @@ -382,7 +379,7 @@ // AiForceAttackSender(this, goalX, goalY); } - + } AiForceManager::AiForceManager() { @@ -432,7 +429,7 @@ // No troops for attacking force if (force->IsAttacking()) { continue; - } + } if (unit->GroupId == 0 && force->IsBelongsTo(unit->Type)) { force->Insert(unit); unit->GroupId = i + 1; @@ -447,9 +444,9 @@ int attacking[UnitTypeMax]; unsigned int i,j; const int *unit_types_count = AiPlayer->Player->UnitTypesCount; - + memset(attacking, 0, sizeof(attacking)); - + // // Look through the forces what is missing. // @@ -560,7 +557,7 @@ DebugPrint("Force out of range: %d" _C_ force); return ; } - + if (!Map.Info.IsPointOnMap(x,y)) { DebugPrint("(%d, %d) not in the map(%d, %d)" _C_ x _C_ y _C_ Map.Info.MapWidth _C_ Map.Info.MapHeight); @@ -602,7 +599,7 @@ if (!AiPlayer->Force[force].Defending) { found = true; - + //Fixme: this is triky but should work AiPlayer->Force[f].Role = AiPlayer->Force[force].Role; @@ -711,9 +708,9 @@ Attacking = false; if (!Defending && State > 0) { DebugPrint("%d: Attack force #%lu was destroyed, giving up\n" - _C_ AiPlayer->Player->Index _C_ (long unsigned int)(this - &(AiPlayer->Force[0]))); + _C_ AiPlayer->Player->Index _C_ (long unsigned int)(this - &(AiPlayer->Force[0]))); Reset(true); - } + } return; } @@ -728,7 +725,7 @@ if (Attacking == false) { if (!Defending && State > 0) { DebugPrint("%d: Attack force #%lu has lost all agresive units, giving up\n" - _C_ AiPlayer->Player->Index _C_ (long unsigned int)(this - &(AiPlayer->Force[0]))); + _C_ AiPlayer->Player->Index _C_ (long unsigned int)(this - &(AiPlayer->Force[0]))); Reset(true); } return ; @@ -869,14 +866,14 @@ AiForce *force = &forces[f]; // // Look if our defenders still have enemies in range. - // + // if (force->Defending) { force->Clean(); // // Look if still enemies in attack range. // if(!AiForceEnemyFinder(force).found()) { - DebugPrint("%d:FIXME: not written, should send force #%d home\n" + DebugPrint("%d:FIXME: not written, should send force #%d home\n" _C_ AiPlayer->Player->Index _C_ f); force->Defending = false; force->Attacking = false; === modified file 'src/ai/ai_local.h' --- src/ai/ai_local.h 2009-05-30 12:59:42 +0000 +++ src/ai/ai_local.h 2010-09-10 15:50:11 +0000 @@ -98,7 +98,7 @@ */ enum AiForceRole { AiForceRoleAttack = 0, /// Force should attack - AiForceRoleDefend, /// Force should defend + AiForceRoleDefend /// Force should defend }; #define AI_FORCE_STATE_FREE -1 === modified file 'src/ai/ai_magic.cpp' --- src/ai/ai_magic.cpp 2005-09-19 23:36:44 +0000 +++ src/ai/ai_magic.cpp 2010-09-10 15:56:26 +0000 @@ -62,9 +62,6 @@ CUnit **units; CUnit *unit; const CPlayer *player; -#ifdef DEBUG - int success; -#endif n = AiPlayer->Player->TotalNumUnits; units = AiPlayer->Player->Units; @@ -77,9 +74,6 @@ // Check if we can cast this spell. SpellIsAvailable checks for upgrades. if (unit->Type->CanCastSpell[j] && SpellIsAvailable(player, j) && (SpellTypeTable[j]->AutoCast || SpellTypeTable[j]->AICast)) { -#ifdef DEBUG - success = // Follow on next line (AutoCastSpell). -#endif AutoCastSpell(unit, SpellTypeTable[j]); } } === modified file 'src/ai/ai_resource.cpp' --- src/ai/ai_resource.cpp 2009-05-30 12:45:16 +0000 +++ src/ai/ai_resource.cpp 2010-09-10 15:57:29 +0000 @@ -191,7 +191,7 @@ ** ** @return Number of enemy units. */ -int AiEnemyUnitsInDistance(const CPlayer *player, +int AiEnemyUnitsInDistance(const CPlayer *player, const CUnitType *type, int x, int y, unsigned range) { const CUnit *dest; @@ -203,7 +203,7 @@ // // Select all units in range. // - n = Map.Select(x - range, y - range, + n = Map.Select(x - range, y - range, x + range + (type ? type->TileWidth :0), y + range + (type ? type->TileHeight:0), table); @@ -297,19 +297,19 @@ // No workers available to build return 0; } - + if(num == 1) { unit = table[0]; } else { // Try one worker at random to save cpu unit = table[SyncRand() % num]; } - + // Find a place to build. if (AiFindBuildingPlace(unit, building, near_x, near_y, &x, &y)) { CommandBuildBuilding(unit, x, y, building, FlushCommands); return 1; - } + } else //when first worker can't build then rest also won't be able (save CPU) if (near_x != -1 && near_y != -1) { @@ -326,13 +326,13 @@ return 0; } -static bool +static bool AiRequestedTypeAllowed(const CPlayer *player, const CUnitType *type) { const int size = AiHelpers.Build[type->Slot].size(); for(int i = 0; iSlot][i]; - if(player->UnitTypesCount[builder->Slot] > 0 && + if(player->UnitTypesCount[builder->Slot] > 0 && CheckDependByType(player, type)) { return true; @@ -353,12 +353,12 @@ int s0 = ((struct cnode*)t0)->unit_cost; int s1 = ((struct cnode*)t1)->unit_cost; if(s0 == s1) { - return 0; + return 0; } return s0 < s1 ? -1 : 1; } -int +int AiGetBuildRequestsCount(PlayerAi *pai, int counter[UnitTypeMax]) { const int size = (int)pai->UnitTypeBuilt.size(); @@ -370,18 +370,18 @@ return size; } -extern CUnit *FindDepositNearLoc(CPlayer *p, +extern CUnit *FindDepositNearLoc(CPlayer *p, int x, int y, int range, int resource); void AiNewDepotRequest(CUnit *worker) { /* - DebugPrint("%d: Worker %d report: Resource [%d] too far from depot, returning time [%d].\n" - _C_ worker->Player->Index _C_ worker->Slot + DebugPrint("%d: Worker %d report: Resource [%d] too far from depot, returning time [%d].\n" + _C_ worker->Player->Index _C_ worker->Slot _C_ worker->CurrentResource _C_ worker->Data.Move.Cycles ); - */ + */ int i; int n; int c; @@ -389,13 +389,13 @@ CUnitType *best_type = NULL; int cost, best_cost = 0; //int best_mask = 0, needmask; - + int PosX = -1; int PosY = -1; - - ResourceInfo *resinfo = - worker->Type->ResInfo[worker->CurrentResource]; - + + ResourceInfo *resinfo = + worker->Type->ResInfo[worker->CurrentResource]; + if(resinfo->TerrainHarvester) { PosX = worker->CurrentOrder()->Arg1.Resource.Pos.X; PosY = worker->CurrentOrder()->Arg1.Resource.Pos.Y; @@ -405,18 +405,18 @@ PosX = mine->X; PosY = mine->Y; } - } - - - if (PosX != -1 && NULL != FindDepositNearLoc(worker->Player, + } + + + if (PosX != -1 && NULL != FindDepositNearLoc(worker->Player, PosX, PosY, 10, worker->CurrentResource)) { - /* - * New Depot has just be finished and worker just return to old depot + /* + * New Depot has just be finished and worker just return to old depot * (far away) from new Deopt. */ - return; + return; } - + int counter[UnitTypeMax]; // // Count the already made build requests. @@ -427,36 +427,36 @@ for (i = 0; i < n; ++i) { type = AiHelpers.Depots[worker->CurrentResource - 1][i]; - + if (counter[type->Slot]) { // Already ordered. return; - } + } if (!AiRequestedTypeAllowed(worker->Player, type)) { continue; } - + // // Check if resources available. // //needmask = AiCheckUnitTypeCosts(type); - + cost = 0; for (c = 1; c < MaxCosts; ++c) { cost += type->Stats[worker->Player->Index].Costs[c]; } - + if(best_type == NULL || (cost < best_cost)) { best_type = type; best_cost = cost; //best_mask = needmask; } - + } - + if(best_type) { //if(!best_mask) { - + AiBuildQueue queue; queue.Type = best_type; @@ -466,9 +466,9 @@ queue.Y = PosY; worker->Player->Ai->UnitTypeBuilt.push_back(queue); - - DebugPrint("%d: Worker %d report: Requesting new depot near [%d,%d].\n" - _C_ worker->Player->Index _C_ worker->Slot + + DebugPrint("%d: Worker %d report: Requesting new depot near [%d,%d].\n" + _C_ worker->Player->Index _C_ worker->Slot _C_ queue.X _C_ queue.Y ); @@ -478,7 +478,7 @@ } */ } - + } /** @@ -501,14 +501,14 @@ return true; } int counter[UnitTypeMax]; - + // // Count the already made build requests. // AiGetBuildRequestsCount(AiPlayer, counter); struct cnode cache[16]; int j; - + memset(cache, 0, sizeof(cache)); // @@ -525,12 +525,12 @@ _C_ AiPlayer->Player->Index _C_ type->Name.c_str()); #endif return false; - } + } if (!AiRequestedTypeAllowed(AiPlayer->Player, type)) { continue; } - + // // Check if resources available. // @@ -547,7 +547,7 @@ if(j > 1) qsort(&cache, j, sizeof(struct cnode), cnode_cmp); - + if(j) { if(!cache[0].needmask) { type = cache[0].type; @@ -567,7 +567,7 @@ } AiPlayer->NeededMask |= cache[0].needmask; } - + #if defined( DEBUG) && defined( DebugRequestSupply ) std::string needed(""); @@ -659,7 +659,7 @@ const std::vector *table; if (UnitIdAllowed(AiPlayer->Player, type->Slot) == 0) { - DebugPrint("%d: Can't build `%s' now\n" _C_ AiPlayer->Player->Index + DebugPrint("%d: Can't build `%s' now\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return 0; } @@ -674,13 +674,13 @@ tablep = &AiHelpers.Train; } if (type->Slot > n) { // Oops not known. - DebugPrint("%d: AiCountUnitBuilders I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index + DebugPrint("%d: AiCountUnitBuilders I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return 0; } table = &(*tablep)[type->Slot]; if (!table->size()) { // Oops not known. - DebugPrint("%d: AiCountUnitBuilders II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index + DebugPrint("%d: AiCountUnitBuilders II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return 0; } @@ -736,13 +736,13 @@ tablep = &AiHelpers.Train; } if (type->Slot > n) { // Oops not known. - DebugPrint("%d: AiMakeUnit I: Nothing known about `%s'\n" + DebugPrint("%d: AiMakeUnit I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); continue; } table = &(*tablep)[type->Slot]; if (!table->size()) { // Oops not known. - DebugPrint("%d: AiMakeUnit II: Nothing known about `%s'\n" + DebugPrint("%d: AiMakeUnit II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); continue; } @@ -837,13 +837,13 @@ tablep = &AiHelpers.Research; if (upgrade->ID > n) { // Oops not known. - DebugPrint("%d: AiAddResearchRequest I: Nothing known about `%s'\n" + DebugPrint("%d: AiAddResearchRequest I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ upgrade->Ident.c_str()); return; } table = &(*tablep)[upgrade->ID]; if (!table->size()) { // Oops not known. - DebugPrint("%d: AiAddResearchRequest II: Nothing known about `%s'\n" + DebugPrint("%d: AiAddResearchRequest II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ upgrade->Ident.c_str()); return; } @@ -932,13 +932,13 @@ tablep = &AiHelpers.Upgrade; if (type->Slot > n) { // Oops not known. - DebugPrint("%d: AiAddUpgradeToRequest I: Nothing known about `%s'\n" + DebugPrint("%d: AiAddUpgradeToRequest I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return; } table = &(*tablep)[type->Slot]; if (!table->size()) { // Oops not known. - DebugPrint("%d: AiAddUpgradeToRequest II: Nothing known about `%s'\n" + DebugPrint("%d: AiAddUpgradeToRequest II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return; } @@ -1053,7 +1053,7 @@ if (resinfo->TerrainHarvester) { // These will hold the coordinates of the forest. int forestx, foresty; - + // // Code for terrain harvesters. Search for piece of terrain to mine. // @@ -1073,10 +1073,10 @@ unit->X, unit->Y, 1000, resource, true); if (dest) { - //FIXME: rb - when workers can speedup building then such assign may be ok. + //FIXME: rb - when workers can speedup building then such assign may be ok. //if(dest->CurrentAction() == UnitActionBuilt) //CommandBuildBuilding(unit, dest->X, dest->Y, dest->Type, FlushCommands); - //else + //else CommandResource(unit, dest, FlushCommands); return 1; } @@ -1086,7 +1086,7 @@ (dest = UnitFindMiningArea(unit, unit->X, unit->Y, 1000, resource))) { int needmask; //int counter[UnitTypeMax]; - + // // Count the already made build requests. // @@ -1096,16 +1096,16 @@ CUnitType *type = AiHelpers.Refinery[resource - 1][i]; //if (counter[type->Slot]) { // Already ordered. // return 0; - //} + //} if (!AiRequestedTypeAllowed(AiPlayer->Player, type)) { continue; } - + // // Check if resources available. // - needmask = AiCheckUnitTypeCosts(type); + needmask = AiCheckUnitTypeCosts(type); if(!needmask && AiMakeUnit(type)) { AiBuildQueue newqueue; newqueue.Type = type; @@ -1117,9 +1117,9 @@ AiPlayer->UnitTypeBuilt.begin(), newqueue); return 0; } - + } - + return 0; } #endif @@ -1153,7 +1153,7 @@ static int CmpWorkers(const void *w0,const void *w1) { const CUnit*const worker0 = (const CUnit*const)w0; const CUnit*const worker1 = (const CUnit*const)w1; - + return worker0->ResourcesHeld < worker1->ResourcesHeld ? 1 : -1; } @@ -1171,7 +1171,6 @@ int num_units_with_resource[MaxCosts]; int num_units_assigned[MaxCosts]; int num_units_unassigned[MaxCosts]; - int total; // Total of workers int c; int src_c; int i; @@ -1191,7 +1190,7 @@ memset(num_units_with_resource, 0, sizeof(num_units_with_resource)); memset(num_units_unassigned, 0, sizeof(num_units_unassigned)); memset(num_units_assigned, 0, sizeof(num_units_assigned)); - + // // Collect statistics about the current assignment // @@ -1210,7 +1209,7 @@ // // See if it's assigned already // - if (c && unit->OrderCount == 1 && + if (c && unit->OrderCount == 1 && unit->CurrentAction() == UnitActionResource) { units_assigned[c][num_units_assigned[c]++] = unit; total_harvester++; @@ -1247,16 +1246,13 @@ if(!total_harvester) { return; - } + } memset(wanted, 0, sizeof(wanted)); - + percent_total = 100; - total = 0; for (c = 1; c < MaxCosts; ++c) { percent[c] = AiPlayer->Collect[c]; - //FIXME: rb- where is total used? - total += num_units_assigned[c] + num_units_with_resource[c]; if ((AiPlayer->NeededMask & (1 << c))) { // Double percent if needed percent_total += percent[c]; percent[c] <<= 1; @@ -1268,12 +1264,12 @@ // for (c = 1; c < MaxCosts; ++c ) { if(percent[c]) { - // Wanted needs to be representative. + // Wanted needs to be representative. if (total_harvester < 5) { wanted[c] = 1 + (percent[c] * 5) / percent_total; } else { wanted[c] = 1 + (percent[c] * total_harvester) / percent_total; - } + } } } @@ -1283,13 +1279,13 @@ for (c = 0; c < MaxCosts; ++c) { priority_resource[c] = c; priority_needed[c] = wanted[c] - num_units_assigned[c] - num_units_with_resource[c]; - + if (c && num_units_assigned[c] > 1) { //first should go workers with lower ResourcesHeld value qsort(units_assigned[c], num_units_assigned[c], sizeof(CUnit*), CmpWorkers); - } - + } + } do { // @@ -1530,13 +1526,13 @@ tablep = &AiHelpers.Repair; type = unit->Type; if (type->Slot > n) { // Oops not known. - DebugPrint("%d: AiRepairUnit I: Nothing known about `%s'\n" + DebugPrint("%d: AiRepairUnit I: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return 0; } table = &(*tablep)[type->Slot]; if (!table->size()) { // Oops not known. - DebugPrint("%d: AiRepairUnit II: Nothing known about `%s'\n" + DebugPrint("%d: AiRepairUnit II: Nothing known about `%s'\n" _C_ AiPlayer->Player->Index _C_ type->Ident.c_str()); return 0; } === modified file 'src/editor/editloop.cpp' --- src/editor/editloop.cpp 2009-06-10 15:59:30 +0000 +++ src/editor/editloop.cpp 2010-09-10 15:50:11 +0000 @@ -108,7 +108,7 @@ enum EditorActionType { EditorActionTypePlaceUnit, - EditorActionTypeRemoveUnit, + EditorActionTypeRemoveUnit }; struct EditorAction @@ -651,7 +651,7 @@ } } -extern void DrawPopupUnitInfo(const CUnitType *type, +extern void DrawPopupUnitInfo(const CUnitType *type, int player_index, CFont *font, Uint32 backgroundColor, int buttonX, int buttonY); @@ -659,8 +659,8 @@ if (Editor.State == EditorEditUnit && Editor.CursorUnitIndex != -1) { std::string nc, rc; GetDefaultTextColors(nc, rc); - DrawPopupUnitInfo(Editor.ShownUnitTypes[Editor.CursorUnitIndex], - Editor.SelectedPlayer, SmallFont, + DrawPopupUnitInfo(Editor.ShownUnitTypes[Editor.CursorUnitIndex], + Editor.SelectedPlayer, SmallFont, Video.MapRGB(TheScreen->format, 38, 38, 78), Editor.PopUpX, Editor.PopUpY); SetDefaultTextColors(nc, rc); @@ -709,7 +709,7 @@ Video.DrawRectangleClip(ColorWhite, x - 1, y - 1, icon->G->Width + 2, icon->G->Height + 2); Editor.PopUpX = x; - Editor.PopUpY = y; + Editor.PopUpY = y; } x += IconWidth + 8; @@ -823,10 +823,10 @@ TileSizeX-2, TileSizeY-2); } if (i == Editor.CursorTileIndex) { - Video.DrawRectangleClip(ColorWhite, x - 1, y - 1, + Video.DrawRectangleClip(ColorWhite, x - 1, y - 1, TileSizeX+2, TileSizeY+2); Editor.PopUpX = x; - Editor.PopUpY = y; + Editor.PopUpY = y; } x += TileSizeX + 8; @@ -1271,7 +1271,7 @@ editorUnitSlider->setVisible(false); if (VisibleTileIcons < (int)Editor.ShownTileTypes.size()) { editorSlider->setVisible(true); - } + } return; case StartButton: Editor.State = EditorSetStartLocation; @@ -1352,7 +1352,7 @@ // Click on map area // if (CursorOn == CursorOnMap) { - + if (MouseButtons & RightButton) { if (Editor.State == EditorEditUnit && Editor.SelectedUnitIndex != -1) { @@ -1365,8 +1365,8 @@ CursorBuilding = NULL; return; } - } - + } + CViewport *vp = GetViewport(CursorX, CursorY); Assert(vp); if ((MouseButtons & LeftButton) && UI.SelectedViewport != vp) { @@ -1376,11 +1376,11 @@ if (MouseButtons & LeftButton) { int tileX = UI.MouseViewport->Viewport2MapX(CursorX); - int tileY = UI.MouseViewport->Viewport2MapY(CursorY); + int tileY = UI.MouseViewport->Viewport2MapY(CursorY); if (Editor.State == EditorEditTile && Editor.SelectedTileIndex != -1) { - EditTiles(tileX, tileY, + EditTiles(tileX, tileY, Editor.ShownTileTypes[Editor.SelectedTileIndex], TileCursorSize); } else if (Editor.State == EditorEditUnit) { @@ -1827,8 +1827,8 @@ } ++i; by += 20; - } - + } + i = Editor.TileIndex; by = UI.ButtonPanel.Y + 24; while (by < UI.ButtonPanel.Y + ButtonPanelHeight - TileSizeY) { @@ -1891,10 +1891,10 @@ return; } } - - int StartUnitWidth = Editor.StartUnit ? + + int StartUnitWidth = Editor.StartUnit ? Editor.StartUnit->Icon.Icon->G->Width : TileSizeX + 7; - int StartUnitHeight = Editor.StartUnit ? + int StartUnitHeight = Editor.StartUnit ? Editor.StartUnit->Icon.Icon->G->Height : TileSizeY + 7; if (UI.InfoPanel.X + 4 + START_ICON_X < CursorX && CursorX < UI.InfoPanel.X + 4 + START_ICON_X + StartUnitWidth && @@ -1983,9 +1983,9 @@ for(int i = 0; 0x10 + i < Map.Tileset.NumTiles; i+=16) { TileInfo *info = &Map.Tileset.Tiles[0x10 + i]; if (info->BaseTerrain && !info->MixTerrain) { - Editor.ShownTileTypes.push_back(0x10 + i); + Editor.ShownTileTypes.push_back(0x10 + i); } - } + } } /** @@ -2088,7 +2088,7 @@ CreateTileIcons(); VisibleTileIcons = CalculateVisibleIcons(true); - + RecalculateShownUnits(); EditorUndoActions.clear(); @@ -2181,7 +2181,7 @@ editorUnitSlider->setSize(ButtonPanelWidth/*176*/, 16); editorSlider->setSize(ButtonPanelWidth/*176*/, 16); editorContainer->add(editorUnitSlider, UI.ButtonPanel.X + 2, UI.ButtonPanel.Y + 4); - editorContainer->add(editorSlider, UI.ButtonPanel.X + 2, UI.ButtonPanel.Y + 4); + editorContainer->add(editorSlider, UI.ButtonPanel.X + 2, UI.ButtonPanel.Y + 4); } //ProcessMenu("menu-editor-tips", 1); InterfaceState = IfaceStateNormal; === modified file 'src/include/actions.h' --- src/include/actions.h 2008-10-03 15:34:05 +0000 +++ src/include/actions.h 2010-09-10 15:46:32 +0000 @@ -44,7 +44,7 @@ DiplomacyAllied, /// Ally with opponent DiplomacyNeutral, /// Don't attack be neutral DiplomacyEnemy, /// Attack opponent - DiplomacyCrazy, /// Ally and attack opponent + DiplomacyCrazy /// Ally and attack opponent }; /// Diplomacy states for CommandDiplomacy class CUnit; === modified file 'src/include/animation.h' --- src/include/animation.h 2010-07-10 12:24:11 +0000 +++ src/include/animation.h 2010-09-10 15:46:31 +0000 @@ -55,7 +55,7 @@ AnimationUnbreakable, AnimationLabel, AnimationGoto, - AnimationRandomGoto, + AnimationRandomGoto }; class CAnimation { @@ -141,7 +141,7 @@ delete[] Harvest[i]; } } - + CAnimation *Start; CAnimation *Still; CAnimation *Death; === modified file 'src/include/construct.h' --- src/include/construct.h 2006-11-19 05:12:40 +0000 +++ src/include/construct.h 2010-09-10 15:49:46 +0000 @@ -106,7 +106,7 @@ enum ConstructionFileType { ConstructionFileConstruction, - ConstructionFileMain, + ConstructionFileMain }; /// Construction frame === modified file 'src/include/cursor.h' --- src/include/cursor.h 2008-08-30 17:17:17 +0000 +++ src/include/cursor.h 2010-09-10 15:50:11 +0000 @@ -156,7 +156,7 @@ CursorStatePoint, /// Normal cursor CursorStateSelect, /// Select position CursorStateRectangle, /// Rectangle selecting - CursorStatePieMenu, /// Displaying Pie Menu + CursorStatePieMenu /// Displaying Pie Menu }; /*---------------------------------------------------------------------------- === modified file 'src/include/depend.h' --- src/include/depend.h 2008-08-20 22:45:02 +0000 +++ src/include/depend.h 2010-09-10 15:50:11 +0000 @@ -101,7 +101,7 @@ enum { DependRuleUnitType, /// Kind is an unit-type - DependRuleUpgrade, /// Kind is an upgrade + DependRuleUpgrade /// Kind is an upgrade }; /// Dependency rule === modified file 'src/include/editor.h' --- src/include/editor.h 2008-09-06 10:46:21 +0000 +++ src/include/editor.h 2010-09-10 15:48:52 +0000 @@ -48,7 +48,7 @@ EditorNotRunning = 0, /// Not Running EditorStarted = 1, /// Editor Enabled at all EditorCommandLine = 2, /// Called from Command Line - EditorEditing = 4, /// Editor is fully running + EditorEditing = 4 /// Editor is fully running }; enum EditorStateType { @@ -62,7 +62,7 @@ public: CEditor() : TerrainEditable(true), StartUnit(NULL), - UnitIndex(0), CursorUnitIndex(-1), SelectedUnitIndex(-1), + UnitIndex(0), CursorUnitIndex(-1), SelectedUnitIndex(-1), TileIndex(0), CursorTileIndex(-1), SelectedTileIndex(-1), CursorPlayer(-1), SelectedPlayer(PlayerNumNeutral), MapLoaded(false), WriteCompressedMaps(true), PopUpX(-1), PopUpY(-1) @@ -91,7 +91,7 @@ int TileIndex; /// tile icon draw index. int CursorTileIndex; /// tile icon under cursor. int SelectedTileIndex; /// tile type to draw. - + int CursorPlayer; /// Player under the cursor. int SelectedPlayer; /// Player selected for draw. @@ -101,10 +101,10 @@ EditorRunningType Running; /// Editor is running EditorStateType State; /// Current editor state - + int PopUpX; int PopUpY; - + }; /*---------------------------------------------------------------------------- === modified file 'src/include/interface.h' --- src/include/interface.h 2008-09-28 21:15:52 +0000 +++ src/include/interface.h 2010-09-10 15:48:41 +0000 @@ -75,7 +75,7 @@ ButtonCancel, /// cancel ButtonCancelUpgrade, /// cancel upgrade ButtonCancelTrain, /// cancel training - ButtonCancelBuild, /// cancel building + ButtonCancelBuild /// cancel building }; class ButtonAction; @@ -109,20 +109,20 @@ ButtonAreaResearching, /// Researching button ButtonAreaTransporting, /// Transporting button ButtonAreaButton, /// Button panel button - ButtonAreaMenu, /// Menu button + ButtonAreaMenu /// Menu button }; /// Menu button under cursor enum _menu_button_under_ { ButtonUnderMenu, /// Menu button ButtonUnderNetworkMenu, /// Network menu button - ButtonUnderNetworkDiplomacy, /// Diplomacy button + ButtonUnderNetworkDiplomacy /// Diplomacy button }; /// current interface state enum _iface_state_ { IfaceStateNormal, /// Normal Game state - IfaceStateMenu, /// Menu active + IfaceStateMenu /// Menu active }; /// current key state @@ -168,7 +168,7 @@ CursorOnScrollLeftUp, /// in scroll left+up area CursorOnScrollLeftDown, /// in scroll left+down area CursorOnScrollRightUp, /// in scroll right+up area - CursorOnScrollRightDown, /// in scroll right+down area + CursorOnScrollRightDown /// in scroll right+down area }; /// Are We Scrolling With the Keyboard ? === modified file 'src/include/iolib.h' --- src/include/iolib.h 2008-08-20 22:45:02 +0000 +++ src/include/iolib.h 2010-09-10 15:48:29 +0000 @@ -56,7 +56,7 @@ /** ** Exception thrown by FileWriter objects. **/ -class FileException +class FileException { }; @@ -131,7 +131,7 @@ CLF_TYPE_INVALID, /// invalid file handle CLF_TYPE_PLAIN, /// plain text file handle CLF_TYPE_GZIP, /// gzip file handle - CLF_TYPE_BZIP2, /// bzip2 file handle + CLF_TYPE_BZIP2 /// bzip2 file handle }; #define CL_OPEN_READ 0x1 === modified file 'src/include/netconnect.h' --- src/include/netconnect.h 2010-08-03 13:49:33 +0000 +++ src/include/netconnect.h 2010-09-10 15:48:17 +0000 @@ -172,7 +172,7 @@ ICMGo, /// Client is ready to run ICMAYT, /// Server asks are you there - ICMIAH, /// Client answers I am here + ICMIAH /// Client answers I am here }; /** @@ -196,7 +196,7 @@ ccs_goahead, /// Server wants to start game ccs_started, /// Server has started game ccs_incompatibleengine, /// Incompatible engine version - ccs_incompatiblenetwork, /// Incompatible netowrk version + ccs_incompatiblenetwork /// Incompatible netowrk version }; /*---------------------------------------------------------------------------- === modified file 'src/include/network.h' --- src/include/network.h 2009-06-07 15:24:47 +0000 +++ src/include/network.h 2010-09-10 15:48:17 +0000 @@ -109,7 +109,7 @@ */ enum _extended_message_type_ { ExtendedMessageDiplomacy, /// Change diplomacy - ExtendedMessageSharedVision, /// Change shared vision + ExtendedMessageSharedVision /// Change shared vision }; /** === modified file 'src/include/pathfinder.h' --- src/include/pathfinder.h 2010-06-20 08:03:41 +0000 +++ src/include/pathfinder.h 2010-09-10 15:48:07 +0000 @@ -65,7 +65,7 @@ PF_UNREACHABLE = -2, /// Unreachable stop PF_REACHED = -1, /// Reached goal stop PF_WAIT = 0, /// Wait, no time or blocked - PF_MOVE = 1, /// On the way moving + PF_MOVE = 1 /// On the way moving }; /** === modified file 'src/include/player.h' --- src/include/player.h 2009-06-12 20:18:42 +0000 +++ src/include/player.h 2010-09-10 15:48:00 +0000 @@ -441,7 +441,7 @@ enum PlayerRacesOld { PlayerRaceHuman = 0, /// belongs to human - PlayerRaceOrc = 1, /// belongs to orc + PlayerRaceOrc = 1 /// belongs to orc }; /** @@ -488,7 +488,7 @@ PlayerComputer = 4, /// computer player PlayerPerson = 5, /// human player PlayerRescuePassive = 6, /// rescued passive - PlayerRescueActive = 7, /// rescued active + PlayerRescueActive = 7 /// rescued active }; #define PlayerNumNeutral (PlayerMax - 1) /// this is the neutral player slot @@ -499,7 +499,7 @@ enum NotifyType { NotifyRed, /// Red alram NotifyYellow, /// Yellow alarm - NotifyGreen, /// Green alarm + NotifyGreen /// Green alarm }; /*---------------------------------------------------------------------------- === modified file 'src/include/replay.h' --- src/include/replay.h 2009-05-30 13:01:25 +0000 +++ src/include/replay.h 2010-09-10 15:48:17 +0000 @@ -44,7 +44,7 @@ enum ReplayType { ReplayNone, /// No replay ReplaySinglePlayer, /// Single player replay - ReplayMultiPlayer, /// Multi player replay + ReplayMultiPlayer /// Multi player replay }; /// Replay types class CFile; === modified file 'src/include/script.h' --- src/include/script.h 2009-06-17 17:45:12 +0000 +++ src/include/script.h 2010-09-10 15:48:17 +0000 @@ -62,7 +62,7 @@ enum { LuaUnitType = 100, - LuaSoundType, + LuaSoundType }; extern lua_State *Lua; @@ -156,7 +156,7 @@ UnitRefInside, /// unit->Inside. UnitRefContainer, /// Unit->Container. UnitRefWorker, /// unit->Data.Built.Worker - UnitRefGoal, /// unit->Goal + UnitRefGoal /// unit->Goal } EnumUnit; === modified file 'src/include/settings.h' --- src/include/settings.h 2009-06-07 15:24:47 +0000 +++ src/include/settings.h 2010-09-10 15:47:35 +0000 @@ -98,7 +98,7 @@ SettingsGameTypeTopVsBottom, SettingsGameTypeLeftVsRight, SettingsGameTypeManVsMachine, - SettingsGameTypeManTeamVsMachine, + SettingsGameTypeManTeamVsMachine // Future game type ideas #if 0 @@ -108,7 +108,7 @@ SettingsGameTypeSlaughter, SettingsGameTypeSuddenDeath, SettingsGameTypeTeamMelee, - SettingsGameTypeTeamCaptureTheFlag, + SettingsGameTypeTeamCaptureTheFlag #endif }; === modified file 'src/include/sound_server.h' --- src/include/sound_server.h 2008-08-20 22:45:02 +0000 +++ src/include/sound_server.h 2010-09-10 15:48:17 +0000 @@ -69,7 +69,7 @@ PlayAudioStream = 1, /// Stream the file from medium PlayAudioPreLoad = 2, /// Load compressed in memory PlayAudioLoadInMemory = 4, /// Preload file into memory - PlayAudioLoadOnDemand = 8, /// Load only if needed. + PlayAudioLoadOnDemand = 8 /// Load only if needed. }; /*---------------------------------------------------------------------------- === modified file 'src/include/tileset.h' --- src/include/tileset.h 2008-08-20 22:45:02 +0000 +++ src/include/tileset.h 2010-09-10 15:48:17 +0000 @@ -220,7 +220,7 @@ TileTypeCoast, /// Any coast tile TileTypeHumanWall, /// Any human wall tile TileTypeOrcWall, /// Any orc wall tile - TileTypeWater, /// Any water tile + TileTypeWater /// Any water tile }; /// Single tile definition @@ -307,7 +307,7 @@ unsigned HumanWallTable[16]; /// Human wall placement table unsigned OrcWallTable[16]; /// Orc wall placement table - + bool IsSeenTile(unsigned short type, unsigned short seen) const { if(TileTypeTable) { @@ -322,7 +322,7 @@ } return false; }; - + }; /*---------------------------------------------------------------------------- === modified file 'src/include/title.h' --- src/include/title.h 2009-05-30 13:01:25 +0000 +++ src/include/title.h 2010-09-10 15:47:19 +0000 @@ -37,7 +37,7 @@ class CFont; enum { - TitleFlagCenter = 1 << 0, /// Center Text + TitleFlagCenter = 1 << 0 /// Center Text }; class TitleScreenLabel { === modified file 'src/include/ui.h' --- src/include/ui.h 2008-09-26 18:53:53 +0000 +++ src/include/ui.h 2010-09-10 15:47:19 +0000 @@ -79,7 +79,7 @@ TextAlignUndefined, TextAlignCenter, TextAlignLeft, - TextAlignRight, + TextAlignRight }; class ButtonStyleProperties { @@ -101,7 +101,7 @@ int TextY; /// Text Y location std::string TextNormalColor; /// Normal text color std::string TextReverseColor; /// Reverse text color -} ; +}; class ButtonStyle { public: @@ -168,7 +168,7 @@ OffsetX(0), OffsetY(0), MapWidth(0), MapHeight(0), Unit(NULL), Proxy(NULL) {} ~CViewport(); - + /// Check if X and Y pixels are within map area bool IsInsideMapArea(int x, int y) const; @@ -429,9 +429,9 @@ struct bits_map { bits_map() : Width(0), Height(0), bstore(NULL) {} ~bits_map(); - + void Init(CGraphic *g); - + bool TransparentPixel(int x, int y) { if(bstore) { @@ -443,18 +443,18 @@ } return false; }; - + int Width; int Height; - unsigned int *bstore; + unsigned int *bstore; }; - + bits_map map; public: CFiller() : G(NULL), X(0), Y(0) {} void Load(void); - + bool OnGraphic(int x, int y) { x -= X; y -= Y; @@ -698,8 +698,8 @@ CGraphic *DefeatBackgroundG; /// Defeat background graphic }; -/* - * Basic Shared Pointer for Current Selected Buttons +/* + * Basic Shared Pointer for Current Selected Buttons * parallel drawing problems. */ class ButtonActionProxy { @@ -730,7 +730,7 @@ public: ButtonActionProxy (): ptr(0), count(0) {} - + ButtonActionProxy (const ButtonActionProxy& p) : ptr(p.ptr), count(p.count) { @@ -754,12 +754,12 @@ ButtonAction &operator[](unsigned int index) { return ptr[index]; } - + bool IsValid(void) { return ptr != NULL; } - + }; extern ButtonActionProxy CurrentButtons; /// Current Selected Buttons === modified file 'src/include/unit.h' --- src/include/unit.h 2009-05-30 12:45:16 +0000 +++ src/include/unit.h 2010-09-10 15:47:19 +0000 @@ -184,7 +184,7 @@ ** ** Contains the binary angle (0-255) in which the direction the ** unit looks. 0, 32, 64, 128, 160, 192, 224, 256 corresponds to -** 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°, 360° or north, +** 0�, 45�, 90�, 135�, 180�, 225�, 270�, 315�, 360� or north, ** north-east, east, south-east, south, south-west, west, ** north-west, north. Currently only 8 directions are used, this ** is more for the future. @@ -471,7 +471,7 @@ VoiceBuilding, /// only for building under construction VoiceDocking, /// only for transport reaching coast VoiceRepairing, /// repairing - VoiceHarvesting, /// harvesting + VoiceHarvesting /// harvesting }; /** @@ -490,7 +490,7 @@ LookingS = 4 * 32, /// Unit looking south LookingSW = 5 * 32, /// Unit looking south west LookingW = 6 * 32, /// Unit looking west - LookingNW = 7 * 32, /// Unit looking north west + LookingNW = 7 * 32 /// Unit looking north west }; #define NextDirection 32 /// Next direction N->NE->E... @@ -506,7 +506,7 @@ class COrder { friend void CclParseOrder(lua_State *l, COrder *order); CUnit *Goal; /// goal of the order (if any) - + public: COrder() : Goal(NULL), Range(0), MinRange(0), Width(0), Height(0),Action(UnitActionNone), CurrentResource(0), @@ -520,9 +520,9 @@ void Release(void); COrder& operator=(const COrder &rhs); bool CheckRange(void); - + void Init() { - Assert(Action != UnitActionResource || + Assert(Action != UnitActionResource || (Action == UnitActionResource && Arg1.Resource.Mine == NULL)); Action = UnitActionNone; Range = 0; @@ -540,7 +540,7 @@ unsigned char Width; /// Goal Width (used when Goal is not) unsigned char Height; /// Goal Height (used when Goal is not) unsigned char Action; /// global action - unsigned char CurrentResource; //used in UnitActionResource and + unsigned char CurrentResource; //used in UnitActionResource and //UnitActionReturnGoods int X; /// or X tile coordinate of destination @@ -594,7 +594,7 @@ } Goal = new_goal; }; - + inline void ClearGoal(void) { if (Goal) { @@ -604,7 +604,7 @@ }; }; - + CUnit() { Init(); } void Init() { @@ -686,7 +686,7 @@ CUnit *NextContained; /// Next unit in the container. CUnit *PrevContained; /// Previous unit in the container. CUnit *NextWorker; //pointer to next assigned worker to "Goal" resource. - + int X; /// Map position X int Y; /// Map position Y unsigned int Offset;/// Map position as flat index offset (x + y * w) @@ -699,7 +699,7 @@ // DISPLAY: int Frame; /// Image frame: <0 is mirrored CUnitColors *Colors; /// Player colors - + signed char IX; /// X image displacement to map position signed char IY; /// Y image displacement to map position unsigned char Direction; //: 8; /// angle (0-255) unit looking @@ -718,7 +718,7 @@ unsigned Destroyed : 1; /// unit is destroyed pending reference unsigned Removed : 1; /// unit is removed (not on map) unsigned Selected : 1; /// unit is selected - + unsigned Constructed : 1; /// Unit is in construction unsigned Active : 1; /// Unit is active for AI @@ -742,7 +742,7 @@ unsigned Constructed : 1; /// Unit seen construction unsigned State : 3; /// Unit seen build/upgrade state unsigned Destroyed : PlayerMax; /// Unit seen destroyed or not - unsigned ByPlayer : PlayerMax; /// Track unit seen by player + unsigned ByPlayer : PlayerMax; /// Track unit seen by player } Seen; CVariable *Variable; /// array of User Defined variables. @@ -814,22 +814,22 @@ inline COrder * CreateOrder(void) { Orders.push_back(new COrder); - return Orders[(int)OrderCount++]; + return Orders[(int)OrderCount++]; } - inline COrder *CurrentOrder() const + inline COrder *CurrentOrder() const { #if __GNUC__ < 4 return Orders[0]; #else return *(Orders.data()); -#endif +#endif } inline UnitAction CurrentAction() const { return (UnitAction)(CurrentOrder()->Action); } - + inline bool IsIdle() const { return OrderCount == 1 && CurrentAction() == UnitActionStill; } @@ -842,7 +842,7 @@ } } - inline int GetReactRange() const + inline int GetReactRange() const { return (Player->Type == PlayerPerson ? Type->ReactRangePerson : Type->ReactRangeComputer); @@ -875,15 +875,15 @@ void AssignWorkerToMine(CUnit *mine); void DeAssignWorkerFromMine(CUnit *mine); - + /// Release a unit void Release(bool final = false); bool RestoreOrder(void); bool StoreOrder(void); - + // Cowards and invisible units don't attack unless ordered. - bool IsAgressive(void) const + bool IsAgressive(void) const { return (Type->CanAttack && !Type->Coward && Variable[INVISIBLE_INDEX].Value == 0); @@ -946,7 +946,7 @@ !(Seen.Destroyed & (1 << player->Index)); } } - + /** ** Returns true, if unit is visible for this player on the map. ** The unit has to be out of fog of war and alive @@ -958,17 +958,17 @@ inline bool IsVisibleOnMap(const CPlayer *player) const { return IsAliveOnMap() && !IsInvisibile(player) && IsVisible(player); - } + } /// Returns true if unit is visible on minimap. Only for ThisPlayer. bool IsVisibleOnMinimap() const; - + // Returns true if unit is visible under radar (By player, or by shared vision) bool IsVisibleOnRadar(const CPlayer *pradar) const; - + /// Returns true if unit is visible in an viewport. Only for ThisPlayer. bool IsVisibleInViewport(const CViewport *vp) const; - + /// Returns true, if unit is visible on current map view (any viewport). bool IsVisibleOnScreen() const; @@ -987,7 +987,7 @@ bool IsTeamed(const CUnit *x) const; bool IsUnusable(bool ignore_built_state = false) const; - + /** ** Returns the map distance between this unit and dst units. ** @@ -1000,7 +1000,7 @@ return MapDistanceBetweenTypes(Type, X, Y, dst->Type, dst->X, dst->Y); } - + /** ** Returns the map distance to unit. ** @@ -1025,13 +1025,13 @@ { return Type->CanMove(); } - + int GetDrawLevel(void) const { return ((Type->CorpseType && CurrentAction() == UnitActionDie) ? Type->CorpseType->DrawLevel : Type->DrawLevel); } - + }; typedef CUnit::COrder* COrderPtr; @@ -1047,7 +1047,7 @@ unit = NULL; } - CUnitPtr(): unit(NULL) {} + CUnitPtr(): unit(NULL) {} CUnitPtr(CUnit *u): unit(u) { if (unit) { unit->RefsIncrease(); @@ -1114,28 +1114,28 @@ int X; int Y; - int frame; - int TeamSelected; //unit->TeamSelected - int GroupId; //unit->GroupId - - signed char IX; + int frame; + int TeamSelected; //unit->TeamSelected + int GroupId; //unit->GroupId + + signed char IX; signed char IY; - unsigned char CurrentResource; + unsigned char CurrentResource; unsigned int IsAlive:1; - unsigned int Selected:1; //unit->Selected - unsigned int ResourcesHeld:1; /// isResources Held by a unit + unsigned int Selected:1; //unit->Selected + unsigned int ResourcesHeld:1; /// isResources Held by a unit unsigned int state: 2; unsigned int Blink: 3; //unit->Blink - + const CConstructionFrame *cframe; const CUnitType *Type; const CPlayer *Player; - + CVariable *Variable; - + void operator=(const CUnit *unit); - void Draw(const CViewport *vp) const; + void Draw(const CViewport *vp) const; }; //unit_find @@ -1154,7 +1154,7 @@ { return cache.find(*this); } - + inline CUnit *Find(const CMapField *const mf) const { return mf->UnitCache.find(*this); @@ -1168,8 +1168,8 @@ inline bool operator () (const CUnit *const unit) const { const CUnitType *const type = unit->Type; - return (type->GivesResource == resource - && unit->ResourcesHeld != 0 + return (type->GivesResource == resource + && unit->ResourcesHeld != 0 && (mine_on_top ? type->CanHarvest : !type->CanHarvest) && !unit->IsUnusable(true) //allow mines under construction ); @@ -1177,7 +1177,7 @@ inline CUnit *Find(const CMapField *const mf) const { return mf->UnitCache.find(*this); - } + } }; struct CResourceDepositFinder { @@ -1278,12 +1278,12 @@ extern void UnitGoesOutOfFog(CUnit *unit, const CPlayer *player); /// Marks a unit as seen extern void UnitsOnTileMarkSeen(const CPlayer *player, int x, int y, int p); -extern void +extern void UnitsOnTileMarkSeen(const CPlayer *player, const unsigned int index, int p); /// Unmarks a unit as seen extern void UnitsOnTileUnmarkSeen(const CPlayer *player, int x, int y, int p); -extern void +extern void UnitsOnTileUnmarkSeen(const CPlayer *player, const unsigned int index, int p); /// Does a recount for VisCount @@ -1319,7 +1319,7 @@ extern CUnit *UnitFindResource(const CUnit *unit, int x, int y, int range, int resource, bool check_usage = false, const CUnit *destu = NULL); extern CUnit *UnitFindMiningArea(const CUnit *unit, int x, int y, - int range, int resource); + int range, int resource); /// Find nearest deposit extern CUnit *FindDeposit(const CUnit *unit, int range, int resource); /// Find the next idle worker @@ -1407,7 +1407,7 @@ extern CUnit *TargetOnMap(const CUnit *unit, int x1, int y1, int x2, int y2); /// Return resource, if on map tile -extern CUnit *ResourceOnMap(int tx, int ty, int resource, +extern CUnit *ResourceOnMap(int tx, int ty, int resource, bool mine_on_top = true); /// Return resource deposit, if on map tile extern CUnit *ResourceDepositOnMap(int tx, int ty, int resource); @@ -1420,7 +1420,7 @@ extern CUnit *AttackUnitsInReactRange(const CUnit *unit); extern CUnit * -AutoAttackUnitsInDistance(const CUnit *unit, int range, +AutoAttackUnitsInDistance(const CUnit *unit, int range, CUnitCache &autotargets); // in groups.c === modified file 'src/include/unittype.h' --- src/include/unittype.h 2009-06-12 20:52:21 +0000 +++ src/include/unittype.h 2010-09-10 15:46:31 +0000 @@ -564,7 +564,7 @@ public: ResourceInfo() : WaitAtResource(0), ResourceStep(0), ResourceCapacity(0), WaitAtDepot(0), ResourceId(0), FinalResource(0), - TerrainHarvester(0), LoseResources(0), HarvestFromOutside(0), + TerrainHarvester(0), LoseResources(0), HarvestFromOutside(0), SpriteWhenLoaded(NULL), SpriteWhenEmpty(NULL) {} @@ -579,7 +579,7 @@ unsigned char TerrainHarvester; /// Unit will harvest terrain(wood only for now). unsigned char LoseResources; /// The unit will lose it's resource when distracted. unsigned char HarvestFromOutside; /// Unit harvests without entering the building. - unsigned char RefineryHarvester; /// Unit have to build Refinery buildings for harvesting. + unsigned char RefineryHarvester; /// Unit have to build Refinery buildings for harvesting. // Runtime info: CPlayerColorGraphic *SpriteWhenLoaded; /// The graphic corresponding to FileWhenLoaded. CPlayerColorGraphic *SpriteWhenEmpty; /// The graphic corresponding to FileWhenEmpty @@ -740,7 +740,7 @@ public: CDecoVarSpriteBar() : NSprite(-1) {}; /// function to draw the decorations. - virtual void Draw(int x, int y, + virtual void Draw(int x, int y, const CUnitType *Type, const CVariable &Variable) const; char NSprite; /// Index of number. (@see DefineSprites and @see GetSpriteIndex) @@ -763,7 +763,7 @@ enum UnitTypeType { UnitTypeLand, /// Unit lives on land UnitTypeFly, /// Unit lives in air - UnitTypeNaval, /// Unit lives on water + UnitTypeNaval /// Unit lives on water }; enum DistanceTypeType { @@ -772,7 +772,7 @@ LessThan, LessThanEqual, GreaterThan, - GreaterThanEqual, + GreaterThanEqual }; @@ -814,7 +814,7 @@ class CBuildRestrictionAddOn : public CBuildRestriction { struct functor { - const CUnitType *const Parent; /// building that is unit is an addon too. + const CUnitType *const Parent; /// building that is unit is an addon too. const int x,y; //functor work position functor(const CUnitType *type, int _x, int _y): Parent(type), x(_x), y(_y) {} inline bool operator() (const CUnit *const unit) const; @@ -833,8 +833,8 @@ class CBuildRestrictionOnTop : public CBuildRestriction { struct functor { - CUnit *ontop; /// building that is unit is an addon too. - const CUnitType *const Parent; /// building that is unit is an addon too. + CUnit *ontop; /// building that is unit is an addon too. + const CUnitType *const Parent; /// building that is unit is an addon too. const int x,y; //functor work position functor(const CUnitType *type, int _x, int _y): ontop(0), Parent(type), x(_x), y(_y) {} inline bool operator() (CUnit *const unit); @@ -970,10 +970,10 @@ unsigned Indestructible : 1; /// Unit is indestructible (take no damage). unsigned Teleporter : 1; /// Can teleport other units. - CVariable *Variable; /// Array of user defined variables. + CVariable *Variable; /// Array of user defined variables. struct BoolFlags { bool value; /// User defined flag. Used for (dis)allow target. - char CanTransport; /// Can transport units with this flag. + char CanTransport; /// Can transport units with this flag. char CanTargetFlag; /// Flag needed to target with missile. }; std::vector BoolFlag; @@ -1003,7 +1003,7 @@ CGraphic *ShadowSprite; /// Shadow sprite image /* API */ - + bool CheckUserBoolFlags(char *BoolFlags); bool CanTransport(void) const { @@ -1055,11 +1055,11 @@ struct CKeys { struct DataKey - { - static bool key_pred(const DataKey& lhs, + { + static bool key_pred(const DataKey& lhs, const DataKey& rhs) { - return ((lhs.keylen == rhs.keylen) ? + return ((lhs.keylen == rhs.keylen) ? (strcmp(lhs.key, rhs.key) < 0) : (lhs.keylen < rhs.keylen)); } int offset; @@ -1068,22 +1068,22 @@ }; CKeys(): TotalKeys(SIZE) {} - + DataKey buildin[SIZE]; std::map user; unsigned int TotalKeys; - + void Init() { - std::sort(buildin, buildin+SIZE, DataKey::key_pred); + std::sort(buildin, buildin+SIZE, DataKey::key_pred); } - + const char *operator[](int index) { for (unsigned int i = 0; i < SIZE; ++i) { if (buildin[i].offset == index) { return buildin[i].key; } } - for (std::map::iterator + for (std::map::iterator it(user.begin()), end(user.end()); it != end; ++it) { if ((*it).second == index) { @@ -1092,31 +1092,31 @@ } return NULL; } - + /** ** Return the index of the external storage array/vector. ** ** @param varname Name of the variable. ** ** @return Index of the variable, -1 if not found. - */ + */ int operator[](const char*const key) { DataKey k; k.key = key; k.keylen = strlen(key); - const DataKey* p = std::lower_bound(buildin, buildin + SIZE, + const DataKey* p = std::lower_bound(buildin, buildin + SIZE, k, DataKey::key_pred); - if ((p != buildin + SIZE) && p->keylen == k.keylen && + if ((p != buildin + SIZE) && p->keylen == k.keylen && 0 == strcmp(p->key, key)) { return p->offset; } else { - std::map::iterator + std::map::iterator ret(user.find(key)); if (ret != user.end()) { return (*ret).second; } } - return -1; + return -1; } int AddKey(const char*const key) @@ -1129,7 +1129,7 @@ user[key] = TotalKeys++; return TotalKeys - 1; } - + }; struct CBoolKeys : public CKeys { @@ -1141,17 +1141,17 @@ }; CUnitTypeVar() {} - + void Init(); void Clear(); - + CBoolKeys BoolFlagNameLookup; /// Container of name of user defined bool flag. CVariableKeys VariableNameLookup; /// Container of names of user defined variables. - + // EventType *Event; /// Array of functions sets to call when en event occurs. - std::vector Variable; /// Array of user defined variables (default value for unittype). + std::vector Variable; /// Array of user defined variables (default value for unittype). std::vector DecoVar; /// Array to describe how showing variable. - + unsigned int GetNumberBoolFlag(void) { return BoolFlagNameLookup.TotalKeys; } @@ -1160,8 +1160,8 @@ return VariableNameLookup.TotalKeys; } - - + + }; extern CUnitTypeVar UnitTypeVar; === modified file 'src/include/util.h' --- src/include/util.h 2010-08-03 14:51:57 +0000 +++ src/include/util.h 2010-09-10 15:46:31 +0000 @@ -63,7 +63,7 @@ #else return 1; #endif -}; +} class CMutex @@ -107,7 +107,6 @@ return 0 == pthread_mutex_trylock (&_mut); #endif } - }; === modified file 'src/map/map_fog.cpp' --- src/map/map_fog.cpp 2010-08-03 13:13:49 +0000 +++ src/map/map_fog.cpp 2010-09-10 15:58:50 +0000 @@ -308,15 +308,12 @@ int cy[4]; int steps; int cycle; - int p; // Units under construction have no sight range. if (!range) { return; } - p = player->Index; - #ifdef MARKER_ON_INDEX unsigned int index = y * Map.Info.MapWidth; #endif @@ -350,7 +347,7 @@ } } #ifdef MARKER_ON_INDEX - index += Map.Info.MapWidth; + index += Map.Info.MapWidth; #endif } @@ -369,7 +366,7 @@ } } #ifdef MARKER_ON_INDEX - index += Map.Info.MapWidth; + index += Map.Info.MapWidth; #endif } @@ -663,7 +660,6 @@ int ex; int dy; int ey; - int p; int my; int mx; @@ -671,7 +667,6 @@ if (ReplayRevealMap) { return; } - p = ThisPlayer->Index; sx = std::max(MapX - 1, 0); ex = std::min(MapX + MapWidth + 1, Map.Info.MapWidth); @@ -792,7 +787,7 @@ AlphaFogG->GenFramesMap(); AlphaFogG->UseDisplayFormat(); } - + delete[] VisibleTable; VisibleTable = new unsigned short[Info.MapWidth * Info.MapHeight]; } === modified file 'src/map/minimap.cpp' --- src/map/minimap.cpp 2010-07-14 09:16:53 +0000 +++ src/map/minimap.cpp 2010-09-10 15:46:32 +0000 @@ -519,7 +519,6 @@ int my; int n; int visiontype; // 0 unexplored, 1 explored, >1 visible. - int bpp; red_phase_changed = red_phase != (int)((FrameCounter / FRAMES_PER_SECOND) & 1); if (red_phase_changed) { @@ -536,7 +535,6 @@ } if (!UseOpenGL) { - bpp = MinimapSurface->format->BytesPerPixel; } // @@ -563,6 +561,7 @@ } if ( visiontype == 0 || (visiontype == 1 && ((mx & 1) != (my & 1)))) { + const int bpp = MinimapSurface->format->BytesPerPixel; if (!UseOpenGL) { if (bpp == 2) { *(Uint16 *)&((Uint8 *)MinimapSurface->pixels)[mx * bpp + my * MinimapSurface->pitch] = @@ -647,7 +646,7 @@ glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); - + glTexCoordPointer(2, GL_FLOAT, 0, texCoord); glVertexPointer(2, GL_FLOAT, 0, vertex); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); === modified file 'src/network/network.cpp' --- src/network/network.cpp 2010-08-03 13:49:33 +0000 +++ src/network/network.cpp 2010-09-10 15:46:41 +0000 @@ -813,7 +813,7 @@ for (; i < MaxNetworkCommands; ++i) { packet.Header.Type[i] = MessageNone; } - + // // Send the Constructed packet to team members @@ -1052,7 +1052,7 @@ { unsigned int slot = ntohs(nc->Unit); - if (slot >= 0 && slot < UnitSlotFree && + if (slot < UnitSlotFree && (UnitSlots[slot]->Player->Index == player || Players[player].IsTeamed(UnitSlots[slot]))) { validCommand = true; @@ -1069,8 +1069,8 @@ NetworkIn[packet.Header.Cycle][player][i].Data = *nc; } else { SetMessage(_("%s sent bad command"), Players[player].Name.c_str()); - DebugPrint("%s sent bad command: 0x%x\n" _C_ - Players[player].Name.c_str() _C_ + DebugPrint("%s sent bad command: 0x%x\n" _C_ + Players[player].Name.c_str() _C_ packet.Header.Type[i] & 0x7F); } } === modified file 'src/sound/sound_id.cpp' --- src/sound/sound_id.cpp 2008-08-30 16:05:17 +0000 +++ src/sound/sound_id.cpp 2010-09-10 15:46:31 +0000 @@ -63,8 +63,8 @@ if (ret != SoundMap.end()) { return (*ret).second; } - return NULL; -}; + return NULL; +} /** ** Add a new mapping (sound name to sound id) in the hash table @@ -98,7 +98,7 @@ return sound; } DebugPrint("Can't find sound `%s' in sound table\n" _C_ name.c_str()); - return NULL; + return NULL; } /** === modified file 'src/stratagus/mainloop.cpp' --- src/stratagus/mainloop.cpp 2010-08-03 14:51:57 +0000 +++ src/stratagus/mainloop.cpp 2010-09-10 15:46:31 +0000 @@ -107,7 +107,7 @@ if (GameRunning && CPU_NUM > 1) { DisplayUpdateLocker.UnLock(); } -}; +} //---------------------------------------------------------------------------- // Functions === modified file 'src/stratagus/missile.cpp' --- src/stratagus/missile.cpp 2009-06-08 18:04:03 +0000 +++ src/stratagus/missile.cpp 2010-09-10 15:46:31 +0000 @@ -593,7 +593,7 @@ default: this->Type->DrawMissileType(this->data.SpriteFrame, x, y); break; - } + } } void MissileDrawProxy::operator=(const Missile* missile) { @@ -605,7 +605,7 @@ } else { this->data.SpriteFrame = missile->SpriteFrame; } -}; +} /** ** Draw missile. @@ -638,7 +638,7 @@ } } -static bool MissileDrawLevelCompare(const Missile*const l, +static bool MissileDrawLevelCompare(const Missile*const l, const Missile*const r) { if (l->Type->DrawLevel == r->Type->DrawLevel) { @@ -657,7 +657,7 @@ ** ** @return number of missiles returned in table */ -int FindAndSortMissiles(const CViewport *vp, +int FindAndSortMissiles(const CViewport *vp, Missile *table[], const int tablesize) { int nmissiles; @@ -692,7 +692,7 @@ return nmissiles; } -int FindAndSortMissiles(const CViewport *vp, +int FindAndSortMissiles(const CViewport *vp, MissileDrawProxy table[], const int tablesize) { Missile *buffer[MAX_MISSILES * 9]; @@ -1327,7 +1327,7 @@ { FiredSound.Sound = NULL; ImpactSound.Sound = NULL; -}; +} /** ** Destructor. @@ -1672,7 +1672,7 @@ inline CUnit *FindOnTile(const CMapField *const mf) const { return mf->UnitCache.find(*this); - } + } }; /** @@ -1687,10 +1687,10 @@ if(LandMineTargetFinder(this->SourceUnit, this->Type->CanHitOwner).FindOnTile(Map.Field(x,y)) != NULL) { - DebugPrint("Landmine explosion at %d,%d.\n" _C_ x _C_ y); + DebugPrint("Landmine explosion at %d,%d.\n" _C_ x _C_ y); MissileHit(this); this->TTL = 0; - return; + return; } if (!this->AnimWait--) { NextMissileFrame(this, 1, 0); === modified file 'src/stratagus/util.cpp' --- src/stratagus/util.cpp 2010-08-03 14:51:57 +0000 +++ src/stratagus/util.cpp 2010-09-10 15:46:32 +0000 @@ -529,7 +529,7 @@ ptr->Run (); } return NULL; -}; +} #endif void CThread::Terminate () @@ -585,7 +585,7 @@ m_bRunning = false; } return 0; -}; +} void CThread::Exit () { === modified file 'src/tolua/tolua++.h' --- src/tolua/tolua++.h 2008-08-20 22:45:02 +0000 +++ src/tolua/tolua++.h 2010-09-10 15:46:31 +0000 @@ -135,13 +135,13 @@ const char* s = tolua_tostring(L, narg, def); return s?s:""; -}; +} static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { const char* s = tolua_tofieldstring(L, lo, index, def); return s?s:""; -}; +} #else #define tolua_tocppstring tolua_tostring === modified file 'src/tolua/tolua.cpp' --- src/tolua/tolua.cpp 2010-08-03 12:53:12 +0000 +++ src/tolua/tolua.cpp 2010-09-10 15:46:32 +0000 @@ -20347,6 +20347,6 @@ #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 TOLUA_API int luaopen_stratagus (lua_State* tolua_S) { return tolua_stratagus_open(tolua_S); -}; +} #endif === modified file 'src/tolua/tolua_event.cpp' --- src/tolua/tolua_event.cpp 2007-02-27 05:27:27 +0000 +++ src/tolua/tolua_event.cpp 2010-09-10 15:46:32 +0000 @@ -312,7 +312,7 @@ }; tolua_error(L,"Attempt to call a non-callable object.",NULL); return 0; -}; +} static int do_operator (lua_State* L, const char* op) { === modified file 'src/tolua/tolua_is.cpp' --- src/tolua/tolua_is.cpp 2008-08-20 22:45:02 +0000 +++ src/tolua/tolua_is.cpp 2010-09-10 15:46:32 +0000 @@ -158,7 +158,7 @@ }; return 0; -}; +} /* the equivalent of lua_is* for usertype */ static int lua_isusertype (lua_State* L, int lo, const char* type) === modified file 'src/tolua/tolua_map.cpp' --- src/tolua/tolua_map.cpp 2008-08-20 22:45:02 +0000 +++ src/tolua/tolua_map.cpp 2010-09-10 15:46:32 +0000 @@ -115,7 +115,7 @@ lua_rawset(L,-4); }; -}; +} /* Map inheritance * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' @@ -247,7 +247,7 @@ /* l_obj[".c_instance"] = c_obj */ return 0; -}; +} #ifdef LUA_VERSION_NUM /* lua 5.1 */ static int tolua_bnd_setpeer(lua_State* L) { @@ -257,7 +257,7 @@ lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); lua_error(L); }; - + if (lua_isnil(L, -1)) { lua_pop(L, 1); @@ -266,7 +266,7 @@ lua_setfenv(L, -2); return 0; -}; +} static int tolua_bnd_getpeer(lua_State* L) { @@ -277,7 +277,7 @@ lua_pushnil(L); }; return 1; -}; +} #endif /* static int class_gc_event (lua_State* L); */ @@ -513,7 +513,7 @@ lua_rawset(L,-3); lua_pop(L, 1); -}; +} /* Map C class * It maps a C class, setting the appropriate inheritance and super classes. @@ -532,7 +532,7 @@ mapsuper(L,name,base); lua_pushstring(L,lname); - + push_collector(L, name, col); /* luaL_getmetatable(L,name); @@ -541,7 +541,7 @@ lua_rawset(L,-3); */ - + luaL_getmetatable(L,name); lua_rawset(L,-3); /* assign class metatable to module */ @@ -555,7 +555,7 @@ lua_rawset(L,-3); lua_pop(L,1); */ - + } @@ -700,5 +700,5 @@ #else lua_dobuffer(L, B, size, name); #endif -}; +} === modified file 'src/ui/icons.cpp' --- src/ui/icons.cpp 2008-08-20 22:45:02 +0000 +++ src/ui/icons.cpp 2010-09-10 15:46:31 +0000 @@ -130,7 +130,7 @@ ExitFatal(-1); } #endif -}; +} /** ** Init the icons. === modified file 'src/ui/interface.cpp' --- src/ui/interface.cpp 2010-06-24 11:02:47 +0000 +++ src/ui/interface.cpp 2010-09-10 15:48:52 +0000 @@ -694,7 +694,7 @@ if (KeyModifiers & ModifierAlt) { ToggleShowBuilListMessages(); } -#endif +#endif break; case SDLK_TAB: // TAB toggles minimap. @@ -759,10 +759,10 @@ SetMessage("Cannot disable 'ai me' cheat"); #endif } else { - + for (int j = 0; j < ThisPlayer->TotalNumUnits; ++j) { CUnit *guard = ThisPlayer->Units[j]; - bool stand_ground = + bool stand_ground = guard->CurrentAction() == UnitActionStandGround; if ((stand_ground || guard->IsIdle()) && !guard->IsUnusable()) { @@ -1275,7 +1275,7 @@ static enum { InitialMouseState, /// start state - ClickedMouseState, /// button is clicked + ClickedMouseState /// button is clicked } MouseState; /// Current state of mouse static int MouseX; /// Last mouse X position === modified file 'src/ui/mainscr.cpp' --- src/ui/mainscr.cpp 2009-06-12 20:52:21 +0000 +++ src/ui/mainscr.cpp 2010-09-10 15:46:20 +0000 @@ -620,7 +620,7 @@ // if (NumSelected == 1 && Selected[0] == unit) { switch(unit->CurrentAction()) { - + // // Building training units. // @@ -751,7 +751,7 @@ } } if (UI.Resources[FoodCost].TextX != -1) { - char tmp[128]; + char tmp[128]; snprintf(tmp,sizeof(tmp), "%d/%d", ThisPlayer->Demand, ThisPlayer->Supply); label.SetFont(GameFont); if (ThisPlayer->Supply < ThisPlayer->Demand) { @@ -789,7 +789,7 @@ { #ifdef DEBUG showBuilList = false; -#endif +#endif CleanMessages(); } @@ -800,7 +800,7 @@ void ToggleShowMessages() { show = !show; }; -#ifdef DEBUG +#ifdef DEBUG void ToggleShowBuilListMessages() { showBuilList = !showBuilList; }; @@ -879,7 +879,7 @@ PushClipping(); SetClipping(UI.MapArea.X + 8, UI.MapArea.Y + 8, Video.Width - 1, Video.Height - 1); - } + } snprintf(buffer, 256, "%s (%d/%d) Wait %lu [%d,%d]", ThisPlayer->Ai->UnitTypeBuilt[z].Type->Name.c_str(), @@ -888,9 +888,9 @@ ThisPlayer->Ai->UnitTypeBuilt[z].Wait, ThisPlayer->Ai->UnitTypeBuilt[z].X, ThisPlayer->Ai->UnitTypeBuilt[z].Y); - + label.DrawClip(UI.MapArea.X + 8, - UI.MapArea.Y + 8 + + UI.MapArea.Y + 8 + z * (UI.MessageFont->Height() + 1), buffer); @@ -905,12 +905,12 @@ int textHeight = MessagesCount * (UI.MessageFont->Height() + 1); Uint32 color = Video.MapRGB(TheScreen->format, 38, 38, 78); Video.FillTransRectangleClip(color, UI.MapArea.X + 7, UI.MapArea.Y + 7, - UI.MapArea.EndX - UI.MapArea.X - 16, + UI.MapArea.EndX - UI.MapArea.X - 16, textHeight - MessagesScrollY + 1, 0x80); - + Video.DrawRectangle(color, UI.MapArea.X + 6, UI.MapArea.Y + 6, UI.MapArea.EndX - UI.MapArea.X - 15, - textHeight - MessagesScrollY + 2); + textHeight - MessagesScrollY + 2); } // Draw message line(s) @@ -921,12 +921,12 @@ Video.Height - 1); } /* - * Due parallel drawing we have to force message copy due temp - * std::string(Messages[z]) creation because + * Due parallel drawing we have to force message copy due temp + * std::string(Messages[z]) creation because * char * pointer may change during text drawing. */ label.DrawClip(UI.MapArea.X + 8, - UI.MapArea.Y + 8 + + UI.MapArea.Y + 8 + z * (UI.MessageFont->Height() + 1) - MessagesScrollY, std::string(Messages[z])); if (z == 0) { @@ -938,8 +938,8 @@ } #ifdef DEBUG } -#endif - +#endif + } } @@ -1264,7 +1264,7 @@ if (UI.Resources[i].G) { UI.Resources[i].G->DrawFrameClip(UI.Resources[i].IconFrame, x, UI.StatusLine.TextY); - x+= 20; + x+= 20; } x+=label.Draw(x, UI.StatusLine.TextY, Costs[i]); if (x > Video.Width - 60) { === modified file 'src/ui/widgets.cpp' --- src/ui/widgets.cpp 2010-08-07 13:43:34 +0000 +++ src/ui/widgets.cpp 2010-09-10 15:44:17 +0000 @@ -374,6 +374,7 @@ textX = getWidth() - 4; break; default: + textX = 0; Assert(!"Unknown alignment."); //throw GCN_EXCEPTION("Unknown alignment."); } @@ -884,6 +885,7 @@ textX = this->getWidth(); break; default: + textX = 0; Assert(!"Unknown alignment."); //throw GCN_EXCEPTION("Unknown alignment."); } @@ -898,6 +900,7 @@ textY = this->getHeight() - (int)this->mTextRows.size() * this->getFont()->getHeight(); break; default: + textY = 0; Assert(!"Unknown alignment."); //throw GCN_EXCEPTION("Unknown alignment."); } === modified file 'src/unit/unittype.cpp' --- src/unit/unittype.cpp 2009-06-12 20:52:21 +0000 +++ src/unit/unittype.cpp 2010-09-10 15:46:32 +0000 @@ -120,7 +120,7 @@ Vanishes(0), GroundAttack(0), ShoreBuilding(0), CanAttack(0), BuilderOutside(0), BuilderLost(0), CanHarvest(0), Harvester(0), Neutral(0), SelectableByRectangle(0), IsNotSelectable(0), Decoration(0), - Indestructible(0), Teleporter(0), Variable(NULL), + Indestructible(0), Teleporter(0), Variable(NULL), GivesResource(0), Supply(0), Demand(0), FieldFlags(0), MovementMask(0), Sprite(NULL), ShadowSprite(NULL) { @@ -138,7 +138,7 @@ delete[] Variable; BoolFlag.clear(); - + for (int i = 0; i < PlayerMax; ++i) { delete[] Stats[i].Variables; } @@ -172,7 +172,7 @@ bool CUnitType::CheckUserBoolFlags(char *BoolFlags) { for (unsigned int i = 0; i < UnitTypeVar.GetNumberBoolFlag(); ++i) { // User defined flags - if (BoolFlags[i] != CONDITION_TRUE && + if (BoolFlags[i] != CONDITION_TRUE && ((BoolFlags[i] == CONDITION_ONLY) ^ (BoolFlag[i].value))) { return false; } @@ -205,7 +205,7 @@ if (!stats->Variables) { stats->Variables = new CVariable[UnitTypeVar.GetNumberVariable()]; } - memcpy(stats->Variables, type->Variable, + memcpy(stats->Variables, type->Variable, UnitTypeVar.GetNumberVariable() * sizeof(*type->Variable)); } } @@ -581,12 +581,12 @@ for (unsigned int i = 0; i < UnitTypes.size(); ++i) { // adjust array for unit already defined UnitTypes[i]->BoolFlag.resize(new_size); } -}; +} void CUnitTypeVar::Clear() { Variable.clear(); - + for (std::vector::iterator it = DecoVar.begin(); it != DecoVar.end(); ++it) { delete (*it); === modified file 'src/video/graphic.cpp' --- src/video/graphic.cpp 2010-09-09 07:26:21 +0000 +++ src/video/graphic.cpp 2010-09-10 15:43:16 +0000 @@ -831,6 +831,9 @@ unsigned int p0 = s->pitch; unsigned int p1 = Surface->pitch; const int width = s->w; +#ifndef _MSC_VER + j = 0; +#endif for (i = 0; i < s->h; ++i) { #ifdef _MSC_VER for (j = 0; j < width; ++j) {