Skip to content

Commit

Permalink
- Various minor fixes for clang warnings/errors
Browse files Browse the repository at this point in the history
- Removed SLADEMap::*Index stuff because it isn't needed any more
  • Loading branch information
sirjuddington committed Nov 27, 2013
1 parent 3058355 commit d87165d
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 189 deletions.
6 changes: 3 additions & 3 deletions src/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ ArchiveEntry* Archive::findFirst(search_options_t& options)
// Check namespace
if (!options.match_namespace.IsEmpty())
{
if (!S_CMPNOCASE(detectNamespace(entry), options.match_namespace))
if (!(S_CMPNOCASE(detectNamespace(entry), options.match_namespace)))
continue;
}

Expand Down Expand Up @@ -1659,7 +1659,7 @@ ArchiveEntry* Archive::findLast(search_options_t& options)
// Check namespace
if (!options.match_namespace.IsEmpty())
{
if (!S_CMPNOCASE(detectNamespace(entry), options.match_namespace))
if (!(S_CMPNOCASE(detectNamespace(entry), options.match_namespace)))
continue;
}

Expand Down Expand Up @@ -1719,7 +1719,7 @@ vector<ArchiveEntry*> Archive::findAll(search_options_t& options)
// Check namespace
if (!options.match_namespace.IsEmpty())
{
if (!S_CMPNOCASE(detectNamespace(entry), options.match_namespace))
if (!(S_CMPNOCASE(detectNamespace(entry), options.match_namespace)))
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class TreelessArchive : public Archive
virtual ~TreelessArchive() {}

// Entry retrieval/info
virtual ArchiveEntry* getEntry(string name, bool cut_ext = false, ArchiveTreeNode* dir = NULL) { return Archive::getEntry(name, NULL); }
virtual ArchiveEntry* getEntry(string name, bool cut_ext = false, ArchiveTreeNode* dir = NULL) { return Archive::getEntry(name); }
virtual ArchiveEntry* getEntry(unsigned index, ArchiveTreeNode* dir = NULL) { return Archive::getEntry(index, NULL); }
virtual int entryIndex(ArchiveEntry* entry, ArchiveTreeNode* dir = NULL) { return Archive::entryIndex(entry, NULL); }

Expand Down
2 changes: 1 addition & 1 deletion src/ArchiveManagerPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ bool ArchiveManagerPanel::closeSelection()

// Don't continue if there are no selected items
if (selection.size() == 0)
true;
return true;

// Get the list of selected archives
vector<Archive*> selected_archives;
Expand Down
6 changes: 3 additions & 3 deletions src/Conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool Conversions::doomSndToWav(MemChunk& in, MemChunk& out)

// Ensure data ends on even byte boundary
if (header.samples % 2 != 0)
out.write('\0', 1);
out.write("\0", 1);

return true;
}
Expand Down Expand Up @@ -539,7 +539,7 @@ bool Conversions::wolfSndToWav(MemChunk& in, MemChunk& out)

// Ensure data ends on even byte boundary
if (numsamples % 2 != 0)
out.write('\0', 1);
out.write("\0", 1);

return true;
}
Expand Down Expand Up @@ -608,7 +608,7 @@ bool Conversions::jagSndToWav(MemChunk& in, MemChunk& out)

// Ensure data ends on even byte boundary
if (header.samples % 2 != 0)
out.write('\0', 1);
out.write("\0", 1);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MapDisplayPrefsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void MapDisplayPrefsPanel::init()
cb_line_smooth->SetValue(line_smooth);
cb_line_tabs_always->SetValue(line_tabs_always);
choice_thing_drawtype->SetSelection(thing_drawtype);
cb_thing_force_dir = cb_thing_force_dir;
cb_thing_force_dir->SetValue(thing_force_dir);
cb_thing_overlay_square->SetValue(thing_overlay_square);
cb_flat_ignore_light->SetValue(flat_ignore_light);
cb_sector_hilight_fill->SetValue(sector_hilight_fill);
Expand Down
9 changes: 4 additions & 5 deletions src/MapEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,8 @@ void MapEditor::endMove(bool accept)
for (unsigned a = 0; a < move_items.size(); a++)
{
MapLine* line = map.getLine(move_items[a]);
if (line->v1()) move_verts[map.vertexIndex(line->v1())] = true;
if (line->v2()) move_verts[map.vertexIndex(line->v2())] = true;
if (line->v1()) move_verts[line->v1()->getIndex()] = true;
if (line->v2()) move_verts[line->v2()->getIndex()] = true;
}
}
else if (edit_mode == MODE_SECTORS)
Expand All @@ -1409,7 +1409,7 @@ void MapEditor::endMove(bool accept)
map.getSector(move_items[a])->getVertices(sv);

for (unsigned a = 0; a < sv.size(); a++)
move_verts[map.vertexIndex(sv[a])] = true;
move_verts[sv[a]->getIndex()] = true;
}

// Move vertices
Expand Down Expand Up @@ -1510,10 +1510,9 @@ void MapEditor::splitLine(double x, double y, double min_dist)

// Create vertex there
MapVertex* vertex = map.createVertex(closest.x, closest.y);
int vindex = map.vertexIndex(vertex);

// Do line split
map.splitLine(lindex, vindex);
map.splitLine(lindex, vertex->getIndex());

// Finish recording undo level
endUndoRecord();
Expand Down
5 changes: 1 addition & 4 deletions src/MapObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ MapObject::~MapObject()

unsigned MapObject::getIndex()
{
if (parent_map)
return parent_map->objectIndex(this);
else
return index;
return index;
}

string MapObject::getTypeName()
Expand Down
19 changes: 9 additions & 10 deletions src/MapRenderer2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1799,8 +1799,8 @@ void MapRenderer2D::renderMovingVertices(vector<int>& vertices, fpoint2_t move_v
{
MapLine* line = v->connectedLine(l);

if (line->v1() == v) lines_drawn[map->lineIndex(line)] |= 1;
if (line->v2() == v) lines_drawn[map->lineIndex(line)] |= 2;
if (line->v1() == v) lines_drawn[line->getIndex()] |= 1;
if (line->v2() == v) lines_drawn[line->getIndex()] |= 2;
}
}

Expand All @@ -1811,7 +1811,7 @@ void MapRenderer2D::renderMovingVertices(vector<int>& vertices, fpoint2_t move_v
for (unsigned a = 0; a < map->nLines(); a++)
{
MapLine* line = map->getLine(a);
uint8_t drawn = lines_drawn[map->lineIndex(line)];
uint8_t drawn = lines_drawn[line->getIndex()];

// Skip if not attached to any moving vertices
if (drawn == 0)
Expand Down Expand Up @@ -1870,8 +1870,8 @@ void MapRenderer2D::renderMovingLines(vector<int>& lines, fpoint2_t move_vec)
{
MapLine* line = v->connectedLine(l);

if (line->v1() == v) lines_drawn[map->lineIndex(line)] |= 1;
if (line->v2() == v) lines_drawn[map->lineIndex(line)] |= 2;
if (line->v1() == v) lines_drawn[line->getIndex()] |= 1;
if (line->v2() == v) lines_drawn[line->getIndex()] |= 2;
}

// Check second vertex
Expand All @@ -1880,8 +1880,8 @@ void MapRenderer2D::renderMovingLines(vector<int>& lines, fpoint2_t move_vec)
{
MapLine* line = v->connectedLine(l);

if (line->v1() == v) lines_drawn[map->lineIndex(line)] |= 1;
if (line->v2() == v) lines_drawn[map->lineIndex(line)] |= 2;
if (line->v1() == v) lines_drawn[line->getIndex()] |= 1;
if (line->v2() == v) lines_drawn[line->getIndex()] |= 2;
}
}

Expand All @@ -1892,7 +1892,7 @@ void MapRenderer2D::renderMovingLines(vector<int>& lines, fpoint2_t move_vec)
for (unsigned a = 0; a < map->nLines(); a++)
{
MapLine* line = map->getLine(a);
uint8_t drawn = lines_drawn[map->lineIndex(line)];
uint8_t drawn = lines_drawn[line->getIndex()];

// Skip if not attached to any moving vertices
if (drawn == 0)
Expand Down Expand Up @@ -1943,7 +1943,7 @@ void MapRenderer2D::renderMovingSectors(vector<int>& sectors, fpoint2_t move_vec
// Go through connected sides
vector<MapSide*>& sides = map->getSector(sectors[a])->connectedSides();
for (unsigned s = 0; s < sides.size(); s++)
lines_moved[map->lineIndex(sides[s]->getParentLine())] = 1; // Mark parent line as moved
lines_moved[sides[s]->getParentLine()->getIndex()] = 1; // Mark parent line as moved
}

// Build list of moving lines
Expand Down Expand Up @@ -2444,7 +2444,6 @@ void MapRenderer2D::updateVisibility(fpoint2_t view_tl, fpoint2_t view_br)
void MapRenderer2D::forceUpdate(float line_alpha)
{
// Update variables
this->view_scale = view_scale;
this->view_scale_inv = 1.0 / view_scale;
tex_flats.clear();

Expand Down
4 changes: 2 additions & 2 deletions src/SImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,9 @@ bool SImage::maskFromBrightness(Palette8bit* pal)
for (int a = 0; a < width * height; a++)
{
// Set alpha from pixel colour brightness value
data[c+3] = (double)data[c++]*0.3 + (double)data[c++]*0.59 + (double)data[c++]*0.11;
data[c+3] = (double)data[c]*0.3 + (double)data[c+1]*0.59 + (double)data[c+2]*0.11;
// Skip alpha
c++;
c += 4;
}
}
// ALPHAMASK type is already a brightness mask
Expand Down
Loading

0 comments on commit d87165d

Please sign in to comment.