endif(NOT CMAKE_BUILD_TYPE)
message("CMake build type: ${CMAKE_BUILD_TYPE}")
-set(CMAKE_CXX_FLAGS "-Wall -Wno-parentheses -pedantic --std=gnu++11 ${CMAKE_CXX_FLAGS}")
+set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-parentheses -pedantic --std=gnu++11 ${CMAKE_CXX_FLAGS}")
if(APPLE)
set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
glPopMatrix();
glRotatef(Person::players[0]->lookyaw * -1 + 180, 0, 0, 1);
glTranslatef(-(center.x / terrain.scale / 256 * -2 + 1), (center.z / terrain.scale / 256 * -2 + 1), 0);
- for (int i = 0; i < Object::objects.size(); i++) {
+ for (unsigned int i = 0; i < Object::objects.size(); i++) {
if (Object::objects[i]->type == treetrunktype) {
distcheck = distsq(&Person::players[0]->coords, &Object::objects[i]->position);
if (distcheck < mapviewdist) {
int closest = -1;
float closestdist = std::numeric_limits<float>::max();
- for (int i = 0; i < Object::objects.size(); i++) {
- float distance = distsq(&Object::objects[i]->position, &Person::players[0]->coords);
+ for (unsigned int i = 0; i < Object::objects.size(); i++) {
+ float distance = distsq(&Object::objects[i]->position,
+ &Person::players[0]->coords);
if (distance < closestdist) {
closestdist = distance;
- closest = i;
+ closest = (int) i;
}
}
return closest;
"Textures/Skybox(snow)/Down.jpg");
-
-
texdetail = temptexdetail;
} else if (environment == desertenvironment) {
windvector = 0;
"Textures/Skybox(sand)/Down.jpg");
-
-
texdetail = temptexdetail;
} else if (environment == grassyenvironment) {
windvector = 0;
"Textures/Skybox(grass)/Down.jpg");
-
texdetail = temptexdetail;
}
temptexdetail = texdetail;
freeze = 0;
winfreeze = 0;
- for (int i = 0; i < 100; i++)
+ for (unsigned char i = 0; i < 100; i++)
bonusnum[i] = 0;
numfalls = 0;
/* Grow tree leaves?? */
if (Input::isKeyPressed(SDL_SCANCODE_Y)) {
- for (int i = 0; i < Object::objects.size(); i++) {
- if (Object::objects[i]->type == treeleavestype) {
- Object::objects[i]->scale *= .9;
+ for (auto& an_object : Object::objects) {
+ if (an_object->type == treeleavestype) {
+ an_object->scale *= .9;
}
}
}
terrain.decalalivetime[j] < 2)
terrain.DeleteDecal(j);
}
- for (int l = 0; l < Object::objects.size(); l++) {
+ for (unsigned int l = 0; l < Object::objects.size(); l++) {
if (Object::objects[l]->model.type == decalstype)
for (int j = 0; j < Object::objects[l]->model.numdecals; j++) {
if ((Object::objects[l]->model.decaltype[j] == blooddecal ||
terrain.DeleteDecal(j);
}
}
- for (int l = 0; l < Object::objects.size(); l++) {
+ for (unsigned int l = 0; l < Object::objects.size(); l++) {
if (Object::objects[l]->model.type == decalstype)
for (int j = 0; j < Object::objects[l]->model.numdecals; j++) {
if ((Object::objects[l]->model.decaltype[j] == blooddecal ||
Person::players[i]->avoidsomething = 0;
//avoid flaming things
- for (int j = 0; j < Object::objects.size(); j++)
+ for (unsigned int j = 0; j < Object::objects.size(); j++)
if (Object::objects[j]->onfire)
if (distsq(&Person::players[i]->coords, &Object::objects[j]->position) < sq(Object::objects[j]->scale) * 200)
if ( distsq(&Person::players[i]->coords, &Object::objects[j]->position) <
}
}
-bool Model::loadnotex(const std::string& filename )
+bool Model::loadnotex(const std::string& filename)
{
FILE *tfile;
long i;
}
-bool Model::load(const std::string& filename, bool texture )
+bool Model::load(const std::string& filename, bool texture)
{
FILE *tfile;
long i;
}
Model::Model()
+ : vertexNum(0), TriangleNum(0),
+ hastexture(0),
+ type(0), oldtype(0),
+ possible(0),
+ owner(0),
+ vertex(0),
+ normals(0),
+ facenormals(0),
+ Triangles(0),
+ vArray(0)
{
- vertexNum = 0, TriangleNum = 0;
- hastexture = 0;
-
- type = 0, oldtype = 0;
-
- possible = 0;
- owner = 0;
- vertex = 0;
- normals = 0;
- facenormals = 0;
- Triangles = 0;
- vArray = 0;
-
memset(&modelTexture, 0, sizeof(modelTexture));
numpossible = 0;
color = 0;
type = nothing;
}
-
{
float maxdistance = 0;
float tempdist;
- for (int i = 0; i < objects.size(); i++) {
+ for (unsigned int i = 0; i < objects.size(); i++) {
tempdist = distsq(¢er, &objects[i]->position);
if (tempdist > maxdistance) {
maxdistance = tempdist;
maxy = max(startpoint.y, endpoint.y) + 1;
maxz = max(startpoint.z, endpoint.z) + 1;
- for (int i = 0; i < objects.size(); i++) {
+ for (unsigned int i = 0; i < objects.size(); i++) {
if (checkcollide(startpoint, endpoint, i, minx, miny, minz, maxx, maxy, maxz) != -1) {
- return i;
+ return (int) i;
}
}
}
}
- if (animTarget == spinkickanim || animTarget == staffspinhitreversalanim || animTarget == staffspinhitreversedanim || animTarget == staffhitreversalanim || animTarget == staffhitreversedanim || animTarget == hurtidleanim || animTarget == winduppunchanim || animTarget == swordslashreversalanim || animTarget == swordslashreversedanim || animTarget == knifeslashreversalanim || animTarget == knifeslashreversedanim || animTarget == knifethrowanim || animTarget == knifefollowanim || animTarget == knifefollowedanim || animTarget == killanim || animTarget == dropkickanim || animTarget == upunchanim || animTarget == knifeslashstartanim || animTarget == swordslashanim || animTarget == staffhitanim || animTarget == staffspinhitanim || animTarget == staffgroundsmashanim || animTarget == spinkickreversalanim || animTarget == sweepreversalanim || animTarget == lowkickanim || animTarget == sweepreversedanim || animTarget == rabbitkickreversalanim || animTarget == rabbitkickreversedanim || animTarget == jumpreversalanim || animTarget == jumpreversedanim) {
+ if (animTarget == spinkickanim ||
+ animTarget == staffspinhitreversalanim ||
+ animTarget == staffspinhitreversedanim ||
+ animTarget == staffhitreversalanim ||
+ animTarget == staffhitreversedanim ||
+ animTarget == hurtidleanim ||
+ animTarget == winduppunchanim ||
+ animTarget == swordslashreversalanim ||
+ animTarget == swordslashreversedanim ||
+ animTarget == knifeslashreversalanim ||
+ animTarget == knifeslashreversedanim ||
+ animTarget == knifethrowanim ||
+ animTarget == knifefollowanim ||
+ animTarget == knifefollowedanim ||
+ animTarget == killanim ||
+ animTarget == dropkickanim ||
+ animTarget == upunchanim ||
+ animTarget == knifeslashstartanim ||
+ animTarget == swordslashanim ||
+ animTarget == staffhitanim ||
+ animTarget == staffspinhitanim ||
+ animTarget == staffgroundsmashanim ||
+ animTarget == spinkickreversalanim ||
+ animTarget == sweepreversalanim ||
+ animTarget == lowkickanim ||
+ animTarget == sweepreversedanim ||
+ animTarget == rabbitkickreversalanim ||
+ animTarget == rabbitkickreversedanim ||
+ animTarget == jumpreversalanim ||
+ animTarget == jumpreversedanim) {
//close hands and yell
- if (righthandmorphend != 1 && righthandmorphness == targetrighthandmorphness) {
+ if (righthandmorphend != 1 &&
+ righthandmorphness == targetrighthandmorphness) {
righthandmorphness = 0;
righthandmorphend = 1;
targetrighthandmorphness = 1;
}
- if (lefthandmorphend != 1 && lefthandmorphness == targetlefthandmorphness) {
+ if (lefthandmorphend != 1 &&
+ lefthandmorphness == targetlefthandmorphness) {
lefthandmorphness = 0;
lefthandmorphend = 1;
targetlefthandmorphness = 1;
ReflectVector(&facing, terrainnormal);
Normalise(&facing);
- if (isRun() || animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
+ if (isRun() ||
+ animTarget == sneakanim || animTarget == rollanim || animTarget == walkanim) {
if (onterrain)
targettilt2 = -facing.y * 20;
else