Author Topic: gcc 3.4 patches + bugs  (Read 1525 times)

Karosh_Steinkatz

  • Hydlaa Citizen
  • *
  • Posts: 486
    • View Profile
gcc 3.4 patches + bugs
« on: June 14, 2004, 10:40:34 pm »
After some time I decided to give the cvs another shot with gcc 3.4 so I downloaded the sources of CS, CEL and CB CVS today again.

Part I: the patches

The compile attempt gave me the same errors as the last time. But now I decided to make diff files to document the changes:

src/common/util/genqueue.cpp: this corrects a spelling error
Quote

56,57c56,57
<     qstart = others.qstart;
<     qend = others.qend;
---
>     qstart = other.qstart;
>     qend = other.qend;


src/common/util/genqueue.h: same as above
Quote

87c87
<   return ((qend + 1) % size) == qstart;
---
>   return ((qend + 1) % qsize) == qstart;


src/client/modehandler.cpp: this is a fix for gcc 3.4 since it doesnt allow variables as case events
Quote

907c907
<             case event.COMBAT_BLOCK:
---
>             case 1:
913c913
<             case event.COMBAT_DAMAGE:
---
>             case 2:
919c919
<             case event.COMBAT_DEATH:
---
>             case 5:
925c925
<             case event.COMBAT_DODGE:
---
>             case 0:
931c931
<             case event.COMBAT_MISS:
---
>             case 3:
937c937
<             case event.COMBAT_OUTOFRANGE:
---
>             case 4:
949c949
<             case event.COMBAT_BLOCK:
---
>             case 1:
955c955
<             case event.COMBAT_DAMAGE:
---
>             case 2:
961c961
<             case event.COMBAT_DEATH:
---
>             case 5:
967c967
<             case event.COMBAT_DODGE:
---
>             case 0:
973c973
<             case event.COMBAT_MISS:
---
>             case 3:
979c979
<             case event.COMBAT_OUTOFRANGE:
---
>             case 4:
991c991
<             case event.COMBAT_BLOCK:
---
>             case 1:
997c997
<             case event.COMBAT_DAMAGE:
---
>             case 2:
1003c1003
<             case event.COMBAT_DEATH:
---
>             case 5:
1009c1009
<             case event.COMBAT_DODGE:
---
>             case 0:
1015c1015
<             case event.COMBAT_MISS:
---
>             case 3:
1021c1021
<             case event.COMBAT_OUTOFRANGE:
---
>             case 4:


src/server/npcmanager.cpp: same as above
Quote

327c327
<             case list.CMD_DRDATA:
---
>             case 1:
368c368
<             case list.CMD_ATTACK:
---
>             case 2:


Now PS compiled with a bunch of warnings, most of them about boolean operations always being false

Part II: the bugs

After I started the client it froze at the splash screen. But I discovered that you need to click into the window to let the main menu appear. And here is the next bug: If you click on a (invisible) edit field, the screen freezes too including the cursor. You can enter the values like name and password, but the game window shows no reaction. You have to click next to the edit field to unlock the it again. Same goes for the server select list and it\'s scroll arrows.

Then after logging in and entering the npcroom I noticed that this issue continues if you click in the text display area of the chat window or the edit field where you enter the text. Most other widgets or windows are not affected by this, but I didn\'t test them all.

Then there is the info window, which doesnt fade if you enter it with the cursor. Same for the inventory window, but there is only the title bar fading.

Edit:removed some typos
« Last Edit: June 14, 2004, 10:43:53 pm by Karosh_Steinkatz »


Back to Planeshift again \\o/

Karosh_Steinkatz

  • Hydlaa Citizen
  • *
  • Posts: 486
    • View Profile
(No subject)
« Reply #1 on: June 15, 2004, 10:19:54 pm »
Now I edited a bunch of files to get rid of the compilation warnings in the hope that the gui bugs will vanish. PS now compiles without any errors or warnings but the bugs still remain, so I guess this isn\'t a gcc 3.4 issue.


src/common/paws/pawsmanager.cpp: this fixes the csString \"call will abort at runtime\" issue
Quote

109c109
<         Error2(\"Failed to load prefsFile \'%s\'\", prefsFile);
---
>         Error2(\"Failed to load prefsFile \'%s\'\", (const char *) prefsFile);
111c111
<         Error2(\"Failed to load borderFile \'%s\'\", borderFile);
---
>         Error2(\"Failed to load borderFile \'%s\'\", (const char *) borderFile);


src/server/paladinjr.cpp: this gives a proper type conversion
Quote

126c126
<     if (abs(posChange.x) > abs(maxmove.x) || abs(posChange.z) > abs(maxmove.z))
---
>     if (abs((int) posChange.x) > abs((int) maxmove.x) || abs((int) posChange.z) > abs((int) maxmove.z))


src/server/bulkobjects/psraceinfo.cpp: the compiler doesn\'t like enum types in comparisons, resulting in always being false
Quote

125c125
< float psRaceInfo::GetBaseAttribute(PSITEMSTATS_STAT attrib)
---
> float psRaceInfo::GetBaseAttribute(int attrib)
133c133
< void psRaceInfo::SetBaseAttribute(PSITEMSTATS_STAT attrib, float val)
---
> void psRaceInfo::SetBaseAttribute(int attrib, float val)


src/server/bulkobjects/psraceinfo.h: fixes the prototypes of the above
Quote

49,50c49,50
<     float GetBaseAttribute(PSITEMSTATS_STAT attrib);
<     void  SetBaseAttribute(PSITEMSTATS_STAT attrib, float val);
---
>     float GetBaseAttribute(int attrib);
>     void  SetBaseAttribute(int attrib, float val);


src/server/bulkobjects/psitemstats.cpp: same error as the one before
Quote

725c725
< float psItemStats::GetVisibleAttributeModification(PSITEMSTATS_STAT index)
---
> float psItemStats::GetVisibleAttributeModification(int index)
732c732
< void psItemStats::SetVisibleAttributeModification(PSITEMSTATS_STAT index,float v)
---
> void psItemStats::SetVisibleAttributeModification(int index,float v)


src/server/bulkobjects/psitemstats.h:  and again the fix for the prototypes
Quote

379,380c379,380
<     float GetVisibleAttributeModification(PSITEMSTATS_STAT index);
<     void SetVisibleAttributeModification(PSITEMSTATS_STAT index,float v);
---
>     float GetVisibleAttributeModification(int index);
>     void SetVisibleAttributeModification(int index,float v);


src/server/bulkobjects/pscharacter.cpp: guess what? Again the same
Quote

655c655
< float psCharacter::GetStat(PSITEMSTATS_STAT attrib)
---
> float psCharacter::GetStat(int attrib)
664c664
< void psCharacter::SetStat(PSITEMSTATS_STAT attrib, float val)
---
> void psCharacter::SetStat(int attrib, float val)
673c673
< float psCharacter::GetBaseStat(PSITEMSTATS_STAT attrib)
---
> float psCharacter::GetBaseStat(int attrib)
681c681
< void psCharacter::SetBaseStat(PSITEMSTATS_STAT attrib, float val)
---
> void psCharacter::SetBaseStat(int attrib, float val)
691c691
< void psCharacter::SetStatToBaseValue(PSITEMSTATS_STAT attrib)
---
> void psCharacter::SetStatToBaseValue(int attrib)



src/server/bulkobjects/pscharacter.h: last one, prototype fixes again
Quote

412,416c412,416
<     float GetStat(PSITEMSTATS_STAT attrib);
<     void SetStat(PSITEMSTATS_STAT attrib, float val);
<     float GetBaseStat(PSITEMSTATS_STAT attrib);
<     void SetBaseStat(PSITEMSTATS_STAT attrib, float val);
<     void SetStatToBaseValue(PSITEMSTATS_STAT attrib);
---
>     float GetStat(int attrib);
>     void SetStat(int attrib, float val);
>     float GetBaseStat(int attrib);
>     void SetBaseStat(int attrib, float val);
>     void SetStatToBaseValue(int attrib);


Are others affected by the gui bugs as well? Or is this just happening to me?

Edit: If you are interested in the diff files, you can grab them here: cvs_diffs.zip
« Last Edit: June 15, 2004, 10:31:46 pm by Karosh_Steinkatz »


Back to Planeshift again \\o/

dfryer

  • Veteran
  • *
  • Posts: 1070
    • View Profile
(No subject)
« Reply #2 on: June 16, 2004, 08:25:02 pm »
Replacing named cases with hard-coded numbers is generally a Bad Idea.
Quidquid latine dictum sit, altum sonatur.

Karosh_Steinkatz

  • Hydlaa Citizen
  • *
  • Posts: 486
    • View Profile
(No subject)
« Reply #3 on: June 17, 2004, 12:03:11 am »
Maybe I should replace the enums with #defines, but this was the first idea which came up to my mind.


Back to Planeshift again \\o/

acraig

  • Administrator
  • Veteran
  • *
  • Posts: 1562
    • View Profile
(No subject)
« Reply #4 on: June 17, 2004, 03:57:25 am »
Hmm, I will have to build gcc 3.4 at some point and verify these things.  Right now I am using 3.3 and don\'t have any of these errors.  So this is really good for when I do update and hit these I can already stick some fixes in there.  However, I probably won\'t add these things until I do update my gcc version.
----------
Andrew
"For all I know, she's lying, everyone's lying; welcome to the Internet"

ElMago

  • Traveller
  • *
  • Posts: 22
    • View Profile
(No subject)
« Reply #5 on: August 28, 2004, 03:17:51 am »
gcc 3.4.1+ has a new feature that can build more optimized shared libraries, that coudl be used, that could be used on CS to speed up loading of shared objets and reduce the size of them too. The developer that made this pattch said that with a C++ extreme example he was able to reduce loading time from 8 minutes to a few seconds and reduce a lot the size of the shared libraries.