# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1284404412 0 # Node ID d242e6ce6f9f451751aca5f27fb389000361d972 # Parent da83338b691367cd3385286f690926b26cbd2ec7 Fixed a few compiler warning messages. Also removed a bunch of extra whitespace. diff -r da83338b6913 -r d242e6ce6f9f engine/core/model/model.cpp --- a/engine/core/model/model.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/model/model.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -45,16 +45,15 @@ namespace FIFE { Model::Model(RenderBackend* renderbackend, const std::vector& renderers, - ImagePool* imagepool, AnimationPool* animpool): + ImagePool* imagepool, AnimationPool* animpool): FifeClass(), m_last_namespace(NULL), + m_timeprovider(NULL), m_renderbackend(renderbackend), - m_renderers(renderers), m_imagepool(imagepool), m_animpool(animpool), - m_timeprovider(NULL) { - - } + m_renderers(renderers){ + } Model::~Model() { purge(m_maps); @@ -81,7 +80,7 @@ void Model::adoptPather(AbstractPather* pather) { m_pathers.push_back(pather); } - + AbstractPather* Model::getPather(const std::string& pathername) { std::vector::const_iterator it = m_pathers.begin(); for(; it != m_pathers.end(); ++it) { @@ -108,7 +107,7 @@ return NULL; } - + Map* Model::getMap(const std::string& identifier) const { std::list::const_iterator it = m_maps.begin(); for(; it != m_maps.end(); ++it) { diff -r da83338b6913 -r d242e6ce6f9f engine/core/model/structures/map.cpp --- a/engine/core/model/structures/map.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/model/structures/map.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -43,19 +43,18 @@ namespace FIFE { - Map::Map(const std::string& identifier, RenderBackend* renderBackend, - const std::vector& renderers, ImagePool* imagePool, + Map::Map(const std::string& identifier, RenderBackend* renderBackend, + const std::vector& renderers, ImagePool* imagePool, AnimationPool* animPool, TimeProvider* tp_master): - m_id(identifier), + m_id(identifier), m_timeprovider(tp_master), m_changelisteners(), m_changedlayers(), - m_changed(false), m_renderbackend(renderBackend), m_imagepool(imagePool), m_animpool(animPool), - m_renderers(renderers) { - + m_renderers(renderers), + m_changed(false){ } Map::~Map() { @@ -98,7 +97,7 @@ (*i)->onLayerCreate(this, layer); ++i; } - + return layer; } @@ -161,7 +160,7 @@ m_changed = false; return retval; } - + void Map::addChangeListener(MapChangeListener* listener) { m_changelisteners.push_back(listener); } diff -r da83338b6913 -r d242e6ce6f9f engine/core/video/image.cpp --- a/engine/core/video/image.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/video/image.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -34,12 +34,12 @@ namespace FIFE { - Image::Image(SDL_Surface* surface): + Image::Image(SDL_Surface* surface): m_surface(NULL) { reset(surface); } - Image::Image(const uint8_t* data, unsigned int width, unsigned int height): + Image::Image(const uint8_t* data, unsigned int width, unsigned int height): m_surface(NULL) { SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA, width,height, 32, RMASK, GMASK, BMASK ,AMASK); @@ -65,7 +65,7 @@ m_area.x = m_area.y = m_area.w = m_area.h = 0; m_surface = surface; } - + Image::~Image() { //assert(m_refcount == 0); reset(NULL); @@ -76,7 +76,7 @@ m_surface = NULL; return srf; } - + unsigned int Image::getWidth() const { if (!m_surface) { return 0; @@ -90,7 +90,7 @@ } return m_surface->h; } - + const Rect& Image::getArea() { m_area.w = getWidth(); m_area.h = getHeight(); @@ -113,24 +113,24 @@ a = 0; return; } - + int bpp = m_surface->format->BytesPerPixel; Uint8 *p = (Uint8*)m_surface->pixels + y * m_surface->pitch + x * bpp; - uint32_t pixel; + uint32_t pixel = 0; switch(bpp) { case 1: pixel = *p; - + case 2: pixel = *(Uint16 *)p; - + case 3: if (SDL_BYTEORDER == SDL_BIG_ENDIAN) { pixel = p[0] << 16 | p[1] << 8 | p[2]; } else { pixel = p[0] | p[1] << 8 | p[2] << 16; } - + case 4: pixel = *(Uint32 *)p; } @@ -148,7 +148,7 @@ m_clipstack.push(ci); setClipArea(cliparea, clear); } - + void Image::popClipArea() { assert(!m_clipstack.empty()); m_clipstack.pop(); @@ -159,7 +159,7 @@ setClipArea(ci.r, ci.clearing); } } - + const Rect& Image::getClipArea() const { if (m_clipstack.empty()) { return m_clipstack.top().r; @@ -187,36 +187,36 @@ #endif fp = fopen(filename.c_str(), "wb"); - + if (fp == NULL) { return; } //create the png file - pngptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + pngptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (pngptr == NULL) { fclose(fp); return; } - + //create information struct infoptr = png_create_info_struct(pngptr); if (infoptr == NULL) { fclose(fp); png_destroy_write_struct(&pngptr, (png_infopp)NULL); - return; + return; } - + if (setjmp(png_jmpbuf(pngptr))) { png_destroy_write_struct(&pngptr, &infoptr); fclose(fp); return; } - + //initialize io png_init_io(pngptr, fp); - + //lock the surface for access SDL_LockSurface(&surface); @@ -229,9 +229,9 @@ } else{} - png_set_IHDR(pngptr, infoptr, surface.w, surface.h, 8, colortype, + png_set_IHDR(pngptr, infoptr, surface.w, surface.h, 8, colortype, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - + png_write_info(pngptr, infoptr); png_set_packing(pngptr); diff -r da83338b6913 -r d242e6ce6f9f engine/core/video/sdl/sdlimage.cpp --- a/engine/core/video/sdl/sdlimage.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/video/sdl/sdlimage.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -216,7 +216,7 @@ return; } else { sx_ca = sx_a; - for (; x <= dst->w; x++) { + for (x = 0; x <= dst->w; x++) { *sx_ca = sx_c; sx_ca++; sx_c &= 0xffff; @@ -229,7 +229,7 @@ return; } else { sy_ca = sy_a; - for (; y <= dst->h; y++) { + for (y = 0; y <= dst->h; y++) { *sy_ca = sy_c; sy_ca++; sy_c &= 0xffff; diff -r da83338b6913 -r d242e6ce6f9f engine/core/view/camera.cpp --- a/engine/core/view/camera.cpp Mon Sep 13 17:22:24 2010 +0000 +++ b/engine/core/view/camera.cpp Mon Sep 13 19:00:12 2010 +0000 @@ -58,22 +58,22 @@ class MapObserver : public MapChangeListener { Camera* m_camera; - public: + public: MapObserver(Camera* camera) { m_camera = camera; - } + } virtual ~MapObserver() {} - virtual void onMapChanged(Map* map, std::vector& changedLayers) { - } + virtual void onMapChanged(Map* map, std::vector& changedLayers) { + } - virtual void onLayerCreate(Map* map, Layer* layer) { - m_camera->addLayer(layer); - } + virtual void onLayerCreate(Map* map, Layer* layer) { + m_camera->addLayer(layer); + } - virtual void onLayerDelete(Map* map, Layer* layer) { - m_camera->removeLayer(layer); - } + virtual void onLayerDelete(Map* map, Layer* layer) { + m_camera->removeLayer(layer); + } }; Camera::Camera(const std::string& id, @@ -207,7 +207,7 @@ // need to calculate screen-coordinates // which depend on m_location. updateMap(location.getMap()); - + m_cur_origo = toScreenCoordinates(ExactModelCoordinate(0,0,0)); } @@ -278,11 +278,11 @@ bool Camera::isEnabled() { return m_enabled; } - + Point3D Camera::getOrigin() const { return m_cur_origo; } - + void Camera::updateMatrices() { double scale = m_reference_scale; m_matrix.loadScale(scale, scale, scale); @@ -320,7 +320,7 @@ } m_vscreen_2_screen[2*N + 2] = 1; m_screen_2_vscreen = m_vscreen_2_screen.inverse(); - + // FL_WARN(_log, LMsg("matrix: ") << m_matrix << " 1: " << m_matrix.inverse().mult4by4(m_matrix)); // FL_WARN(_log, LMsg("vs2s matrix: ") << m_vscreen_2_screen << " s2vs matrix: " << m_screen_2_vscreen); } @@ -348,7 +348,7 @@ DoublePoint3D pt = (m_vs_matrix * p); return pt; } - + ScreenPoint Camera::virtualScreenToScreen(const DoublePoint3D& p) { return doublePt2intPt(m_vscreen_2_screen * p); } @@ -371,7 +371,12 @@ DoubleMatrix mtx; mtx.loadRotate(m_rotation, 0.0, 0.0, 1.0); mtx.applyRotate(m_tilt, 1.0, 0.0, 0.0); - double x1, x2, y1, y2; + + double x1 = 0; + double x2 = 0; + double y1 = 0; + double y2 = 0; + for (unsigned int i = 0; i < vertices.size(); i++) { vertices[i] = cg->toMapCoordinates(vertices[i]); vertices[i] = mtx * vertices[i];