Re: [warzone2100-dev] Patch for various warnings

2010-12-20 Thread Cyp
On Mon, Dec 20, 2010 at 2:20 PM, Per Inge Mathisen
per.mathi...@gmail.com wrote:
 This is a patch to fix warnings discovered on a MacOSX compile with
 llvm. Of note, look especially at the change in display.c, where
 behaviour is altered. Zarel, I think you touched this line last, but I
 failed to git blame past the file renames.

git annotate (or git blame) works fine here, if you're referring to
the *.c → *.cpp renames.
Two things that maybe could be relevant: I have [merge] renameLimit
= 1 in my .git/config file, and I have git 1.7.2.2. To add that
to the config file, you can do: git config merge.renameLimit 1.

git annotate master src/display.cpp gives
cc343768ae12011490ed423aad1f80c59dfbe57e:
- for(i=0;(inumStructureStats)(asStructureStats[i].type !=
REF_RESOURCE_EXTRACTOR);i++);   // find resource stat
+ for (i=0;(inumStructureStats)(asStructureStats[i].type !=
REF_RESOURCE_EXTRACTOR);i++);   // find resource stat
But that's just a whitespace change.

git annotate cc343768~1 -- src/display.c gives
5ba7ddac6bb54a1b5f1e67a433ed8d866e191c50, which was Create final
repository structure.
But that's just adding files back after they were removed in the previous commit

git annotate 5ba7ddac~2 -- game/src/display.c gives
278341944e524917605b8c8cf4a79d40d977899f, which was set
svn:eol-style=native property on source files
But that's just changing line endings and renaming files.

git annotate 27834194~1 -- game/src/Display.c gives
dfb2beeb282233128b77c47a774608b3920765eb, which was Initial Version.
+ for(i=0;(inumStructureStats)(asStructureStats[i].type !=
REF_RESOURCE_EXTRACTOR);i++);   // find resource stat
This seems to be where the bug was introduced.

So the offending commit is Initial Version
dfb2beeb282233128b77c47a774608b3920765eb. That committer should have
been more careful.

...

-Cyp

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev


Re: [warzone2100-dev] Patch for various warnings

2010-12-20 Thread Guangcong Luo
On Mon, Dec 20, 2010 at 7:20 AM, Per Inge Mathisen
per.mathi...@gmail.com wrote:
 This is a patch to fix warnings discovered on a MacOSX compile with
 llvm. Of note, look especially at the change in display.c, where
 behaviour is altered. Zarel, I think you touched this line last, but I
 failed to git blame past the file renames.

Ugh, no, I misread that code when I touched that line. The semicolon
there is intentional; it's Pumpkin's one-liner search.

The code originally looked like this:

for (i=0;(inumStructureStats)(asStructureStats[i].type !=
REF_RESOURCE_EXTRACTOR);i++);  // find resource stat
if( (i  numStructureStats)  (apStructTypeLists[selectedPlayer][i]
== UNAVAILABLE))   // check if you can build it!
{
item = MT_BLOCKING; // don't allow
build pointer.
}

What it's doing is this:

// find resource stat
i=0;
while (inumStructureStats  asStructureStats[i].type !=
REF_RESOURCE_EXTRACTOR)
{
i++;
}

// check if you can build it!
if(i  numStructureStats  apStructTypeLists[selectedPlayer][i] == UNAVAILABLE)
{
item = MT_BLOCKING; // don't allow
build pointer.
}

-Zarel

___
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev