Permalink
Browse files

fix all the gcc warnings in the element files (except one in PSTN) + …

…all the unused variable warnings
  • Loading branch information...
jacob1 committed Jan 11, 2015
1 parent a5797f6 commit dce874484a0da4b850cf093ff51e09798a4516e6
Showing with 107 additions and 185 deletions.
  1. +3 −3 data/hmap.h
  2. +2 −2 data/images.h
  3. +1 −2 src/PowderToySDL.cpp
  4. +10 −13 src/client/Client.cpp
  5. +2 −2 src/client/GameSave.cpp
  6. +0 −2 src/client/HTTP.cpp
  7. +2 −1 src/graphics/Graphics.cpp
  8. +1 −1 src/graphics/Graphics.h
  9. +0 −1 src/graphics/RasterDrawMethods.inl
  10. +9 −6 src/graphics/Renderer.cpp
  11. +0 −2 src/gui/dialogues/ConfirmPrompt.cpp
  12. +1 −1 src/gui/game/Brush.cpp
  13. +2 −2 src/gui/game/EllipseBrush.h
  14. +0 −1 src/gui/interface/CopyTextButton.cpp
  15. +0 −1 src/gui/interface/ScrollPanel.cpp
  16. +0 −1 src/gui/interface/Slider.cpp
  17. +0 −2 src/gui/preview/PreviewView.cpp
  18. +2 −14 src/gui/search/SearchView.cpp
  19. +3 −9 src/lua/LegacyLuaAPI.cpp
  20. +2 −3 src/lua/LuaScriptInterface.cpp
  21. +1 −2 src/lua/TPTScriptInterface.cpp
  22. +10 −2 src/lua/socket/buffer.c
  23. +7 −15 src/simulation/Simulation.cpp
  24. +1 −1 src/simulation/elements/ACID.cpp
  25. +1 −1 src/simulation/elements/ARAY.cpp
  26. +1 −1 src/simulation/elements/BANG.cpp
  27. +1 −1 src/simulation/elements/BMTL.cpp
  28. +0 −1 src/simulation/elements/BREC.cpp
  29. +1 −1 src/simulation/elements/BRMT.cpp
  30. +1 −1 src/simulation/elements/CAUS.cpp
  31. +1 −31 src/simulation/elements/COAL.cpp
  32. +1 −3 src/simulation/elements/CRAY.cpp
  33. +4 −8 src/simulation/elements/DEST.cpp
  34. +1 −1 src/simulation/elements/DMG.cpp
  35. +1 −1 src/simulation/elements/DSTW.cpp
  36. +1 −1 src/simulation/elements/EMBR.cpp
  37. +1 −1 src/simulation/elements/EXOT.cpp
  38. +1 −1 src/simulation/elements/Element.cpp
  39. +12 −10 src/simulation/elements/Element.h
  40. +7 −7 src/simulation/elements/FIGH.cpp
  41. +1 −2 src/simulation/elements/FWRK.cpp
  42. +1 −1 src/simulation/elements/GOLD.cpp
  43. +1 −1 src/simulation/elements/IRON.cpp
  44. +2 −3 src/simulation/elements/LIGH.cpp
  45. +1 −1 src/simulation/elements/PSTN.cpp
  46. +4 −15 src/simulation/elements/QRTZ.cpp
  47. +1 −1 src/simulation/elements/SING.cpp
  48. +1 −1 src/simulation/elements/TRON.cpp
  49. +1 −1 src/simulation/elements/WIRE.cpp

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -295,7 +295,6 @@ void blit2(pixel * vid, int currentScale)
int SDLOpen()
{
SDL_Surface * surface;
#if defined(WIN) && defined(WINCONSOLE)
FILE * console = fopen("CON", "w" );
#endif
@@ -839,7 +838,7 @@ int main(int argc, char * argv[])
if(tempScale != 1 && tempScale != 2)
tempScale = 1;
int sdlStatus = SDLOpen();
SDLOpen();
#ifdef WIN
LoadWindowPosition(tempScale);
#endif
@@ -712,31 +712,25 @@ void Client::Tick()
#ifndef IGNORE_UPDATES
//Check for updates
json::Object versions = objDocument["Updates"];
#if not defined(BETA) && not defined(SNAPSHOT)
json::Object stableVersion = versions["Stable"];
json::Object betaVersion = versions["Beta"];
json::Object snapshotVersion = versions["Snapshot"];
json::Number stableMajor = stableVersion["Major"];
json::Number stableMinor = stableVersion["Minor"];
json::Number stableBuild = stableVersion["Build"];
json::String stableFile = stableVersion["File"];
json::Number betaMajor = betaVersion["Major"];
json::Number betaMinor = betaVersion["Minor"];
json::Number betaBuild = betaVersion["Build"];
json::String betaFile = betaVersion["File"];
json::Number snapshotSnapshot = snapshotVersion["Snapshot"];
json::String snapshotFile = snapshotVersion["File"];
if(stableMajor.Value()>SAVE_VERSION || (stableMinor.Value()>MINOR_VERSION && stableMajor.Value()==SAVE_VERSION) || stableBuild.Value()>BUILD_NUM)
{
updateAvailable = true;
updateInfo = UpdateInfo(stableMajor.Value(), stableMinor.Value(), stableBuild.Value(), stableFile.Value(), UpdateInfo::Stable);
}
#endif
#ifdef BETA
json::Object betaVersion = versions["Beta"];
json::Number betaMajor = betaVersion["Major"];
json::Number betaMinor = betaVersion["Minor"];
json::Number betaBuild = betaVersion["Build"];
json::String betaFile = betaVersion["File"];
if(betaMajor.Value()>SAVE_VERSION || (betaMinor.Value()>MINOR_VERSION && betaMajor.Value()==SAVE_VERSION) || betaBuild.Value()>BUILD_NUM)
{
updateAvailable = true;
@@ -745,6 +739,9 @@ void Client::Tick()
#endif
#ifdef SNAPSHOT
json::Object snapshotVersion = versions["Snapshot"];
json::Number snapshotSnapshot = snapshotVersion["Snapshot"];
json::String snapshotFile = snapshotVersion["File"];
if(snapshotSnapshot.Value() > SNAPSHOT_ID)
{
updateAvailable = true;
@@ -1094,9 +1094,9 @@ void GameSave::readOPS(char * data, int dataLength)
void GameSave::readPSv(char * data, int dataLength)
{
unsigned char * d = NULL, * c = (unsigned char *)data;
int q,i,j,k,x,y,p=0,*m=NULL, ver, pty, ty, legacy_beta=0, tempGrav = 0;
int q,i,j,k,x,y,p=0,*m=NULL, ver, pty, ty, legacy_beta=0;
int bx0=0, by0=0, bw, bh, w, h, y0 = 0, x0 = 0;
int nf=0, new_format = 0, ttv = 0;
int new_format = 0, ttv = 0;
int *fp = (int *)malloc(NPART*sizeof(int));
std::vector<sign> tempSigns;
@@ -706,7 +706,6 @@ void http_auth_headers(void *ctx, const char *user, const char *pass, const char
char *tmp;
int i;
unsigned char hash[16];
unsigned int m;
struct md5_context md5;
if (user)
@@ -716,7 +715,6 @@ void http_auth_headers(void *ctx, const char *user, const char *pass, const char
md5_init(&md5);
md5_update(&md5, (unsigned char *)user, strlen(user));
md5_update(&md5, (unsigned char *)"-", 1);
m = 0;
md5_update(&md5, (unsigned char *)pass, strlen(pass));
md5_final(hash, &md5);
@@ -1119,11 +1119,12 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve
}
}
void Graphics::draw_rgba_image(unsigned char *data, int x, int y, float alpha)
void Graphics::draw_rgba_image(const unsigned char *data_, int x, int y, float alpha)
{
unsigned char w, h;
int i, j;
unsigned char r, g, b, a;
unsigned char *data = (unsigned char*)data_;
if (!data) return;
w = *(data++)&0xFF;
h = *(data++)&0xFF;
@@ -247,7 +247,7 @@ class Graphics
void draw_image(pixel *img, int x, int y, int w, int h, int a);
void draw_image(const VideoBuffer & vidBuf, int w, int h, int a);
void draw_image(VideoBuffer * vidBuf, int w, int h, int a);
void draw_rgba_image(unsigned char *data, int x, int y, float alpha);
void draw_rgba_image(const unsigned char *data, int x, int y, float alpha);
Graphics();
~Graphics();
@@ -16,7 +16,6 @@ int PIXELMETHODS_CLASS::drawtext(int x, int y, const char *s, int r, int g, int
{
if(!strlen(s))
return 0;
int width, height;
int invert = 0;
int oR = r, oG = g, oB = b;
@@ -521,7 +521,7 @@ wall_type * Renderer_wtypes = LoadWalls(Renderer_wtypesCount);
VideoBuffer * Renderer::WallIcon(int wallID, int width, int height)
{
int i, j, cr, cg, cb;
int i, j;
int wt = wallID;
if (wt<0 || wt>=Renderer_wtypesCount)
return 0;
@@ -912,7 +912,7 @@ void Renderer::DrawWalls()
void Renderer::DrawSigns()
{
int i, j, x, y, w, h, dx, dy,mx,my,b=1,bq,match;
int i, j, x, y, w, h, dx, dy;
std::vector<sign> signs = sim->signs;
#ifdef OGLR
GLint prevFbo;
@@ -1004,7 +1004,7 @@ void Renderer::render_fire()
#ifndef OGLR
if(!(render_mode & FIREMODE))
return;
int i,j,x,y,r,g,b,nx,ny;
int i,j,x,y,r,g,b;
for (j=0; j<YRES/CELL; j++)
for (i=0; i<XRES/CELL; i++)
{
@@ -1043,7 +1043,7 @@ float blur_alphaf[7][7];
void Renderer::prepare_alpha(int size, float intensity)
{
//TODO: implement size
int x,y,i,j,c;
int x,y,i,j;
float multiplier = 255.0f*intensity;
memset(temp, 0, sizeof(temp));
@@ -1071,7 +1071,7 @@ void Renderer::prepare_alpha(int size, float intensity)
memset(glow_alphaf, 0, sizeof(glow_alphaf));
c = 5;
int c = 5;
glow_alphaf[c][c-1] = 0.4f;
glow_alphaf[c][c+1] = 0.4f;
@@ -1125,14 +1125,15 @@ void Renderer::render_parts()
{
int deca, decr, decg, decb, cola, colr, colg, colb, firea, firer, fireg, fireb, pixel_mode, q, i, t, nx, ny, x, y, caddress;
int orbd[4] = {0, 0, 0, 0}, orbl[4] = {0, 0, 0, 0};
float gradv, flicker, fnx, fny;
float gradv, flicker;
Particle * parts;
Element *elements;
if(!sim)
return;
parts = sim->parts;
elements = sim->elements;
#ifdef OGLR
float fnx, fny;
int cfireV = 0, cfireC = 0, cfire = 0;
int csmokeV = 0, csmokeC = 0, csmoke = 0;
int cblobV = 0, cblobC = 0, cblob = 0;
@@ -1168,8 +1169,10 @@ void Renderer::render_parts()
nx = (int)(sim->parts[i].x+0.5f);
ny = (int)(sim->parts[i].y+0.5f);
#ifdef OGLR
fnx = sim->parts[i].x;
fny = sim->parts[i].y;
#endif
if(nx >= XRES || nx < 0 || ny >= YRES || ny < 0)
continue;
@@ -8,7 +8,6 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, ConfirmDial
ui::Window(ui::Point(-1, -1), ui::Point(250, 35)),
callback(callback_)
{
int width, height;
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), title);
titleLabel->SetTextColour(style::Colour::WarningTitle);
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
@@ -64,7 +63,6 @@ ConfirmPrompt::ConfirmPrompt(std::string title, std::string message, std::string
ui::Window(ui::Point(-1, -1), ui::Point(250, 50)),
callback(callback_)
{
int width, height;
ui::Label * titleLabel = new ui::Label(ui::Point(4, 5), ui::Point(Size.X-8, 15), title);
titleLabel->SetTextColour(style::Colour::WarningTitle);
titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
@@ -3,7 +3,7 @@
void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2)
{
int width, height, t;
int width, height;
width = position2.X-position1.X;
height = position2.Y-position1.Y;
if(height<0)
@@ -11,7 +11,7 @@ class EllipseBrush: public Brush
Brush(size_)
{
SetRadius(size_);
};
}
virtual void GenerateBitmap()
{
if(bitmap)
@@ -29,7 +29,7 @@ class EllipseBrush: public Brush
}
else
{
int yTop = ry+1, yBottom, i, j;
int yTop = ry+1, yBottom, i;
for (i = 0; i <= rx; i++)
{
while (pow(i-rx,2.0)*pow(ry,2.0) + pow(yTop-ry,2.0)*pow(rx,2.0) <= pow(rx,2.0)*pow(ry,2.0))
@@ -21,7 +21,6 @@ namespace ui
ui::Button::OnMouseClick(x, y, button);
ClipboardPush((char*)ButtonText.c_str());
int textWidth = Graphics::textwidth("Copied!");
copyTextLabel->SetText("Copied!");
Appearance.TextInactive = ui::Colour(180, 230, 180);
@@ -135,7 +135,6 @@ void ScrollPanel::XTick(float dt)
int oldOffsetY = offsetY;
offsetY += yScrollVel;
int oldOffsetX = offsetX;
offsetX += xScrollVel;
yScrollVel*=0.98f;
@@ -25,7 +25,6 @@ void Slider::updatePosition(int position)
float fPosition = position-3;
float fSize = Size.X-6;
float fSteps = sliderSteps;
float fSliderPosition = (fPosition/fSize)*sliderSteps;//position;//((x-3)/(Size.X-6))*sliderSteps;
@@ -565,7 +565,6 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
ui::AvatarButton * tempAvatar;
for(int i = 0; i < comments->size(); i++)
{
int usernameY = currentY+5, commentY;
if(showAvatars)
{
tempAvatar = new ui::AvatarButton(ui::Point(2, currentY+7), ui::Point(26, 26), comments->at(i)->authorName);
@@ -589,7 +588,6 @@ void PreviewView::NotifyCommentsChanged(PreviewModel * sender)
commentComponents.push_back(tempUsername);
commentsPanel->AddChild(tempUsername);
commentY = currentY+5;
if(showAvatars)
tempComment = new ui::Label(ui::Point(31, currentY+5), ui::Point(Size.X-((XRES/2) + 13 + 26), -1), comments->at(i)->comment);
else
@@ -468,8 +468,8 @@ void SearchView::CheckAccess()
void SearchView::NotifyTagListChanged(SearchModel * sender)
{
int i = 0;
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 1;
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
int savesY = 4, buttonPadding = 1;
int buttonAreaHeight, buttonYOffset;
int tagWidth, tagHeight, tagX = 0, tagY = 0, tagsX = 6, tagsY = 4, tagPadding = 1;
int tagAreaWidth, tagAreaHeight, tagXOffset, tagYOffset;
@@ -490,8 +490,6 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
tagButtons.clear();
buttonYOffset = 28;
buttonXOffset = buttonPadding;
buttonAreaWidth = Size.X;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
if(sender->GetShowTags())
@@ -576,9 +574,6 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
int buttonWidth, buttonHeight, saveX = 0, saveY = 0, savesX = 5, savesY = 4, buttonPadding = 1;
int buttonAreaWidth, buttonAreaHeight, buttonXOffset, buttonYOffset;
int tagWidth, tagHeight, tagX = 0, tagY = 0, tagsX = 6, tagsY = 4, tagPadding = 1;
int tagAreaWidth, tagAreaHeight, tagXOffset, tagYOffset;
vector<SaveInfo*> saves = sender->GetSaveList();
//string messageOfTheDay = sender->GetMessageOfTheDay();
@@ -662,13 +657,6 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
buttonYOffset += (buttonAreaHeight/savesY) - buttonPadding*2;
buttonAreaHeight = Size.Y - buttonYOffset - 18;
savesY--;
tagXOffset = tagPadding;
tagYOffset = 60;
tagAreaWidth = Size.X;
tagAreaHeight = ((buttonAreaHeight/savesY) - buttonPadding*2)-(tagYOffset-28)-5;
tagWidth = (tagAreaWidth/tagsX) - tagPadding*2;
tagHeight = (tagAreaHeight/tagsY) - tagPadding*2;
}
buttonWidth = (buttonAreaWidth/savesX) - buttonPadding*2;
@@ -58,8 +58,7 @@ int luacon_partread(lua_State* l)
int luacon_partwrite(lua_State* l)
{
int tempinteger, i = cIndex;
float tempfloat;
int i = cIndex;
std::string key = luaL_optstring(l, 2, "");
CommandInterface::FormatType format;
int offset = luacon_ci->GetPropertyOffset(key, format);
@@ -1260,13 +1259,8 @@ int luatpt_set_elecmap(lua_State* l)
int luatpt_get_elecmap(lua_State* l)
{
int nx, ny, acount;
int x1, y1, width, height;
float value;
acount = lua_gettop(l);
x1 = abs(luaL_optint(l, 1, 0));
y1 = abs(luaL_optint(l, 2, 0));
int x1 = abs(luaL_optint(l, 1, 0));
int y1 = abs(luaL_optint(l, 2, 0));
if(x1 > (XRES/CELL) || y1 > (YRES/CELL))
return luaL_error(l, "Out of range");
@@ -709,7 +709,7 @@ int LuaScriptInterface::simulation_partNeighbours(lua_State * l)
int LuaScriptInterface::simulation_partChangeType(lua_State * l)
{
int partIndex = lua_tointeger(l, 1), x, y;
int partIndex = lua_tointeger(l, 1);
if(partIndex < 0 || partIndex >= NPART || !luacon_sim->parts[partIndex].type)
return 0;
luacon_sim->part_change_type(partIndex, luacon_sim->parts[partIndex].x+0.5f, luacon_sim->parts[partIndex].y+0.5f, lua_tointeger(l, 2));
@@ -1455,7 +1455,7 @@ int LuaScriptInterface::simulation_saveStamp(lua_State * l)
int LuaScriptInterface::simulation_loadStamp(lua_State * l)
{
int i = -1, j, x, y;
int i = -1, x, y;
SaveFile * tempfile;
x = luaL_optint(l,2,0);
y = luaL_optint(l,3,0);
@@ -3099,7 +3099,6 @@ std::string highlight(std::string command)
#define CMP(X) (!strlcmp(wstart, X, len))
std::stringstream result;
int pos = 0;
int len = command.length();
const char *raw = command.c_str();
char c;
while(c = raw[pos])
@@ -56,7 +56,7 @@ int TPTScriptInterface::Command(std::string command)
}
//Evaluate
return 0;
return retCode;
}
ValueType TPTScriptInterface::testType(std::string word)
@@ -81,7 +81,6 @@ ValueType TPTScriptInterface::testType(std::string word)
else if(word == "quit")
return TypeFunction;
//Basic type
parseNumber:
for(i = 0; i < word.length(); i++)
{
if (!(rawWord[i] >= '0' && rawWord[i] <= '9') && !(rawWord[i] == '-' && !i))
Oops, something went wrong.

0 comments on commit dce8744

Please sign in to comment.