Permalink
Browse files

Clean up casts: convert to C++-style.

  • Loading branch information...
1 parent b3a591e commit 70944debf962103e54c0ae14fa9058f8f3bd20b2 Darren Salt committed May 11, 2011
Showing with 583 additions and 566 deletions.
  1. +2 −1 debian/rules
  2. +2 −2 src/AmbientSounds.cpp
  3. +1 −1 src/BezierCurve.h
  4. +2 −2 src/Body.cpp
  5. +2 −2 src/BufferObject.h
  6. +11 −11 src/CityOnPlanet.cpp
  7. +4 −4 src/CommodityTradeWidget.cpp
  8. +1 −1 src/DeadVideoLink.cpp
  9. +7 −7 src/DynamicBody.cpp
  10. +1 −1 src/FaceVideoLink.cpp
  11. +1 −1 src/Frame.cpp
  12. +2 −2 src/GalacticView.cpp
  13. +3 −3 src/Galaxy.cpp
  14. +2 −2 src/GameMenuView.cpp
  15. +1 −1 src/GenericChatForm.cpp
  16. +20 −20 src/GeoSphere.cpp
  17. +1 −1 src/GeoSphereStyle.cpp
  18. +4 −4 src/Gui.cpp
  19. +3 −3 src/GuiImage.cpp
  20. +2 −2 src/GuiMultiStateImageButton.cpp
  21. +5 −5 src/GuiScreen.cpp
  22. +2 −2 src/GuiTextEntry.cpp
  23. +1 −1 src/GuiTextEntry.h
  24. +3 −3 src/GuiTextLayout.cpp
  25. +1 −1 src/GuiToolTip.cpp
  26. +4 −4 src/GuiVScrollBar.cpp
  27. +3 −3 src/GuiWidget.cpp
  28. +3 −3 src/HyperspaceCloud.cpp
  29. +3 −3 src/InfoView.cpp
  30. +19 −19 src/KeyBindings.cpp
  31. +24 −24 src/LmrModel.cpp
  32. +1 −1 src/LuaChatForm.cpp
  33. +1 −1 src/LuaEquipType.cpp
  34. +1 −1 src/LuaFormat.cpp
  35. +7 −7 src/LuaModelViewer.cpp
  36. +6 −6 src/LuaObject.cpp
  37. +5 −5 src/LuaPlayer.cpp
  38. +1 −1 src/LuaSBodyPath.cpp
  39. +6 −6 src/LuaSerializer.cpp
  40. +4 −4 src/LuaShip.cpp
  41. +1 −1 src/LuaShipType.cpp
  42. +6 −6 src/ModelBody.cpp
  43. +6 −6 src/MyLuaMathTypes.cpp
  44. +8 −8 src/ObjectViewerView.cpp
  45. +12 −12 src/Pi.cpp
  46. +15 −15 src/Planet.cpp
  47. +3 −3 src/Player.cpp
  48. +2 −2 src/Polit.cpp
  49. +2 −2 src/Projectile.cpp
  50. +1 −1 src/Quaternion.h
  51. +3 −3 src/Render.cpp
  52. +3 −3 src/Sector.cpp
  53. +2 −2 src/SectorView.cpp
  54. +47 −33 src/Serializer.cpp
  55. +1 −1 src/Sfx.cpp
  56. +42 −42 src/Ship.cpp
  57. +4 −4 src/ShipAICmd.cpp
  58. +5 −5 src/ShipAICmd.h
  59. +2 −2 src/ShipCpanel.cpp
  60. +8 −8 src/ShipCpanelMultiFuncDisplays.cpp
  61. +1 −1 src/ShipCpanelMultiFuncDisplays.h
  62. +1 −1 src/ShipFlavour.cpp
  63. +3 −3 src/ShipType.cpp
  64. +1 −1 src/ShipType.h
  65. +15 −15 src/Sound.cpp
  66. +8 −8 src/Space.cpp
  67. +15 −15 src/SpaceStation.cpp
  68. +12 −12 src/SpaceStationView.cpp
  69. +5 −5 src/Star.cpp
  70. +7 −7 src/StarSystem.cpp
  71. +5 −5 src/SystemInfoView.cpp
  72. +4 −4 src/SystemView.cpp
  73. +1 −1 src/View.h
  74. +55 −55 src/WorldView.cpp
  75. +12 −12 src/collider/CollisionSpace.cpp
  76. +5 −5 src/collider/Geom.cpp
  77. +3 −3 src/collider/GeomTree.cpp
  78. +4 −4 src/fixed.h
  79. +27 −27 src/glfreetype.cpp
  80. +8 −8 src/matrix4x4.h
  81. +1 −1 src/oolua/base_checker.h
  82. +8 −8 src/oolua/class_from_stack.h
  83. +1 −1 src/oolua/member_func_helper.h
  84. +2 −2 src/oolua/oolua_registration.h
  85. +10 −8 src/oolua/oolua_storage.h
  86. +2 −2 src/oolua/push_pointer_internal.h
  87. +1 −1 src/perlin.cpp
  88. +7 −7 src/utils.cpp
  89. +1 −1 src/utils.h
  90. +13 −13 src/vector3.h
View
@@ -16,7 +16,8 @@ endif
PIONEER_DATA_DIR = /usr/share/games/pioneer/data
CFLAGS = $(OPTIMISE) -g -Wformat=2 -Wformat-security -Wstrict-aliasing=2 \
- -Wmissing-format-attribute -Wmissing-noreturn -Wdisabled-optimization
+ -Wmissing-format-attribute -Wmissing-noreturn -Wdisabled-optimization \
+ -Wstrict-null-sentinel -Wold-style-cast -Wsign-promo
%:
dh $@ --with autoreconf --parallel
View
@@ -119,7 +119,7 @@ void AmbientSounds::Update()
if (astro->IsType(Object::PLANET)) {
double dist = Pi::player->GetPosition().Length();
double pressure, density;
- ((Planet*)astro)->GetAtmosphericState(dist, &pressure, &density);
+ static_cast<Planet*>(astro)->GetAtmosphericState(dist, &pressure, &density);
if (pressure < 0.001) {
// Stop playing surface noise once out of the atmosphere
planetSurfaceNoise.Stop();
@@ -191,7 +191,7 @@ void AmbientSounds::Update()
if ((astro = Pi::player->GetFrame()->m_astroBody) && (astro->IsType(Object::PLANET))) {
double dist = Pi::player->GetPosition().Length();
double pressure, density;
- ((Planet*)astro)->GetAtmosphericState(dist, &pressure, &density);
+ static_cast<Planet*>(astro)->GetAtmosphericState(dist, &pressure, &density);
// maximum volume at around 2km/sec at earth density, pressure
double volume = density * Pi::player->GetVelocity().Length() * 0.0005;
volume = Clamp(volume, 0.0, 1.0) * v_env;
View
@@ -27,7 +27,7 @@ class BezierCurve {
int n_points = p.size()-1;
BezierCurve out(n_points);
for (int i=0; i<n_points; i++) {
- out.p[i] = (double)n_points * (p[i+1] - p[i]);
+ out.p[i] = double(n_points) * (p[i+1] - p[i]);
}
return out;
}
View
@@ -48,7 +48,7 @@ void Body::Load(Serializer::Reader &rd)
void Body::Serialize(Serializer::Writer &_wr)
{
Serializer::Writer wr;
- wr.Int32((int)GetType());
+ wr.Int32(int(GetType()));
switch (GetType()) {
case Object::STAR:
case Object::PLANET:
@@ -75,7 +75,7 @@ Body *Body::Unserialize(Serializer::Reader &_rd)
{
Serializer::Reader rd = _rd.RdSection("Body");
Body *b = 0;
- Object::Type type = (Object::Type)rd.Int32();
+ Object::Type type = Object::Type(rd.Int32());
switch (type) {
case Object::STAR:
b = new Star(); break;
View
@@ -49,9 +49,9 @@ class BufferObject {
if ( (!Render::IsArrayBufferBound(m_vertexArrayBufferObject)) ||
(!Render::IsElementArrayBufferBound(m_elementArrayBufferObject)) ) {
Render::BindArrayBuffer(m_vertexArrayBufferObject);
- glNormalPointer(GL_FLOAT, VERTEX_SIZE, (void *)(3*sizeof(float)));
+ glNormalPointer(GL_FLOAT, VERTEX_SIZE, reinterpret_cast<void *>(3*sizeof(float)));
glVertexPointer(3, GL_FLOAT, VERTEX_SIZE, 0);
- glTexCoordPointer(2, GL_FLOAT, VERTEX_SIZE, (void *)(2*3*sizeof(float)));
+ glTexCoordPointer(2, GL_FLOAT, VERTEX_SIZE, reinterpret_cast<void *>(2*3*sizeof(float)));
Render::BindElementArrayBuffer(m_elementArrayBufferObject);
}
}
View
@@ -98,7 +98,7 @@ void CityOnPlanet::PutCityBit(MTRand &rand, const matrix4x4d &rot, vector3d p1,
Geom *geom = new Geom(cmesh->geomTree);
int rotTimes90 = rand.Int32(4);
- matrix4x4d grot = rot * matrix4x4d::RotateYMatrix(M_PI*0.5*(double)rotTimes90);
+ matrix4x4d grot = rot * matrix4x4d::RotateYMatrix(M_PI*0.5*double(rotTimes90));
geom->MoveTo(grot, cent);
geom->SetUserData(this);
// f->AddStaticGeom(geom);
@@ -212,7 +212,7 @@ CityOnPlanet::CityOnPlanet(Planet *planet, SpaceStation *station, Uint32 seed)
double a = rand.Int32(-1000,1000);
double b = rand.Int32(-1000,1000);
cityflavour[i].center = p + a*mx + b*mz;
- cityflavour[i].size = rand.Int32((int)blist->minRadius, (int)blist->maxRadius);
+ cityflavour[i].size = rand.Int32(int(blist->minRadius), int(blist->maxRadius));
}
for (int side=0; side<4; side++) {
@@ -264,17 +264,17 @@ void CityOnPlanet::Render(const SpaceStation *station, const vector3d &viewCoord
rot[0] = viewTransform * rot[0];
for (int i=1; i<4; i++) {
- rot[i] = rot[0] * matrix4x4d::RotateYMatrix(M_PI*0.5*(double)i);
+ rot[i] = rot[0] * matrix4x4d::RotateYMatrix(M_PI*0.5*double(i));
}
GetFrustum(planes);
memset(&cityobj_params, 0, sizeof(LmrObjParams));
// this fucking rubbish needs to be moved into a function
- cityobj_params.argFloats[1] = (float)Pi::GetGameTime();
- cityobj_params.argFloats[2] = (float)(Pi::GetGameTime() / 60.0);
- cityobj_params.argFloats[3] = (float)(Pi::GetGameTime() / 3600.0);
- cityobj_params.argFloats[4] = (float)(Pi::GetGameTime() / (24*3600.0));
+ cityobj_params.argFloats[1] = float(Pi::GetGameTime());
+ cityobj_params.argFloats[2] = float(Pi::GetGameTime() / 60.0);
+ cityobj_params.argFloats[3] = float(Pi::GetGameTime() / 3600.0);
+ cityobj_params.argFloats[4] = float(Pi::GetGameTime() / (24*3600.0));
for (std::vector<BuildingDef>::const_iterator i = m_buildings.begin();
@@ -293,10 +293,10 @@ void CityOnPlanet::Render(const SpaceStation *station, const vector3d &viewCoord
}
if (cull) continue;
matrix4x4f _rot;
- for (int e=0; e<16; e++) _rot[e] = (float)rot[(*i).rotation][e];
- _rot[12] = (float)pos.x;
- _rot[13] = (float)pos.y;
- _rot[14] = (float)pos.z;
+ for (int e=0; e<16; e++) _rot[e] = float(rot[(*i).rotation][e]);
+ _rot[12] = float(pos.x);
+ _rot[13] = float(pos.y);
+ _rot[14] = float(pos.z);
(*i).model->Render(_rot, &cityobj_params);
}
}
@@ -27,21 +27,21 @@ void CommodityTradeWidget::ShowAll()
int NUM_ITEMS = 0;
const float YSEP = floor(Gui::Screen::GetFontHeight() * 2.5f);
- for (int i=(int)Equip::FIRST_COMMODITY; i<=Equip::LAST_COMMODITY; i++) {
+ for (int i=Equip::FIRST_COMMODITY; i<=Equip::LAST_COMMODITY; i++) {
assert(EquipType::types[i].slot == Equip::SLOT_CARGO);
- if (m_seller->DoesSell((Equip::Type)i)) {
+ if (m_seller->DoesSell(Equip::Type(i))) {
NUM_ITEMS++;
}
}
Gui::Fixed *innerbox = new Gui::Fixed(450, NUM_ITEMS*YSEP);
innerbox->SetTransparency(true);
const float iconOffset = 8.0f;
- for (int i=(int)Equip::FIRST_COMMODITY, num=0; i<=Equip::LAST_COMMODITY; i++) {
+ for (int i=Equip::FIRST_COMMODITY, num=0; i<=Equip::LAST_COMMODITY; i++) {
assert(EquipType::types[i].slot == Equip::SLOT_CARGO);
- if (!m_seller->DoesSell((Equip::Type)i)) continue;
+ if (!m_seller->DoesSell(Equip::Type(i))) continue;
int stock = m_seller->GetStock(static_cast<Equip::Type>(i));
// need to replace spaces in the item name
View
@@ -71,7 +71,7 @@ void DeadVideoLink::DrawMessage() {
}
void DeadVideoLink::PutRandomCrapIntoTexture() {
- int *randcrap = (int*)alloca(TEXSIZE*TEXSIZE);
+ int *randcrap = static_cast<int*>(alloca(TEXSIZE*TEXSIZE));
for (unsigned int i=0; i<TEXSIZE*TEXSIZE/sizeof(int); i++) randcrap[i] = (Pi::rng.Int32() & 0xfcfcfcfc) >> 2;
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, TEXSIZE, TEXSIZE, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, randcrap);
}
View
@@ -162,8 +162,8 @@ void DynamicBody::TimeStepUpdate(const float timeStep)
m_force += m_externalForce;
m_oldOrient = m_orient;
- m_vel += (double)timeStep * m_force * (1.0 / m_mass);
- m_angVel += (double)timeStep * m_torque * (1.0 / m_angInertia);
+ m_vel += double(timeStep) * m_force * (1.0 / m_mass);
+ m_angVel += double(timeStep) * m_torque * (1.0 / m_angInertia);
// angvel is always relative to non-rotating frame, so need to counter frame angvel
vector3d consideredAngVel = m_angVel - GetFrame()->GetAngVelocity();
@@ -180,7 +180,7 @@ void DynamicBody::TimeStepUpdate(const float timeStep)
}
m_oldAngDisplacement = consideredAngVel * timeStep;
- pos += m_vel * (double)timeStep;
+ pos += m_vel * double(timeStep);
m_orient[12] = pos.x;
m_orient[13] = pos.y;
m_orient[14] = pos.z;
@@ -202,9 +202,9 @@ void DynamicBody::TimeStepUpdate(const float timeStep)
// for timestep changes, to stop autopilot overshoot
void DynamicBody::ApplyAccel(const float timeStep)
{
- vector3d newvel = m_vel + (double)timeStep * m_force * (1.0 / m_mass);
+ vector3d newvel = m_vel + double(timeStep) * m_force * (1.0 / m_mass);
if (newvel.LengthSqr() < m_vel.LengthSqr()) m_vel = newvel;
- vector3d newav = m_angVel + (double)timeStep * m_torque * (1.0 / m_angInertia);
+ vector3d newav = m_angVel + double(timeStep) * m_torque * (1.0 / m_angInertia);
if (newav.LengthSqr() < m_angVel.LengthSqr()) m_angVel = newav;
}
@@ -216,7 +216,7 @@ void DynamicBody::UpdateInterpolatedTransform(double alpha)
m_interpolatedTransform = m_oldOrient;
{
- double len = m_oldAngDisplacement.Length() * (double)alpha;
+ double len = m_oldAngDisplacement.Length() * double(alpha);
if (len != 0) {
vector3d rotAxis = m_oldAngDisplacement.Normalized();
matrix4x4d rotMatrix = matrix4x4d::RotateMatrix(len,
@@ -312,6 +312,6 @@ bool DynamicBody::OnCollision(Object *o, Uint32 flags, double relVel)
} else {
kineticEnergy = KINETIC_ENERGY_MULT * m_mass * relVel * relVel;
}
- if (kineticEnergy) OnDamage(o, (float)kineticEnergy);
+ if (kineticEnergy) OnDamage(o, float(kineticEnergy));
return true;
}
View
@@ -34,7 +34,7 @@ FaceVideoLink::FaceVideoLink(float w, float h, int flags, unsigned long seed) :
m_created = SDL_GetTicks();
m_message = new Gui::ToolTip("Video link established");
- if (seed == (unsigned long)-1) seed = time(NULL);
+ if (seed == -1UL) seed = time(NULL);
MTRand rand(seed);
//int race = rand.Int32(0,1); // XXX should be 3?
View
@@ -247,7 +247,7 @@ void Frame::UpdateInterpolatedTransform(double alpha)
m_interpolatedTransform = m_oldOrient;
{
- double len = m_oldAngDisplacement.Length() * (double)alpha;
+ double len = m_oldAngDisplacement.Length() * double(alpha);
if (len != 0) {
vector3d rotAxis = m_oldAngDisplacement.Normalized();
matrix4x4d rotMatrix = matrix4x4d::RotateMatrix(len,
View
@@ -87,7 +87,7 @@ void GalacticView::PutLabels(vector3d offset)
vector3d p = m_zoom * (s_labels[i].pos + offset);
vector3d pos;
if (Gui::Screen::Project(p, pos)) {
- m_labels->Add(s_labels[i].label, sigc::ptr_fun(&dummy), (float)pos.x, (float)pos.y);
+ m_labels->Add(s_labels[i].label, sigc::ptr_fun(&dummy), float(pos.x), float(pos.y));
}
}
@@ -169,7 +169,7 @@ void GalacticView::Update()
if (Pi::KeyState(SDLK_MINUS)) m_zoom *= pow(0.25f, frameTime);
m_zoom = Clamp(m_zoom, 0.5f, 100.0f);
- m_scaleReadout->SetText(stringf(128, "%d ly", (int)(0.5*Galaxy::GALAXY_RADIUS/m_zoom)));
+ m_scaleReadout->SetText(stringf(128, "%d ly", int(0.5*Galaxy::GALAXY_RADIUS/m_zoom)));
}
void GalacticView::MouseButtonDown(int button, int x, int y)
View
@@ -35,11 +35,11 @@ Uint8 GetSectorDensity(int sx, int sy)
offset_x = Clamp((offset_x + 1.0)*0.5, 0.0, 1.0);
offset_y = Clamp((offset_y + 1.0)*0.5, 0.0, 1.0);
- int x = (int)floor(offset_x * (s_galaxybmp->w - 1));
- int y = (int)floor(offset_y * (s_galaxybmp->h - 1));
+ int x = int(floor(offset_x * (s_galaxybmp->w - 1)));
+ int y = int(floor(offset_y * (s_galaxybmp->h - 1)));
SDL_LockSurface(s_galaxybmp);
- Uint8 val = ((char*)s_galaxybmp->pixels)[x + y*s_galaxybmp->pitch];
+ Uint8 val = static_cast<char*>(s_galaxybmp->pixels)[x + y*s_galaxybmp->pitch];
SDL_UnlockSurface(s_galaxybmp);
return val;
}
View
@@ -62,7 +62,7 @@ class KeyGetter: public Gui::Fixed {
m_binding.type = KeyBindings::KEYBOARD_KEY;
m_binding.u.keyboard.key = e->keysym.sym;
// get rid of number lock, caps lock, etc
- m_binding.u.keyboard.mod = (SDLMod) (e->keysym.mod & (KMOD_CTRL | KMOD_ALT | KMOD_META | KMOD_SHIFT));
+ m_binding.u.keyboard.mod = SDLMod(e->keysym.mod & (KMOD_CTRL | KMOD_ALT | KMOD_META | KMOD_SHIFT));
Close();
}
@@ -424,7 +424,7 @@ GameMenuView::GameMenuView(): View()
Gui::RadioGroup *g = new Gui::RadioGroup();
SDL_Rect **modes;
modes = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
- if ((modes!=0) && (modes != (SDL_Rect**)-1)) {
+ if ((modes!=0) && (modes != reinterpret_cast<SDL_Rect**>(-1))) {
// box to put the scroll portal and its scroll bar into
Gui::HBox *scrollHBox = new Gui::HBox();
vbox->PackEnd(scrollHBox);
View
@@ -96,7 +96,7 @@ void GenericChatForm::OnCloseChildChatForm(GenericChatForm *form)
ShowAll();
}
-GenericChatForm::GenericChatForm(): Gui::Fixed((float)Gui::Screen::GetWidth(), (float)(Gui::Screen::GetHeight()-64))
+GenericChatForm::GenericChatForm(): Gui::Fixed(float(Gui::Screen::GetWidth()), float(Gui::Screen::GetHeight()-64))
{
ReInit();
}
View
@@ -92,7 +92,7 @@ class GeoPatch {
}
static void Init() {
- GEOPATCH_FRAC = 1.0 / (double)(GEOPATCH_EDGELEN-1);
+ GEOPATCH_FRAC = 1.0 / double(GEOPATCH_EDGELEN-1);
if (midIndices) {
delete [] midIndices;
@@ -317,15 +317,15 @@ class GeoPatch {
{
clipRadius = std::max(clipRadius, (vertices[i]-clipCentroid).Length());
VBOVertex *pData = vbotemp + i;
- pData->x = (float)vertices[i].x;
- pData->y = (float)vertices[i].y;
- pData->z = (float)vertices[i].z;
- pData->nx = (float)normals[i].x;
- pData->ny = (float)normals[i].y;
- pData->nz = (float)normals[i].z;
- pData->col[0] = (unsigned char)Clamp(colors[i].x*255.0, 0.0, 255.0);
- pData->col[1] = (unsigned char)Clamp(colors[i].y*255.0, 0.0, 255.0);
- pData->col[2] = (unsigned char)Clamp(colors[i].z*255.0, 0.0, 255.0);
+ pData->x = float(vertices[i].x);
+ pData->y = float(vertices[i].y);
+ pData->z = float(vertices[i].z);
+ pData->nx = float(normals[i].x);
+ pData->ny = float(normals[i].y);
+ pData->nz = float(normals[i].z);
+ pData->col[0] = static_cast<unsigned char>(Clamp(colors[i].x*255.0, 0.0, 255.0));
+ pData->col[1] = static_cast<unsigned char>(Clamp(colors[i].y*255.0, 0.0, 255.0));
+ pData->col[2] = static_cast<unsigned char>(Clamp(colors[i].z*255.0, 0.0, 255.0));
pData->col[3] = 1.0;
}
glBufferDataARB(GL_ARRAY_BUFFER, sizeof(VBOVertex)*GEOPATCH_NUMVERTICES, vbotemp, GL_DYNAMIC_DRAW);
@@ -832,15 +832,15 @@ class GeoPatch {
if (USE_VBO) {
glBindBufferARB(GL_ARRAY_BUFFER, m_vbo);
glVertexPointer(3, GL_FLOAT, sizeof(VBOVertex), 0);
- glNormalPointer(GL_FLOAT, sizeof(VBOVertex), (void *)(3*sizeof(float)));
- glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(VBOVertex), (void *)(6*sizeof(float)));
+ glNormalPointer(GL_FLOAT, sizeof(VBOVertex), reinterpret_cast<void *>(3*sizeof(float)));
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(VBOVertex), reinterpret_cast<void *>(6*sizeof(float)));
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, indices_vbo);
- glDrawRangeElements(GL_TRIANGLES, 0, GEOPATCH_NUMVERTICES-1, VBO_COUNT_MID_IDX, GL_UNSIGNED_SHORT, (void*)IDX_VBO_MAIN_OFFSET);
+ glDrawRangeElements(GL_TRIANGLES, 0, GEOPATCH_NUMVERTICES-1, VBO_COUNT_MID_IDX, GL_UNSIGNED_SHORT, reinterpret_cast<void*>(IDX_VBO_MAIN_OFFSET));
for (int i=0; i<4; i++) {
if (edgeFriend[i]) {
- glDrawRangeElements(GL_TRIANGLES, s_hiMinIdx[i], s_hiMaxIdx[i], VBO_COUNT_HI_EDGE, GL_UNSIGNED_SHORT, (void*)IDX_VBO_HI_OFFSET(i));
+ glDrawRangeElements(GL_TRIANGLES, s_hiMinIdx[i], s_hiMaxIdx[i], VBO_COUNT_HI_EDGE, GL_UNSIGNED_SHORT, reinterpret_cast<void*>(IDX_VBO_HI_OFFSET(i)));
} else {
- glDrawRangeElements(GL_TRIANGLES, s_loMinIdx[i], s_loMaxIdx[i], VBO_COUNT_LO_EDGE, GL_UNSIGNED_SHORT, (void*)IDX_VBO_LO_OFFSET(i));
+ glDrawRangeElements(GL_TRIANGLES, s_loMinIdx[i], s_loMaxIdx[i], VBO_COUNT_LO_EDGE, GL_UNSIGNED_SHORT, reinterpret_cast<void*>(IDX_VBO_LO_OFFSET(i)));
}
}
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
@@ -1132,13 +1132,13 @@ static void DrawAtmosphereSurface(const vector3d &campos, float rad)
// and angle from this tangent on to atmosphere is:
// acos(planetRadius/atmosphereRadius) ie acos(1.0/1.01244blah)
double endAng = acos(1.0/campos.Length())+acos(1.0/rad);
- double latDiff = endAng / (double)LAT_SEGS;
+ double latDiff = endAng / double(LAT_SEGS);
double rot = 0.0;
float sinCosTable[LONG_SEGS+1][2];
- for (int i=0; i<=LONG_SEGS; i++, rot += 2.0*M_PI/(double)LONG_SEGS) {
- sinCosTable[i][0] = (float)sin(rot);
- sinCosTable[i][1] = (float)cos(rot);
+ for (int i=0; i<=LONG_SEGS; i++, rot += 2.0*M_PI/double(LONG_SEGS)) {
+ sinCosTable[i][0] = float(sin(rot));
+ sinCosTable[i][1] = float(cos(rot));
}
/* Tri-fan above viewer */
@@ -1227,7 +1227,7 @@ void GeoSphere::Render(vector3d campos, const float radius, const float scale) {
camdist = 0.1 / (camdist*camdist);
// why the fuck is this returning 0.1 when we are sat on the planet??
// XXX oh well, it is the value we want anyway...
- ambient[0] = ambient[1] = ambient[2] = (float)camdist;
+ ambient[0] = ambient[1] = ambient[2] = float(camdist);
ambient[3] = 1.0f;
}
View
@@ -434,7 +434,7 @@ void GeoSphereStyle::SetFracDef(struct fracdef_t *def, double featureHeightMeter
// feature
def->amplitude = featureHeightMeters / (m_maxHeight * m_planetRadius);
def->frequency = m_planetRadius / featureWidthMeters;
- def->octaves = std::max(1, (int)ceil(log(featureWidthMeters / smallestOctaveMeters) / log(2.0)));
+ def->octaves = std::max(1, int(ceil(log(featureWidthMeters / smallestOctaveMeters) / log(2.0))));
def->lacunarity = 2.0;
printf("%d octaves\n", def->octaves); //print
}
Oops, something went wrong.

0 comments on commit 70944de

Please sign in to comment.