Bug #847

ai_outpost.cpp in x86-64 does not compile - cast to uint32

Added by guepe over 8 years ago. Updated about 8 years ago.

Status:Closed Start date:05/07/2010
Priority:Normal Due date:
Assignee:vl % Done:

100%

Category:Services: General
Target version:Version 0.8.0

Description

In ai_outpost.cpp there are assumptions about target architecture (32bits), which raises an error when compiling in 64bits.

ai_outpost.cpp:897: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::spawnSquad(uint32)’:
ai_outpost.cpp:914: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp:935: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::despawnSquad(uint32)’:
ai_outpost.cpp:951: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::deleteSquad(uint32)’:
ai_outpost.cpp:976: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::sendOutpostSquadStatus(CGroupNpc*)’:
ai_outpost.cpp:991: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::squadLeaderDied(CGroupNpc*)’:
ai_outpost.cpp:1014: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision
ai_outpost.cpp: In member function ‘void COutpost::squadDied(CGroupNpc*)’:
ai_outpost.cpp:1024: erreur: cast from ‘CGroupNpc*’ to ‘uint32’ loses precision

Changing unint32 to size_t should make it compile, but there are aother errors, in other files. I am checking them.

History

#1 Updated by thorbjorn over 8 years ago

This is either a duplicate or a subtask of bug #853. Unfortunately since these uint32 are used as group ID, it is probably not as easy as changing the casts (assuming the group ID needs to be unique).

#2 Updated by kervala over 8 years ago

  • Status changed from New to Rejected

Thanks for reporting :)

#3 Updated by kervala over 8 years ago

  • Status changed from Rejected to New

#4 Updated by vl about 8 years ago

  • Status changed from New to Assigned
  • Assignee set to vl
  • Target version set to Version 0.8.0

The current solution is to downcast the 64b pointer into 32b.

The probability to have a group id conflict is negligible.

We cannot change the type of the groupid because the groupid is streamed on network between different services.

#5 Updated by vl about 8 years ago

  • Category set to Services: General

#6 Updated by vl about 8 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Applied in changeset r235.

#7 Updated by vl about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF