Mercurial > sumwars
changeset 2670:b5d964942c84 gussoundtest
Merge
author | Stefan Stammberger <fusion44> |
---|---|
date | Sat, 08 Mar 2014 21:52:56 +0100 |
parents | 06a65e9b19ac (current diff) 3f00c28d6d20 (diff) |
children | f28e1d1c6861 |
files | src/gui/networkwindows.cpp |
diffstat | 50 files changed, 1734 insertions(+), 1734 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/action.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/action.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -62,7 +62,7 @@ } else { - DEBUG("Failed to load file %s", pFilename); + SW_DEBUG("Failed to load file %s", pFilename); return false; } } @@ -216,7 +216,7 @@ } else if (child->Type()!=TiXmlNode::TINYXML_COMMENT) { - DEBUG("unexpected element of <Ability>: %s",child->Value()); + SW_DEBUG("unexpected element of <Ability>: %s",child->Value()); } } }
--- a/src/core/creature.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/creature.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -27,7 +27,7 @@ { if (!Creature::init()) { - DEBUG("Creature::init() hat false zurückgeliefert"); + SW_DEBUG("Creature::init() hat false zurückgeliefert"); } } @@ -246,13 +246,13 @@ Action::ActionInfo* aci = Action::getActionInfo(action); if (aci ==0) { - DEBUG("Information for action %s missing ",action.c_str()); + SW_DEBUG("Information for action %s missing ",action.c_str()); return 0; } return aci->m_standard_time; } - DEBUG("creature %s cant use action %s",getSubtype().c_str(), action.c_str()); + SW_DEBUG("creature %s cant use action %s",getSubtype().c_str(), action.c_str()); return 0; } @@ -280,7 +280,7 @@ { // use the base action m_action.m_type = aci->m_base_action; - DEBUG("using Base Action due to mute"); + SW_DEBUG("using Base Action due to mute"); } } @@ -2216,7 +2216,7 @@ if (m_action.m_elapsed_time> m_action.m_time) { - DEBUG("elapsed time %f all time %f",m_action.m_elapsed_time, m_action.m_time); + SW_DEBUG("elapsed time %f all time %f",m_action.m_elapsed_time, m_action.m_time); } DEBUGX("Update des Creatureobjekts [%i] wird gestartet", getId()); @@ -4050,7 +4050,7 @@ if (delay>1000) { - DEBUG("got packet with delay %f %f",cv->getDelay(),delay); + SW_DEBUG("got packet with delay %f %f",cv->getDelay(),delay); }
--- a/src/core/debug.h Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/debug.h Sat Mar 08 21:52:56 2014 +0100 @@ -64,7 +64,7 @@ * \def DEBUG( format, ... ) * \brief Gibt Debug-Informationen aus */ -#define DEBUG( format, ... ) \ +#define SW_DEBUG( format, ... ) \ LOGGER( Log::MSG_DEBUG,format, ##__VA_ARGS__ )
--- a/src/core/document.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/document.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -147,7 +147,7 @@ unsigned char* data=0; m_save_file = savePath; - DEBUG ("Loaded save file %s", saveFile.c_str()); + SW_DEBUG ("Loaded save file %s", saveFile.c_str()); file.get(bin); @@ -193,7 +193,7 @@ { // read savegame std::string fname = m_save_file; - DEBUG("savegame is %s",fname.c_str()); + SW_DEBUG("savegame is %s",fname.c_str()); std::fstream file(fname.c_str(),std::ios::in| std::ios::binary); if (file.is_open()) @@ -235,7 +235,7 @@ } m_temp_player->toSavegame(&cv2); - DEBUG("sending savegame"); + SW_DEBUG("sending savegame"); World::getWorld()->handleSavegame(&cv2); DEBUGX("sent savegame"); @@ -837,7 +837,7 @@ if (m_temp_player == 0) { showWarning (gettext("Please select a character first!")); - DEBUG ("Warning: Tried to start a game without a selected char!"); + SW_DEBUG ("Warning: Tried to start a game without a selected char!"); return; } @@ -853,7 +853,7 @@ void Document::onButtonHostGame() { - DEBUG("Host Game"); + SW_DEBUG("Host Game"); if (m_temp_player == 0) { // Show a notification. @@ -864,7 +864,7 @@ message->setModalState(true); CEGUIUtility::getWindow ("WarningDialogWindow/WarningDialogLabel")->setText((CEGUI::utf8*) gettext ("Please select a character first!")); - DEBUG ("Warning: Tried to host a game without a selected char!"); + SW_DEBUG ("Warning: Tried to host a game without a selected char!"); return; } getGUIState()->m_shown_windows |= HOST_GAME; @@ -885,7 +885,7 @@ message->setModalState(true); CEGUIUtility::getWindow ("WarningDialogWindow/WarningDialogLabel")->setText((CEGUI::utf8*) gettext("Please select a character first!")); - DEBUG ("Warning: Tried to join a game without a selected char!"); + SW_DEBUG ("Warning: Tried to join a game without a selected char!"); return; } getGUIState()->m_shown_windows |= JOIN_GAME; @@ -895,7 +895,7 @@ void Document::onButtonStartHostGame() { - DEBUG("start multiplayer game"); + SW_DEBUG("start multiplayer game"); // Spieler ist selbst der Host setServer(true); m_single_player = false; @@ -1063,7 +1063,7 @@ if (!checkSubwindowsAllowed() && getGUIState()->m_sheet == Document::GAME_SCREEN) { - DEBUG ("Subwindows are allowed, and Current state: GAME_SCREEN; so you're not allowed to toggle this window... for some reason"); + SW_DEBUG ("Subwindows are allowed, and Current state: GAME_SCREEN; so you're not allowed to toggle this window... for some reason"); return; } @@ -1071,7 +1071,7 @@ // Opened windows have changed. m_modified |= WINDOWS_MODIFIED; - DEBUG ("Set internal state data for options button toggle"); + SW_DEBUG ("Set internal state data for options button toggle"); } @@ -1994,7 +1994,7 @@ CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); if (! CEGUIUtility::isWindowPresent ("WarningDialogWindow")) { - DEBUG ("Could not display the warning widget: [WarningDialogWindow]"); + SW_DEBUG ("Could not display the warning widget: [WarningDialogWindow]"); return; } @@ -2040,7 +2040,7 @@ CEGUI::String widgetName = CEGUIUtility::getNameForWidget ("MainMenu/MainMenuRoot/QuestionInfoRoot"); if (! CEGUIUtility::isWindowPresent (widgetName)) { - DEBUG ("Could not display the warning widget: [%s]", widgetName.c_str ()); + SW_DEBUG ("Could not display the warning widget: [%s]", widgetName.c_str ()); return; }
--- a/src/core/eventsystem.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/eventsystem.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -32,7 +32,7 @@ #include <cctype> // Helper for sound operations -#include "soundhelper.h" +#include "soundhelper.h" #ifdef DEBUG_DATABASE std::map<int, std::string> EventSystem::m_code_fragments; @@ -385,7 +385,7 @@ } if (reg ==0) { - DEBUG("region for timedExecute does not exist"); + SW_DEBUG("region for timedExecute does not exist"); return 0; } @@ -1477,7 +1477,7 @@ if (m_region !=0) { WorldObject* wo = m_region->getObjectAt(pos); - DEBUG("pos %f %f wo %p",pos.m_x, pos.m_y,wo); + SW_DEBUG("pos %f %f wo %p",pos.m_x, pos.m_y,wo); if (wo !=0) { lua_pushnumber(L,wo->getId()); @@ -2513,7 +2513,7 @@ bool repeat = lua_toboolean(L, 4); if (repeat) { - DEBUG("repeat"); + SW_DEBUG("repeat"); txt="#animation_r#"; } } @@ -2904,7 +2904,7 @@ } if (reg ==0) { - DEBUG("region for createEvent does not exist"); + SW_DEBUG("region for createEvent does not exist"); return 0; }
--- a/src/core/fixedobject.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/fixedobject.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -21,7 +21,7 @@ bool tmp=FixedObject::init(); if (!tmp) { - DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!"); + SW_DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!"); } } @@ -33,7 +33,7 @@ bool tmp=FixedObject::init(); if (!tmp) { - DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!"); + SW_DEBUG("Initialisierung des Fixed Objects fehlgeschlagen!"); } }
--- a/src/core/gettext.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/gettext.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -133,7 +133,7 @@ locale = loc; } - DEBUG ("set new language [%s]",locale.c_str()); + SW_DEBUG ("set new language [%s]",locale.c_str()); if (locale != m_locale) {
--- a/src/core/itemfactory.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/itemfactory.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -367,7 +367,7 @@ void ItemFactory::cleanup() { - DEBUG("cleanup"); + SW_DEBUG("cleanup"); std::map<Item::Subtype,ItemBasicData*>::iterator it; for (it = m_item_data.begin(); it != m_item_data.end(); ++it)
--- a/src/core/itemloader.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/itemloader.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -343,7 +343,7 @@ } else if (child->Type()!=TiXmlNode::TINYXML_COMMENT) { - DEBUG("unexpected element of <Item>: %s",child->Value()); + SW_DEBUG("unexpected element of <Item>: %s",child->Value()); } } }
--- a/src/core/mapgenerator.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/mapgenerator.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -1,1352 +1,1352 @@ -/* - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "mapgenerator.h" -#include "world.h" +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mapgenerator.h" +#include "world.h" // Helper for sound operations #include "soundhelper.h" - - -bool operator<(WeightedLocation first, WeightedLocation second) -{ - return first.m_value< second.m_value; -} - -TemplateMap::TemplateMap(int dimx, int dimy) - : m_template_map(dimx,dimy) , m_template_index_map(dimx,dimy) -{ - m_dimx = dimx; - m_dimy = dimy; -} - -void TemplateMap::init(Matrix2d<char>* base_map) -{ - // Dimension der Basiskarte - int bdimx = m_dimx/2; - int bdimy = m_dimy/2; - - m_template_map.clear(); - m_template_index_map.clear(); - int val; - - // 8x8 Feld Informationen aus der Basiskarte in - // 4x4 Karte uebertragen - for (int i=0; i<bdimx; i++) - { - for (int j=0; j<bdimy; j++) - { - if ((*base_map)[i][j] <= 0) - { - val = -1; - } - else - { - val =0; - } - - m_template_map[2*i][2*j] = val; - m_template_map[2*i][2*j+1] = val; - m_template_map[2*i+1][2*j+1] = val; - m_template_map[2*i+1][2*j] = val; - } - } - - // unterer und linker Rand mit -1 fuellen - for (int i=0; i<m_dimx; i++) - { - m_template_map[i][m_dimy-1] = -1; - } - for (int j=0; j<m_dimy; j++) - { - m_template_map[m_dimx-1][j] = -1; - } - - // restliche Karte berechnen - for (int i=m_dimx-2; i>=0; i--) - { - for (int j=m_dimy-2; j>=0; j--) - { - recalcMapElement(i,j); - } - } -} - -void TemplateMap::recalcMapElement(int i,int j) -{ - int val; - if (i >= m_dimx || j >= m_dimy) - return; - - if (i== m_dimx-1 || j == m_dimy-1) - { - val = -1; // Rand immer blockiert - } - else if (m_template_map[i][j] == -1) - { - val = -1; // blockiert bleibt blockiert - } - else - { - // Minimum aus den Felden darunter, daneben, diagonal darunter; plus 1 - val = m_template_map[i+1][j]; - val = MathHelper::Min(val, m_template_map[i][j+1]); - val = MathHelper::Min(val, m_template_map[i+1][j+1]); - val ++; - - if (val == 0) - val = 1; - } - - if (val != -1) - { - setMapElement(i,j,val); - } -} - -void TemplateMap::setMapElement(int i, int j, int template_max_size) -{ - int oldval = m_template_map[i][j]; - - if (oldval == template_max_size || oldval == -1) - return; - - // aus Datenstrukturen entfernen falls alter Wert > 0 - if (oldval > 0) - { - // geloescht wird, indem das letzte Element des Vektors - // ueber das zu loeschende kopiert wird - int oldindex = m_template_index_map[i][j]; - int vecsize = m_template_places[oldval].size(); - if (oldindex != vecsize -1) - { - int lastx = m_template_places[oldval][vecsize-1].first; - int lasty = m_template_places[oldval][vecsize-1].second; - m_template_places[oldval][oldindex].first = lastx; - m_template_places[oldval][oldindex].second = lasty; - m_template_index_map[lastx][lasty] = oldindex; - } - - //m_template_places[oldval].resize(vecsize-1); - m_template_places[oldval].pop_back (); - } - - m_template_map[i][j] = template_max_size; - - // Eintragen des neuen Wertes in die Datenstrukturen - if (template_max_size > 0) - { - int vecsize = m_template_places[template_max_size].size(); - m_template_places[template_max_size].resize(vecsize +1); - m_template_places[template_max_size][vecsize].first = i; - m_template_places[template_max_size][vecsize].second = j; - m_template_index_map[i][j] = vecsize; - } - -} - -bool TemplateMap::getTemplatePlace(Shape* shape, Vector & place) -{ - if (shape ==0) - { - return false; - } - - bool success = false; - - // Groesse des Templates in 4x4 Feldern - Vector ext = shape->getAxisExtent(); - int ex = int(ceil(ext.m_x/2)); - int ey = int(ceil(ext.m_y/2)); - - int size = MathHelper::Max(ex,ey); - DEBUGX("template size %i %i angle %f extent %f %f",ex,ey,shape->m_angle,shape->m_extent.m_x, shape->m_extent.m_y); - std::map< int, std::vector< std::pair<int, int> > >::iterator mt, mt2; - std::vector<int>::iterator st; - - int px,py; - - while (!success) - { - int nr; - // Anzahl der in Frage kommenden Orte ermitteln - // alle Orte aufsummieren mit Abstandsindex mindens size - nr =0; - mt2 = mt = m_template_places.lower_bound(size); - - while (mt != m_template_places.end()) - { - nr += mt->second.size(); - ++mt; - } - - if (nr == 0) - { - // kein Platz fuer das Template vorhanden - return false; - } - - // Ort auswuerfeln und ermitteln - nr = Random::randi(nr); - mt = mt2; - while (nr >= int(mt->second.size())) - { - nr -= mt->second.size(); - ++mt; - } - - px = mt->second[nr].first; - py = mt->second[nr].second; - - // Flaeche die durch das Template ueberdeckt wird bestimmen - int imin = px; - int jmin = py; - int imax = imin + ex -1; - int jmax = jmin + ey -1; - // Ort eines eventuellen Hindernisses - int obi = -1, obj= -1; - - // Pruefen ob die Flaeche keine Hindernisse enthaelt - for (int i = imin; i<= imax; i++) - { - for (int j= jmin; j<= jmax; j++) - { - if (m_template_map[i][j] <0) - { - obi = i; - obj = j; - DEBUGX("found obstacle at %i %i",i,j); - break; - } - } - if (obi != -1) - { - break; - } - } - - if (obi != -1) - { - // Hindernis gefunden - - // dieses Hindernis verhindert das platzieren der Templates in seiner Umgebung - // in dieser Umgebung werden die Zahlen fuer den minimalen Abstand zum naechsten Hindernis aktualisiert - imin = MathHelper::Max(0,obi - size+1); - jmin = MathHelper::Max(0,obj - size+1); - imax = obi; - jmax = obj; - - // Schleife ueber die Umgebung des Hindernisses - for (int i = imax; i>= imin; i--) - { - for (int j= jmax; j>= jmin; j--) - { - recalcMapElement(i,j); - } - } - } - else - { - // Erfolg - // Orte die von dem Template ueberdeckt werden aus der Liste der freien Orte entfernen - - // Objekt auf der Template Karte eintragen - for (int i = imin; i<= imax; i++) - { - for (int j= jmin; j<= jmax; j++) - { - setMapElement(i,j,-1); - } - } - - place.m_x = px*4+2*ex; - place.m_y = py*4+2*ey; - - DEBUGX("found place %i %i",px,py); - - success = true; - } - } - return true; -} - - -void TemplateMap::print() -{ - for (int i=0; i< m_dimx; i++) - { - for (int j=0; j<m_dimy; j++) - { - if (m_template_map[i][j]>0) - std::cout << m_template_map[i][j] << " "; - else - std::cout << "# "; - } - std::cout << "\n"; - } - std::cout << "\n"; - - std::map< int, std::vector< std::pair<int, int> > >::iterator it; - for (it = m_template_places.begin(); it != m_template_places.end(); ++it) - { - DEBUG("places of size %i : %i",it->first, it->second.size()); - } -} - - -Region* MapGenerator::createRegion(RegionData* rdata) -{ - // TODO: remove timer. - static Timer timer; - timer.start (); - - // set Random seed based on the region information - // surely, we need a better hash funcion - unsigned int seed = World::getWorld()->getBaseRandomSeed() + rdata->m_id*84859; - unsigned int oldseed = Random::randi(INT_MAX); - Random::setRandomSeed(seed); - - // temporaere Daten fuer die Erzeugung der Region - MapGenerator::MapData mdata; - - bool success = false; - int counter =0; - while (!success) - { - counter ++; - if (counter > 10) - return 0; - - // Speicher anfordern - MapGenerator::createMapData(&mdata,rdata); - - SoundHelper::signalSoundManager (); - - // grundlegende Karte anfertigen - if (rdata->m_region_template =="") - { - MapGenerator::createBaseMap(&mdata,rdata); - } - - // Umgebungen in die Region einfuegen - std::list<std::pair<float, EnvironmentName> >::iterator et; - for (et = rdata->m_environments.begin(); et != rdata->m_environments.end(); ++et) - { - mdata.m_region->insertEnvironment(et->first,et->second); - } - - // Umgebungskarte generieren - createPerlinNoise(&mdata.m_region->getHeight(), rdata->m_dimx, rdata->m_dimy,MathHelper::Min(rdata->m_dimx,rdata->m_dimy)/4 , 0.4,false); - - if (rdata->m_region_template =="") - { - // Objektgruppen platzieren - success = MapGenerator::insertGroupTemplates(&mdata,rdata); - } - else - { - DEBUGX("region template %s",rdata->m_region_template.c_str()); - // Region besteht aus einer einzelnen Objektgruppe - // Objektgruppe anhand des Namens suchen - ObjectGroup* templ; - templ = ObjectFactory::getObjectGroup(rdata->m_region_template); - if (templ ==0) - { - ERRORMSG("unknown object group %s",rdata->m_region_template.c_str()); - return 0; - } - - Vector pos(rdata->m_dimx*2, rdata->m_dimy*2); - mdata.m_region->createObjectGroup(rdata->m_region_template,pos,0); - success = true; - } - - // Events kopieren - mdata.m_region->copyEventsFromRegionData(rdata); - - mdata.m_region->setReviveLocation(rdata->m_revive_location); - mdata.m_region->setGroundMaterial(rdata->m_ground_material); - - // Wenn der Versuch nicht erfolgreich war alles loeschen und von vorn beginnen - if (!success) - { - DEBUG("not successful"); - - delete mdata.m_base_map; - delete mdata.m_region; - } - } - - if (rdata->m_region_template =="") - { - // Berandungen einfuegen - MapGenerator::createBorder(&mdata,rdata); - } - - // Ausgaenge erzeugen - MapGenerator::createExits(&mdata,rdata); - - if (rdata->m_region_template =="") - { - // Monster einfuegen - MapGenerator::insertSpawnpoints(&mdata,rdata); - } - - // Speicher freigeben - delete mdata.m_base_map; - - // Zufallszahlengenerator zuruecksetzen - Random::setRandomSeed(oldseed); - - float duration = timer.getTime (); - DEBUG ("Map generator created region in %.2f millis", duration); - return mdata.m_region; -} - - -void MapGenerator::createMapData(MapData* mdata, RegionData* rdata) -{ - mdata->m_base_map = new Matrix2d<char>(rdata->m_dimx/2,rdata->m_dimy/2); - mdata->m_base_map->clear(); - mdata->m_region = new Region(rdata->m_dimx,rdata->m_dimy,rdata->m_id,rdata->m_name,rdata); - mdata->m_border.clear(); -} - - -void MapGenerator::createBaseMap(MapData* mdata, RegionData* rdata) -{ - float size = rdata->m_area_percent; - - // Karte wird in 8x8 Felder erzeugt, Region rechnet aber in 4x4 Gridunits - int dimx = rdata->m_dimx/2; - int dimy = rdata->m_dimy/2; - - // temporaere Karte anlegen - Matrix2d<float>* hmap = new Matrix2d<float>(dimx, dimy); - - hmap->clear(); - - // Karte erzeugen mit Perlin Noise - // erhaltenes Feld wird als Hoehenkarte interpretiert - // alle Felder die unterhalb eines kritischen Niveaus liegen sind begehbar - createPerlinNoise(hmap,dimx, dimy, rdata->m_granularity/2, rdata->m_complexity,true); - - - // Delta zu Nachbarfeldern - int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; - int dnb[8][2] = {{-1,0},{1,0},{0,-1},{0,1},{-1,1},{1,1},{1,-1},{-1,-1}}; - - // Suchen eine Niveaus das eine hinreichend grosse zusammenhaengende Flaeche erzeugt - // Idee: alle Felder werden in einer PriorityQueue eingeordnet - // alle Felder werden in einen UnionFind Baum eingeordnet - // von kleinster Höhe beginnend werden die Felder jeweils mit dem tiefstliegenden Nachbarfeld verschmolzen - - std::priority_queue<WeightedLocation> fields_queue; - WeightedLocation loc; - for (int i=0; i< dimx; i++) - { - for (int j=0; j< dimy; j++) - { - loc.m_x = i; - loc.m_y = j; - loc.m_value = 1- (*hmap)[i][j]; - - fields_queue.push(loc); - } - } - - UnionFindTree uftree(dimx*dimy); - - float height; - int x,y,nbx, nby; - - // Solange *Wasserstand* erhoehen, bis eine genuegend grosse zusammenhaengende Flaeche gefunden wurde - while (1) - { - // oberstes Feld aus der Queue nehmen - loc = fields_queue.top(); - fields_queue.pop(); - - height = 1-loc.m_value; - x = loc.m_x; - y = loc.m_y; - - // Schleife ueber die Nachbarfelder - for (int i=0; i<4; i++) - { - nbx = x + nb[i][0]; - nby = y + nb[i][1]; - - // Dimension pruefen - if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) - continue; - - if ( (*hmap)[nbx][nby] <= height) - { - uftree.merge(nbx*dimy+nby,x*dimy+y); - } - } - - // Testen ob eine hinreichend große Flaeche entstanden ist - if (uftree.getCardinality(x*dimy+y) >= dimx*dimy*size) - { - break; - } - - } - - // kleiner Aufschlag um sehr enge Durchgaenge zu vermeiden - height += 0.01; - - /* - // Debugging - DEBUG("height %f",height); - for (int j=0; j< dimy; j++) - { - for (int i=0; i< dimx; i++) - { - if ((*hmap)[i][j]<height) - { - std::cout << " "; - } - else - { - std::cout << "X"; - } - } - std::cout << "\n"; - } - */ - - // Floodfill um die Flaeche und deren Rand zu finden - // die besuchten Felder werden in border mit 1 markiert - // es werden nur Felder besucht, die unterhalb der gefundenen Hoehe liegen - int cnt=0; - std::queue<std::pair<int,int> > qu; - std::pair<int,int> point; - - // Queue mit Felder die zum Rand gehoeren - std::queue<std::pair<int,int> > borderqu; - - qu.push(std::make_pair(x,y)); - (*(mdata->m_base_map))[x][y]=1; - - // Solange die Queue nicht leer ist - - while (!qu.empty()) - { - // Feld entnehmen - point = qu.front(); - qu.pop(); - - x = point.first; - y = point.second; - - // Schleife ueber die Nachbarfelder - for (int i=0; i<4; i++) - { - nbx = x + nb[i][0]; - nby = y + nb[i][1]; - - // Dimension pruefen - if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) - continue; - - // nur noch nicht besuchte Felder - if ((*(mdata->m_base_map))[nbx][nby] != 0) - continue; - - // Felder oberhalb der Obergrenze zum Rand hinzufuegen - if ((*hmap)[nbx][nby] > height) - { - borderqu.push(std::make_pair(nbx,nby)); - (*(mdata->m_base_map))[nbx][nby]=-1; - - mdata->m_border.push_back(std::make_pair(nbx,nby)); - continue; - } - - // Feld hinzufuegen - qu.push(std::make_pair(nbx,nby)); - // als besucht markieren - (*(mdata->m_base_map))[nbx][nby]=1; - - cnt++; - } - } - - //std::list<std::pair<int,int> >::iterator it; - //for ( - - - // nochmal 3 Runden Floodfill um den Rand zu ermitteln - - // Marker einfuegen - int markercnt =0; - borderqu.push(std::make_pair(-1,-1)); - - - while (!borderqu.empty() && markercnt <3) - { - // Feld entnehmen - point = borderqu.front(); - borderqu.pop(); - - x = point.first; - y = point.second; - - // Testen ob der Marker entnommen wurde - if (x==-1) - { - markercnt ++; - borderqu.push(std::make_pair(-1,-1)); - continue; - } - - // Schleife ueber die Nachbarfelder - for (int i=0; i<8; i++) - { - nbx = x + dnb[i][0]; - nby = y + dnb[i][1]; - - // Dimension pruefen - if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) - continue; - - // nur noch nicht besuchte Felder - if ((*(mdata->m_base_map))[nbx][nby] != 0) - continue; - - - // Feld hinzufuegen - borderqu.push(std::make_pair(nbx,nby)); - // als besucht markieren - (*(mdata->m_base_map))[nbx][nby]=-1; - } - } - - - delete hmap; -} - -bool MapGenerator::insertGroupTemplates(MapData* mdata, RegionData* rdata) -{ - TemplateMap tmap(rdata->m_dimx, rdata->m_dimy); - tmap.init(mdata->m_base_map); - - // obligatorische Objektgruppen einfuegen - - std::multimap<int, RegionData::NamedObjectGroup >::reverse_iterator it; - Shape s; - Vector pos; - bool succ; - - for (it = rdata->m_named_object_groups.rbegin(); it != rdata->m_named_object_groups.rend(); ++it) - { - // Objektgruppe anhand des Namens suchen - s = ObjectFactory::getObjectGroupShape(it->second.m_group_name); - if (s.m_center.m_x < 0) - { - ERRORMSG("unknown object group %s",it->second.m_group_name.c_str()); - continue; - } - - // Ort fuer das Template suchen - succ = tmap.getTemplatePlace(&s,pos); - s.m_center = pos; - - if (succ == false) - { - // Obligatorisches Template konnte nicht platziert werden - DEBUG("could not place template %s",it->second.m_group_name.c_str()); - /* - int hdimx = rdata->m_dimx/2; - int hdimy = rdata->m_dimy/2; - for (int i=0; i<hdimx; i++) - { - for (int j=0; j< hdimy;j++) - { - if (*(mdata->m_base_map->ind(i,j)) != -1) - { - std::cout << " "; - } - else - { - std::cout << "# "; - } - } - std::cout << "\n"; - } - */ - return false; - } - - // Objektgruppe einfuegen - DEBUGX("placing group %s at %f %f",it->second.m_group_name.c_str(), pos.m_x, pos.m_y); - mdata->m_region->createObjectGroup(it->second.m_group_name,pos,s.m_angle, it->second.m_name); - insertBlockedArea(mdata,s); - - - } - - if (rdata->m_has_waypoint) - { - ObjectGroup* templ; - - // Wegpunkt einfuegen - templ = ObjectFactory::getObjectGroup("waypoint_templ"); - memcpy(&s , templ->getShape(), sizeof(Shape)); - succ = tmap.getTemplatePlace(&s,pos); - s.m_center = pos; - - if (succ == false) - { - // Wegpunkt konnte nicht platziert werden - DEBUG("could not place waypoint"); - return false; - } - mdata->m_region->createObjectGroup("waypoint_templ",pos,0); - insertBlockedArea(mdata,s); - } - - // fakultative Objektgruppen einfuegen - - std::multimap<int, RegionData::ObjectGroupSet >::reverse_iterator jt; - for (jt = rdata->m_object_groups.rbegin(); jt != rdata->m_object_groups.rend(); ++jt) - { - s = ObjectFactory::getObjectGroupShape(jt->second.m_group_name); - if (s.m_center.m_x < 0) - { - ERRORMSG("unknown object group %s",jt->second.m_group_name.c_str()); - continue; - } - - DEBUGX("template %s size %f %f",jt->second.m_group_name.c_str(),s.m_extent.m_x, s.m_extent.m_y); - float angle =0; - for (int i=0; i< jt->second.m_number; i++) - { - if (Random::random() > jt->second.m_probability) - { - continue; - } - - // Drehwinkel ermitteln - // Kreise beliebig Rechtecke nur um 90° - if (s.m_type == Shape::CIRCLE) - { - angle = 2*3.14159*Random::random(); - } - else - { - int n = Random::randi(4); - angle = 3.14159*(n*90.0)/180.0; - } - s.m_angle = angle; - - // Ort fuer das Template suchen - succ = tmap.getTemplatePlace(&s,pos); - s.m_center = pos; - - if (succ == false) - { - // Template konnte nicht platziert werden - break; - } - - // Objektgruppe einfuegen - DEBUGX("placing group %s at %f %f",jt->second.m_group_name.c_str(), pos.m_x, pos.m_y); - - mdata->m_region->createObjectGroup(jt->second.m_group_name,pos,angle); - if (! jt->second.m_decoration) - { - insertBlockedArea(mdata,s); - } - } - - } - return true; -} - - -void MapGenerator::createBorder(MapData* mdata, RegionData* rdata) -{ - // Delta zu Nachbarfeldern - int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; - - int hdimx = rdata->m_dimx/2; - int hdimy = rdata->m_dimy/2; - - // Orte fuer den Ausgang in den vier Richtungen - int exit[4][2]; - int exitcount[4]; - for (int i=0; i<4; i++) - { - exit[i][0] = nb[i][0]*-1000; - exit[i][1] = nb[i][1]*-1000; - exitcount[i] =1; - } - - // Ausgaenge suchen - for (int i=0; i<hdimx; i++) - { - for (int j=0; j< hdimy;j++) - { - if (*(mdata->m_base_map->ind(i,j)) >=1 ) - { - // Testen ob das Feld als Ausgang in Frage kommt - // Also am noerdlichsten, westlichsten usw liegt - for (int k=0; k<4; k++) - { - if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] < i*nb[k][0] + j*nb[k][1]) - { - exit[k][0] =i; - exit[k][1] =j; - exitcount[k] =1; - } - - if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] == i*nb[k][0] + j*nb[k][1]) - { - int rnd = Random::randi(exitcount[k]); - if (rnd ==0) - { - exit[k][0] =i; - exit[k][1] =j; - } - exitcount[k] ++; - } - } - } - - } - } - - // Ausgaenge platzieren - for (int k=0; k<4; k++) - { - std::string dirname[4] = {"west","east","north","south"}; - std::string locname; - if (rdata->m_exit_directions[k]) - { - int i = exit[k][0]; - int j = exit[k][1]; - - - locname = "entry_"; - locname += dirname[k]; - mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4)); - *(mdata->m_base_map->ind(i,j)) = 2; - - i+= nb[k][0]; - j+= nb[k][1]; - locname = "exit_"; - locname += dirname[k]; - mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4)); - - while (i>=0 && j>=0 && i< hdimx && j<hdimy) - { - *(mdata->m_base_map->ind(i,j)) = 2; - i+= nb[k][0]; - j+= nb[k][1]; - } - } - } - - - - // fuer jedes markierte Feld werden die 4 Nachbarfelder angesehen - // die 4 Informationen werden als 4bit Zahl interpretiert - // blockierte Felder erhalten eine 0, freie eine 1 - // - // es gibt 6 verschiedene Konstellationen fuer die Nachbarfelder - // die 4bit Zahl dient als Index um die Konstellation und den Drehwinkel zu erhalten - // - // Aufbau der Bitmaske: - // - // D - // A*B - // C - // => Bitmaske ABCD - - // Liste mit den 6 verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind - // Form der 6 Template (+ frei, # blockiert): - // - // ?+? ?+? ?+? ?+? ?#? ?+? - // ### ##+ ### ##+ ### +#+ - // ?#? ?#? ?+? ?+? ?#? ?+? - std::string borders[6] = {"$border(side)","$border(corner)","$border(twoside)","$border(twocorner)","$border(filled)","$border(single_block)"}; - - // Maske dafuer, welche Situation vorliegt - int bmask[16]={4,0,0,2,0,1,1,3,0,1,1,3,2,3,3,5}; - - // Maske fuer die Rotationswinkel in Schritten von 90 Grad - int rotmask[16] = {0,0,2,0,3,0,3,0,1,1,2,2,1,1,3,0}; - int mask =0; - int nbi, nbj; - - // Abstaende der Diagonalen - int diag[4][2] ={{-1,-1},{-1,1},{1,1},{1,-1}}; - - // Fuer die Diagonalen wird eine aehnliche Bitmaske erstellt: - // // eine 1 wird gesetzt, wenn das Feld selbst frei ist, die beiden Felder daneben aber besetzt - // - // B C - // * - // A D - // => Bitmaske ABCD - - // Liste mit den verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind - // Form der Template (+ frei, # blockiert): - // - // ### ### ##+ +## +#+ +#+ - // ### ### ### ### ### ### - // ### ##+ ##+ ##+ ##+ +#+ - - std::string smallcorners[8] = {"","(one_smallcorner)","(two_smallcorner)","(diag_smallcorner)","(three_smallcorner)","(four_smallcorner)"}; - - int diagbmask[16]= {0,1,1,2,1,3,2,4, 1,2,3,4,2,4,4,5}; - int diagrotmask[16] = {0,0,1,0,2,0,1,0, 3,3,3,3,2,2,1,0}; - - int diagi, diagj; - int dmask; - - ObjectGroupName templ,diagtempl; - float angle; - - bool skip; - - - for (int j=0; j< hdimy;j++) - { - for (int i=0; i<hdimx; i++) - { - skip = false; - if (*(mdata->m_base_map->ind(i,j)) != -1) - { - //std::cout << " "; - continue; - } - - mask =0; - dmask =0; - - // Bitmasken aufbauen - for (int k=0; k<4; k++) - { - nbi = i + nb[k][0]; - nbj = j + nb[k][1]; - - mask *=2; - dmask *= 2; - - if ( nbi>=0 && nbj>=0 && nbi<hdimx && nbj<hdimy) - { - if (*(mdata->m_base_map->ind(nbi,nbj)) >= 1) - { - mask +=1; - } - - // Wenn eines der Nachbarfelder im *leeren Raum* liegt - // dann keine Objekte setzen - if (*(mdata->m_base_map->ind(nbi,nbj)) == 0) - { - skip = true; - } - } - - - - // Bitmaske fuer Diagonalen - diagi = i + diag[k][0]; - diagj = j + diag[k][1]; - - if ( diagi>=0 && diagj>=0 && diagi<hdimx && diagj<hdimy) - { - if (*(mdata->m_base_map->ind(diagi,diagj)) >= 1 && - *(mdata->m_base_map->ind(diagi,j)) == -1 && - *(mdata->m_base_map->ind(i,diagj)) == -1) - { - dmask +=1; - } - } - - } - - //std::cout << bmask[dmask] <<" "; - if (skip) - continue; - - // Template und dessen Winkel bestimmen - templ = borders[bmask[mask]]; - angle = rotmask[mask] *PI/2; - - diagtempl = smallcorners[diagbmask[dmask]]; - float diagangle = diagrotmask[dmask] *PI/2; - - // gemeinsames Template aus Innenecken und Rand herstellen - if (templ == "$border(filled)" && diagtempl !="") - { - templ ="$border"; - templ += diagtempl; - angle = diagangle; - } - else if (templ == "$border(side)" && diagtempl == "(one_smallcorner)") - { - if (angle == diagangle) - { - templ = "$border(side)(right_smallcorner)"; - } - else - { - templ = "$border(side)(left_smallcorner)"; - } - } - else - { - templ += diagtempl; - } - - DEBUGX("placing type (%i %i) %s",i,j,templ.c_str()); - - mdata->m_region->createObjectGroup(templ,Vector(i*8+4,j*8+4),angle); - } - //std::cout << "\n"; - } - - - -} - -void MapGenerator::insertSpawnpoints(MapData* mdata, RegionData* rdata) -{ - // Punkte an denen Spawnpoints möglich sind - std::vector< std::pair<int,int> > points; - - int hdimx = rdata->m_dimx/2; - int hdimy = rdata->m_dimy/2; - - // moegliche Orte fuer Spawnpoints ermitteln - for (int i=0; i<hdimx; i++) - { - for (int j=0; j< hdimy;j++) - { - // nur erreichbare Felder - if (*(mdata->m_base_map->ind(i,j)) !=1) - { - continue; - } - - points.push_back(std::make_pair(i,j)); - } - } - - - // Spawnpoints platzieren - std::list<RegionData::SpawnGroup>::iterator st; - WorldObject* wo; - bool stop = false; - for (st = rdata->m_monsters.begin(); st != rdata->m_monsters.end() &&!stop; ++st) - { - // aufhoeren, wenn keine Orte mehr vorhanden - - DEBUGX("%s x %i",st->m_monsters.c_str(),st->m_number); - for (int i=0; i< st->m_number; i++) - { - int r = Random::randi(points.size()); - wo = new Spawnpoint(st->m_monsters); - - mdata->m_region->insertObject(wo,Vector(points[r].first*8+4, points[r].second*8+4)); - - DEBUGX("placing spawnpoint for %s at %i %i",st->m_monsters.c_str(), points[r].first*8+4, points[r].second*8+4); - - points[r] = points.back(); - points.resize(points.size() -1); - if (points.empty()) - { - stop = true; - break; - } - } - } -} - - -void MapGenerator::createExits(MapData* mdata, RegionData* rdata) -{ - int dimx = rdata->m_dimx/2; - int dimy = rdata->m_dimy/2; - - std::list<RegionExit>::iterator it; - Vector pos; - for (it = rdata->m_exits.begin(); it != rdata->m_exits.end(); ++it) - { - mdata->m_region->addExit(*it); - - // Bei den Ausgaengen keine Monster - if (rdata->m_region_template =="") - { - pos = mdata->m_region->getLocation(it->m_exit_name); - int cx = int(pos.m_x/8); - int cy = int(pos.m_y/8); - for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++) - { - for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++) - { - if (*(mdata->m_base_map->ind(i,j))==1) - { - *(mdata->m_base_map->ind(i,j)) = 2; - } - } - } - } - - } - - if (rdata->m_has_waypoint) - { - Vector pos = mdata->m_region->getLocation("WaypointLoc"); - WorldObject* wo = new Waypoint(); - mdata->m_region->insertObject(wo,pos); - mdata->m_region->getWaypointLocation() = pos; - - //mdata->m_region->insertObject(wo,pos); - DEBUGX("waypoint at %f %f %i",pos.m_x, pos.m_y,wo->getId()); - - // Bei den Ausgaengen keine Monster - if (rdata->m_region_template =="") - { - int cx = int(pos.m_x/8); - int cy = int(pos.m_y/8); - for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++) - { - for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++) - { - if (*(mdata->m_base_map->ind(i,j))==1) - { - *(mdata->m_base_map->ind(i,j)) = 2; - } - } - } - } - } -} - -void MapGenerator::insertBlockedArea(MapData* mdata, Shape s) -{ - // Groesse des Templates in 4x4 Feldern - Vector ext = s.getAxisExtent(); - Vector emin = s.m_center - ext; - Vector emax = s.m_center + ext; - int imin = int(emin.m_x / 8); - int jmin = int(emin.m_y / 8); - int imax = int( ceil(emax.m_x / 8)); - int jmax = int( ceil(emax.m_y / 8)); - - for (int i=imin; i< imax; i++) - { - for (int j=jmin; j<jmax; j++) - { - if (*(mdata->m_base_map->ind(i,j))==1) - { - *(mdata->m_base_map->ind(i,j)) = 2; - } - } - } -} - - -void MapGenerator::createPerlinNoise(Matrix2d<float> *data, int dimx, int dimy,int startfreq, float persistance, bool bounds) -{ - Matrix2d<float>* tmp= new Matrix2d<float>(dimx+1, dimy+1); - tmp->clear(); - float* weight = new float[MathHelper::Min(dimx,dimy)]; - float ampl =1; - int dx,dy; - float invdist; - - if (startfreq > dimx || startfreq > dimy) - { - startfreq = MathHelper::Min(dimx,dimy); - } - - DEBUGX("Perlin noise dimx %i dimy %i",dimx,dimy); - - // Perlin Noise Algorithmus - // Aenderung hier: Schleife geht ueber den Abstand zwischen den Stuetzstellen - for (int dist = startfreq; dist>0 ;dist/=2) - { - // Dimension des Zufallszahlenfeldes fuer diesen Abstand - dx = 2+(dimx-2)/dist; - dy = 2+(dimy-2)/dist; - - DEBUGX("distance %i tmp array %i %i",dist,dx,dy); - - // anlegen der Zufallszahlen fuer die aktuelle Frequenz - for (int i=0;i<=dx;i++) - { - for (int j=0;j<=dy;j++) - { - *(tmp->ind(i,j)) = Random::random()* ampl; - - } - - } - - // Interpolation (nur fuer Abstand >1) - if (dist>1) - { - invdist = 1.0f/dist; - - for (int k=0;k<dist;k++) - { - weight[k] = k*invdist; - } - - - - for (int i=0;i<dx;i++) - { - for (int j=0;j<dy;j++) - { - for (int k=0;k<dist;k++) - { - for (int l=0;l<dist;l++) - { - if (i*dist+k< dimx && j*dist+l< dimy) - { - *(data->ind(i*dist+k,j*dist+l)) += (*(tmp->ind(i,j))*(1-weight[k])*(1-weight[l]) - + *(tmp->ind(i+1,j))*weight[k]*(1-weight[l]) - + *(tmp->ind(i+1,j+1))*weight[k]*weight[l] - + *(tmp->ind(i,j+1))*(1-weight[k])*weight[l]) ; - } - } - } - } - } - } - else - { - for (int i=0;i<dimx;i++) - { - for (int j=0;j<dimy;j++) - { - *(data->ind(i,j)) +=*(tmp->ind(i,j)); - } - } - } - - ampl *= persistance; - /* - if (bounds) - { - - std::cout.width(6); - std::cout << "\n"; - for (int j=0;j<dy;j++) - { - for (int i=0;i<dx;i++) - { - - std::cout << *(tmp->ind(i,j))<<" "; - } - std::cout << "\n"; - } - } - if (bounds) - { - - std::cout.width(6); - std::cout << "\n"; - for (int j=0;j<dimy;j++) - { - for (int i=0;i<dimx;i++) - { - std::cout << *(data->ind(i,j))<<" "; - } - std::cout << "\n"; - } - } - */ - } - - // Maximum und Minimum suchen - float fmax =0,fmin = 1000000; - for (int i=0;i<dimx;i++) - { - for (int j=0;j<dimy;j++) - { - if (*(data->ind(i,j)) > fmax) - { - fmax = *(data->ind(i,j)); - } - if (*(data->ind(i,j)) < fmin) - { - fmin = *(data->ind(i,j)); - } - - - } - } - - // normieren auf [0..1] - for (int i=0;i<dimx;i++) - { - for (int j=0;j<dimy;j++) - { - *(data->ind(i,j)) -= fmin; - if (fmax-fmin !=0) - { - *(data->ind(i,j)) /= (fmax-fmin); - } - } - } - - - // Raender anlegen - if (bounds) - { - float bnd = MathHelper::Min(5.0f, MathHelper::Min(dimx/3.0f,dimy/3.0f)); - float dist; - for (int i=0;i<dimx;i++) - { - for (int j=0;j<dimy;j++) - { - dist = MathHelper::Min(MathHelper::Min(i,dimx-i-1),MathHelper::Min(j,dimy-j-1)); - if (dist<bnd) - { - *(data->ind(i,j)) = *(data->ind(i,j))*(dist)/bnd + (bnd-dist)/bnd; - } - } - } - } - - /* - //Debugging - - std::cout << "\n"; - for (int j=0;j<dimy;j++) - { - for (int i=0;i<dimx;i++) - { - std::cout << *(data->ind(i,j))<<" "; - } - std::cout << "\n"; - } - */ - delete[] weight; - delete tmp; -} - - - + + +bool operator<(WeightedLocation first, WeightedLocation second) +{ + return first.m_value< second.m_value; +} + +TemplateMap::TemplateMap(int dimx, int dimy) + : m_template_map(dimx,dimy) , m_template_index_map(dimx,dimy) +{ + m_dimx = dimx; + m_dimy = dimy; +} + +void TemplateMap::init(Matrix2d<char>* base_map) +{ + // Dimension der Basiskarte + int bdimx = m_dimx/2; + int bdimy = m_dimy/2; + + m_template_map.clear(); + m_template_index_map.clear(); + int val; + + // 8x8 Feld Informationen aus der Basiskarte in + // 4x4 Karte uebertragen + for (int i=0; i<bdimx; i++) + { + for (int j=0; j<bdimy; j++) + { + if ((*base_map)[i][j] <= 0) + { + val = -1; + } + else + { + val =0; + } + + m_template_map[2*i][2*j] = val; + m_template_map[2*i][2*j+1] = val; + m_template_map[2*i+1][2*j+1] = val; + m_template_map[2*i+1][2*j] = val; + } + } + + // unterer und linker Rand mit -1 fuellen + for (int i=0; i<m_dimx; i++) + { + m_template_map[i][m_dimy-1] = -1; + } + for (int j=0; j<m_dimy; j++) + { + m_template_map[m_dimx-1][j] = -1; + } + + // restliche Karte berechnen + for (int i=m_dimx-2; i>=0; i--) + { + for (int j=m_dimy-2; j>=0; j--) + { + recalcMapElement(i,j); + } + } +} + +void TemplateMap::recalcMapElement(int i,int j) +{ + int val; + if (i >= m_dimx || j >= m_dimy) + return; + + if (i== m_dimx-1 || j == m_dimy-1) + { + val = -1; // Rand immer blockiert + } + else if (m_template_map[i][j] == -1) + { + val = -1; // blockiert bleibt blockiert + } + else + { + // Minimum aus den Felden darunter, daneben, diagonal darunter; plus 1 + val = m_template_map[i+1][j]; + val = MathHelper::Min(val, m_template_map[i][j+1]); + val = MathHelper::Min(val, m_template_map[i+1][j+1]); + val ++; + + if (val == 0) + val = 1; + } + + if (val != -1) + { + setMapElement(i,j,val); + } +} + +void TemplateMap::setMapElement(int i, int j, int template_max_size) +{ + int oldval = m_template_map[i][j]; + + if (oldval == template_max_size || oldval == -1) + return; + + // aus Datenstrukturen entfernen falls alter Wert > 0 + if (oldval > 0) + { + // geloescht wird, indem das letzte Element des Vektors + // ueber das zu loeschende kopiert wird + int oldindex = m_template_index_map[i][j]; + int vecsize = m_template_places[oldval].size(); + if (oldindex != vecsize -1) + { + int lastx = m_template_places[oldval][vecsize-1].first; + int lasty = m_template_places[oldval][vecsize-1].second; + m_template_places[oldval][oldindex].first = lastx; + m_template_places[oldval][oldindex].second = lasty; + m_template_index_map[lastx][lasty] = oldindex; + } + + //m_template_places[oldval].resize(vecsize-1); + m_template_places[oldval].pop_back (); + } + + m_template_map[i][j] = template_max_size; + + // Eintragen des neuen Wertes in die Datenstrukturen + if (template_max_size > 0) + { + int vecsize = m_template_places[template_max_size].size(); + m_template_places[template_max_size].resize(vecsize +1); + m_template_places[template_max_size][vecsize].first = i; + m_template_places[template_max_size][vecsize].second = j; + m_template_index_map[i][j] = vecsize; + } + +} + +bool TemplateMap::getTemplatePlace(Shape* shape, Vector & place) +{ + if (shape ==0) + { + return false; + } + + bool success = false; + + // Groesse des Templates in 4x4 Feldern + Vector ext = shape->getAxisExtent(); + int ex = int(ceil(ext.m_x/2)); + int ey = int(ceil(ext.m_y/2)); + + int size = MathHelper::Max(ex,ey); + DEBUGX("template size %i %i angle %f extent %f %f",ex,ey,shape->m_angle,shape->m_extent.m_x, shape->m_extent.m_y); + std::map< int, std::vector< std::pair<int, int> > >::iterator mt, mt2; + std::vector<int>::iterator st; + + int px,py; + + while (!success) + { + int nr; + // Anzahl der in Frage kommenden Orte ermitteln + // alle Orte aufsummieren mit Abstandsindex mindens size + nr =0; + mt2 = mt = m_template_places.lower_bound(size); + + while (mt != m_template_places.end()) + { + nr += mt->second.size(); + ++mt; + } + + if (nr == 0) + { + // kein Platz fuer das Template vorhanden + return false; + } + + // Ort auswuerfeln und ermitteln + nr = Random::randi(nr); + mt = mt2; + while (nr >= int(mt->second.size())) + { + nr -= mt->second.size(); + ++mt; + } + + px = mt->second[nr].first; + py = mt->second[nr].second; + + // Flaeche die durch das Template ueberdeckt wird bestimmen + int imin = px; + int jmin = py; + int imax = imin + ex -1; + int jmax = jmin + ey -1; + // Ort eines eventuellen Hindernisses + int obi = -1, obj= -1; + + // Pruefen ob die Flaeche keine Hindernisse enthaelt + for (int i = imin; i<= imax; i++) + { + for (int j= jmin; j<= jmax; j++) + { + if (m_template_map[i][j] <0) + { + obi = i; + obj = j; + DEBUGX("found obstacle at %i %i",i,j); + break; + } + } + if (obi != -1) + { + break; + } + } + + if (obi != -1) + { + // Hindernis gefunden + + // dieses Hindernis verhindert das platzieren der Templates in seiner Umgebung + // in dieser Umgebung werden die Zahlen fuer den minimalen Abstand zum naechsten Hindernis aktualisiert + imin = MathHelper::Max(0,obi - size+1); + jmin = MathHelper::Max(0,obj - size+1); + imax = obi; + jmax = obj; + + // Schleife ueber die Umgebung des Hindernisses + for (int i = imax; i>= imin; i--) + { + for (int j= jmax; j>= jmin; j--) + { + recalcMapElement(i,j); + } + } + } + else + { + // Erfolg + // Orte die von dem Template ueberdeckt werden aus der Liste der freien Orte entfernen + + // Objekt auf der Template Karte eintragen + for (int i = imin; i<= imax; i++) + { + for (int j= jmin; j<= jmax; j++) + { + setMapElement(i,j,-1); + } + } + + place.m_x = px*4+2*ex; + place.m_y = py*4+2*ey; + + DEBUGX("found place %i %i",px,py); + + success = true; + } + } + return true; +} + + +void TemplateMap::print() +{ + for (int i=0; i< m_dimx; i++) + { + for (int j=0; j<m_dimy; j++) + { + if (m_template_map[i][j]>0) + std::cout << m_template_map[i][j] << " "; + else + std::cout << "# "; + } + std::cout << "\n"; + } + std::cout << "\n"; + + std::map< int, std::vector< std::pair<int, int> > >::iterator it; + for (it = m_template_places.begin(); it != m_template_places.end(); ++it) + { + SW_DEBUG("places of size %i : %i",it->first, it->second.size()); + } +} + + +Region* MapGenerator::createRegion(RegionData* rdata) +{ + // TODO: remove timer. + static Timer timer; + timer.start (); + + // set Random seed based on the region information + // surely, we need a better hash funcion + unsigned int seed = World::getWorld()->getBaseRandomSeed() + rdata->m_id*84859; + unsigned int oldseed = Random::randi(INT_MAX); + Random::setRandomSeed(seed); + + // temporaere Daten fuer die Erzeugung der Region + MapGenerator::MapData mdata; + + bool success = false; + int counter =0; + while (!success) + { + counter ++; + if (counter > 10) + return 0; + + // Speicher anfordern + MapGenerator::createMapData(&mdata,rdata); + + SoundHelper::signalSoundManager (); + + // grundlegende Karte anfertigen + if (rdata->m_region_template =="") + { + MapGenerator::createBaseMap(&mdata,rdata); + } + + // Umgebungen in die Region einfuegen + std::list<std::pair<float, EnvironmentName> >::iterator et; + for (et = rdata->m_environments.begin(); et != rdata->m_environments.end(); ++et) + { + mdata.m_region->insertEnvironment(et->first,et->second); + } + + // Umgebungskarte generieren + createPerlinNoise(&mdata.m_region->getHeight(), rdata->m_dimx, rdata->m_dimy,MathHelper::Min(rdata->m_dimx,rdata->m_dimy)/4 , 0.4,false); + + if (rdata->m_region_template =="") + { + // Objektgruppen platzieren + success = MapGenerator::insertGroupTemplates(&mdata,rdata); + } + else + { + DEBUGX("region template %s",rdata->m_region_template.c_str()); + // Region besteht aus einer einzelnen Objektgruppe + // Objektgruppe anhand des Namens suchen + ObjectGroup* templ; + templ = ObjectFactory::getObjectGroup(rdata->m_region_template); + if (templ ==0) + { + ERRORMSG("unknown object group %s",rdata->m_region_template.c_str()); + return 0; + } + + Vector pos(rdata->m_dimx*2, rdata->m_dimy*2); + mdata.m_region->createObjectGroup(rdata->m_region_template,pos,0); + success = true; + } + + // Events kopieren + mdata.m_region->copyEventsFromRegionData(rdata); + + mdata.m_region->setReviveLocation(rdata->m_revive_location); + mdata.m_region->setGroundMaterial(rdata->m_ground_material); + + // Wenn der Versuch nicht erfolgreich war alles loeschen und von vorn beginnen + if (!success) + { + SW_DEBUG("not successful"); + + delete mdata.m_base_map; + delete mdata.m_region; + } + } + + if (rdata->m_region_template =="") + { + // Berandungen einfuegen + MapGenerator::createBorder(&mdata,rdata); + } + + // Ausgaenge erzeugen + MapGenerator::createExits(&mdata,rdata); + + if (rdata->m_region_template =="") + { + // Monster einfuegen + MapGenerator::insertSpawnpoints(&mdata,rdata); + } + + // Speicher freigeben + delete mdata.m_base_map; + + // Zufallszahlengenerator zuruecksetzen + Random::setRandomSeed(oldseed); + + float duration = timer.getTime (); + SW_DEBUG ("Map generator created region in %.2f millis", duration); + return mdata.m_region; +} + + +void MapGenerator::createMapData(MapData* mdata, RegionData* rdata) +{ + mdata->m_base_map = new Matrix2d<char>(rdata->m_dimx/2,rdata->m_dimy/2); + mdata->m_base_map->clear(); + mdata->m_region = new Region(rdata->m_dimx,rdata->m_dimy,rdata->m_id,rdata->m_name,rdata); + mdata->m_border.clear(); +} + + +void MapGenerator::createBaseMap(MapData* mdata, RegionData* rdata) +{ + float size = rdata->m_area_percent; + + // Karte wird in 8x8 Felder erzeugt, Region rechnet aber in 4x4 Gridunits + int dimx = rdata->m_dimx/2; + int dimy = rdata->m_dimy/2; + + // temporaere Karte anlegen + Matrix2d<float>* hmap = new Matrix2d<float>(dimx, dimy); + + hmap->clear(); + + // Karte erzeugen mit Perlin Noise + // erhaltenes Feld wird als Hoehenkarte interpretiert + // alle Felder die unterhalb eines kritischen Niveaus liegen sind begehbar + createPerlinNoise(hmap,dimx, dimy, rdata->m_granularity/2, rdata->m_complexity,true); + + + // Delta zu Nachbarfeldern + int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; + int dnb[8][2] = {{-1,0},{1,0},{0,-1},{0,1},{-1,1},{1,1},{1,-1},{-1,-1}}; + + // Suchen eine Niveaus das eine hinreichend grosse zusammenhaengende Flaeche erzeugt + // Idee: alle Felder werden in einer PriorityQueue eingeordnet + // alle Felder werden in einen UnionFind Baum eingeordnet + // von kleinster Höhe beginnend werden die Felder jeweils mit dem tiefstliegenden Nachbarfeld verschmolzen + + std::priority_queue<WeightedLocation> fields_queue; + WeightedLocation loc; + for (int i=0; i< dimx; i++) + { + for (int j=0; j< dimy; j++) + { + loc.m_x = i; + loc.m_y = j; + loc.m_value = 1- (*hmap)[i][j]; + + fields_queue.push(loc); + } + } + + UnionFindTree uftree(dimx*dimy); + + float height; + int x,y,nbx, nby; + + // Solange *Wasserstand* erhoehen, bis eine genuegend grosse zusammenhaengende Flaeche gefunden wurde + while (1) + { + // oberstes Feld aus der Queue nehmen + loc = fields_queue.top(); + fields_queue.pop(); + + height = 1-loc.m_value; + x = loc.m_x; + y = loc.m_y; + + // Schleife ueber die Nachbarfelder + for (int i=0; i<4; i++) + { + nbx = x + nb[i][0]; + nby = y + nb[i][1]; + + // Dimension pruefen + if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) + continue; + + if ( (*hmap)[nbx][nby] <= height) + { + uftree.merge(nbx*dimy+nby,x*dimy+y); + } + } + + // Testen ob eine hinreichend große Flaeche entstanden ist + if (uftree.getCardinality(x*dimy+y) >= dimx*dimy*size) + { + break; + } + + } + + // kleiner Aufschlag um sehr enge Durchgaenge zu vermeiden + height += 0.01; + + /* + // Debugging + DEBUG("height %f",height); + for (int j=0; j< dimy; j++) + { + for (int i=0; i< dimx; i++) + { + if ((*hmap)[i][j]<height) + { + std::cout << " "; + } + else + { + std::cout << "X"; + } + } + std::cout << "\n"; + } + */ + + // Floodfill um die Flaeche und deren Rand zu finden + // die besuchten Felder werden in border mit 1 markiert + // es werden nur Felder besucht, die unterhalb der gefundenen Hoehe liegen + int cnt=0; + std::queue<std::pair<int,int> > qu; + std::pair<int,int> point; + + // Queue mit Felder die zum Rand gehoeren + std::queue<std::pair<int,int> > borderqu; + + qu.push(std::make_pair(x,y)); + (*(mdata->m_base_map))[x][y]=1; + + // Solange die Queue nicht leer ist + + while (!qu.empty()) + { + // Feld entnehmen + point = qu.front(); + qu.pop(); + + x = point.first; + y = point.second; + + // Schleife ueber die Nachbarfelder + for (int i=0; i<4; i++) + { + nbx = x + nb[i][0]; + nby = y + nb[i][1]; + + // Dimension pruefen + if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) + continue; + + // nur noch nicht besuchte Felder + if ((*(mdata->m_base_map))[nbx][nby] != 0) + continue; + + // Felder oberhalb der Obergrenze zum Rand hinzufuegen + if ((*hmap)[nbx][nby] > height) + { + borderqu.push(std::make_pair(nbx,nby)); + (*(mdata->m_base_map))[nbx][nby]=-1; + + mdata->m_border.push_back(std::make_pair(nbx,nby)); + continue; + } + + // Feld hinzufuegen + qu.push(std::make_pair(nbx,nby)); + // als besucht markieren + (*(mdata->m_base_map))[nbx][nby]=1; + + cnt++; + } + } + + //std::list<std::pair<int,int> >::iterator it; + //for ( + + + // nochmal 3 Runden Floodfill um den Rand zu ermitteln + + // Marker einfuegen + int markercnt =0; + borderqu.push(std::make_pair(-1,-1)); + + + while (!borderqu.empty() && markercnt <3) + { + // Feld entnehmen + point = borderqu.front(); + borderqu.pop(); + + x = point.first; + y = point.second; + + // Testen ob der Marker entnommen wurde + if (x==-1) + { + markercnt ++; + borderqu.push(std::make_pair(-1,-1)); + continue; + } + + // Schleife ueber die Nachbarfelder + for (int i=0; i<8; i++) + { + nbx = x + dnb[i][0]; + nby = y + dnb[i][1]; + + // Dimension pruefen + if (nbx<0 || nby<0 || nbx >= dimx || nby >= dimy) + continue; + + // nur noch nicht besuchte Felder + if ((*(mdata->m_base_map))[nbx][nby] != 0) + continue; + + + // Feld hinzufuegen + borderqu.push(std::make_pair(nbx,nby)); + // als besucht markieren + (*(mdata->m_base_map))[nbx][nby]=-1; + } + } + + + delete hmap; +} + +bool MapGenerator::insertGroupTemplates(MapData* mdata, RegionData* rdata) +{ + TemplateMap tmap(rdata->m_dimx, rdata->m_dimy); + tmap.init(mdata->m_base_map); + + // obligatorische Objektgruppen einfuegen + + std::multimap<int, RegionData::NamedObjectGroup >::reverse_iterator it; + Shape s; + Vector pos; + bool succ; + + for (it = rdata->m_named_object_groups.rbegin(); it != rdata->m_named_object_groups.rend(); ++it) + { + // Objektgruppe anhand des Namens suchen + s = ObjectFactory::getObjectGroupShape(it->second.m_group_name); + if (s.m_center.m_x < 0) + { + ERRORMSG("unknown object group %s",it->second.m_group_name.c_str()); + continue; + } + + // Ort fuer das Template suchen + succ = tmap.getTemplatePlace(&s,pos); + s.m_center = pos; + + if (succ == false) + { + // Obligatorisches Template konnte nicht platziert werden + SW_DEBUG("could not place template %s",it->second.m_group_name.c_str()); + /* + int hdimx = rdata->m_dimx/2; + int hdimy = rdata->m_dimy/2; + for (int i=0; i<hdimx; i++) + { + for (int j=0; j< hdimy;j++) + { + if (*(mdata->m_base_map->ind(i,j)) != -1) + { + std::cout << " "; + } + else + { + std::cout << "# "; + } + } + std::cout << "\n"; + } + */ + return false; + } + + // Objektgruppe einfuegen + DEBUGX("placing group %s at %f %f",it->second.m_group_name.c_str(), pos.m_x, pos.m_y); + mdata->m_region->createObjectGroup(it->second.m_group_name,pos,s.m_angle, it->second.m_name); + insertBlockedArea(mdata,s); + + + } + + if (rdata->m_has_waypoint) + { + ObjectGroup* templ; + + // Wegpunkt einfuegen + templ = ObjectFactory::getObjectGroup("waypoint_templ"); + memcpy(&s , templ->getShape(), sizeof(Shape)); + succ = tmap.getTemplatePlace(&s,pos); + s.m_center = pos; + + if (succ == false) + { + // Wegpunkt konnte nicht platziert werden + SW_DEBUG("could not place waypoint"); + return false; + } + mdata->m_region->createObjectGroup("waypoint_templ",pos,0); + insertBlockedArea(mdata,s); + } + + // fakultative Objektgruppen einfuegen + + std::multimap<int, RegionData::ObjectGroupSet >::reverse_iterator jt; + for (jt = rdata->m_object_groups.rbegin(); jt != rdata->m_object_groups.rend(); ++jt) + { + s = ObjectFactory::getObjectGroupShape(jt->second.m_group_name); + if (s.m_center.m_x < 0) + { + ERRORMSG("unknown object group %s",jt->second.m_group_name.c_str()); + continue; + } + + DEBUGX("template %s size %f %f",jt->second.m_group_name.c_str(),s.m_extent.m_x, s.m_extent.m_y); + float angle =0; + for (int i=0; i< jt->second.m_number; i++) + { + if (Random::random() > jt->second.m_probability) + { + continue; + } + + // Drehwinkel ermitteln + // Kreise beliebig Rechtecke nur um 90° + if (s.m_type == Shape::CIRCLE) + { + angle = 2*3.14159*Random::random(); + } + else + { + int n = Random::randi(4); + angle = 3.14159*(n*90.0)/180.0; + } + s.m_angle = angle; + + // Ort fuer das Template suchen + succ = tmap.getTemplatePlace(&s,pos); + s.m_center = pos; + + if (succ == false) + { + // Template konnte nicht platziert werden + break; + } + + // Objektgruppe einfuegen + DEBUGX("placing group %s at %f %f",jt->second.m_group_name.c_str(), pos.m_x, pos.m_y); + + mdata->m_region->createObjectGroup(jt->second.m_group_name,pos,angle); + if (! jt->second.m_decoration) + { + insertBlockedArea(mdata,s); + } + } + + } + return true; +} + + +void MapGenerator::createBorder(MapData* mdata, RegionData* rdata) +{ + // Delta zu Nachbarfeldern + int nb[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; + + int hdimx = rdata->m_dimx/2; + int hdimy = rdata->m_dimy/2; + + // Orte fuer den Ausgang in den vier Richtungen + int exit[4][2]; + int exitcount[4]; + for (int i=0; i<4; i++) + { + exit[i][0] = nb[i][0]*-1000; + exit[i][1] = nb[i][1]*-1000; + exitcount[i] =1; + } + + // Ausgaenge suchen + for (int i=0; i<hdimx; i++) + { + for (int j=0; j< hdimy;j++) + { + if (*(mdata->m_base_map->ind(i,j)) >=1 ) + { + // Testen ob das Feld als Ausgang in Frage kommt + // Also am noerdlichsten, westlichsten usw liegt + for (int k=0; k<4; k++) + { + if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] < i*nb[k][0] + j*nb[k][1]) + { + exit[k][0] =i; + exit[k][1] =j; + exitcount[k] =1; + } + + if (exit[k][0]*nb[k][0] + exit[k][1]*nb[k][1] == i*nb[k][0] + j*nb[k][1]) + { + int rnd = Random::randi(exitcount[k]); + if (rnd ==0) + { + exit[k][0] =i; + exit[k][1] =j; + } + exitcount[k] ++; + } + } + } + + } + } + + // Ausgaenge platzieren + for (int k=0; k<4; k++) + { + std::string dirname[4] = {"west","east","north","south"}; + std::string locname; + if (rdata->m_exit_directions[k]) + { + int i = exit[k][0]; + int j = exit[k][1]; + + + locname = "entry_"; + locname += dirname[k]; + mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4)); + *(mdata->m_base_map->ind(i,j)) = 2; + + i+= nb[k][0]; + j+= nb[k][1]; + locname = "exit_"; + locname += dirname[k]; + mdata->m_region->addLocation(locname,Vector(i*8+4,j*8+4)); + + while (i>=0 && j>=0 && i< hdimx && j<hdimy) + { + *(mdata->m_base_map->ind(i,j)) = 2; + i+= nb[k][0]; + j+= nb[k][1]; + } + } + } + + + + // fuer jedes markierte Feld werden die 4 Nachbarfelder angesehen + // die 4 Informationen werden als 4bit Zahl interpretiert + // blockierte Felder erhalten eine 0, freie eine 1 + // + // es gibt 6 verschiedene Konstellationen fuer die Nachbarfelder + // die 4bit Zahl dient als Index um die Konstellation und den Drehwinkel zu erhalten + // + // Aufbau der Bitmaske: + // + // D + // A*B + // C + // => Bitmaske ABCD + + // Liste mit den 6 verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind + // Form der 6 Template (+ frei, # blockiert): + // + // ?+? ?+? ?+? ?+? ?#? ?+? + // ### ##+ ### ##+ ### +#+ + // ?#? ?#? ?+? ?+? ?#? ?+? + std::string borders[6] = {"$border(side)","$border(corner)","$border(twoside)","$border(twocorner)","$border(filled)","$border(single_block)"}; + + // Maske dafuer, welche Situation vorliegt + int bmask[16]={4,0,0,2,0,1,1,3,0,1,1,3,2,3,3,5}; + + // Maske fuer die Rotationswinkel in Schritten von 90 Grad + int rotmask[16] = {0,0,2,0,3,0,3,0,1,1,2,2,1,1,3,0}; + int mask =0; + int nbi, nbj; + + // Abstaende der Diagonalen + int diag[4][2] ={{-1,-1},{-1,1},{1,1},{1,-1}}; + + // Fuer die Diagonalen wird eine aehnliche Bitmaske erstellt: + // // eine 1 wird gesetzt, wenn das Feld selbst frei ist, die beiden Felder daneben aber besetzt + // + // B C + // * + // A D + // => Bitmaske ABCD + + // Liste mit den verschiedenen Moeglichenkeiten welche Nachbarfelder besetzt sind + // Form der Template (+ frei, # blockiert): + // + // ### ### ##+ +## +#+ +#+ + // ### ### ### ### ### ### + // ### ##+ ##+ ##+ ##+ +#+ + + std::string smallcorners[8] = {"","(one_smallcorner)","(two_smallcorner)","(diag_smallcorner)","(three_smallcorner)","(four_smallcorner)"}; + + int diagbmask[16]= {0,1,1,2,1,3,2,4, 1,2,3,4,2,4,4,5}; + int diagrotmask[16] = {0,0,1,0,2,0,1,0, 3,3,3,3,2,2,1,0}; + + int diagi, diagj; + int dmask; + + ObjectGroupName templ,diagtempl; + float angle; + + bool skip; + + + for (int j=0; j< hdimy;j++) + { + for (int i=0; i<hdimx; i++) + { + skip = false; + if (*(mdata->m_base_map->ind(i,j)) != -1) + { + //std::cout << " "; + continue; + } + + mask =0; + dmask =0; + + // Bitmasken aufbauen + for (int k=0; k<4; k++) + { + nbi = i + nb[k][0]; + nbj = j + nb[k][1]; + + mask *=2; + dmask *= 2; + + if ( nbi>=0 && nbj>=0 && nbi<hdimx && nbj<hdimy) + { + if (*(mdata->m_base_map->ind(nbi,nbj)) >= 1) + { + mask +=1; + } + + // Wenn eines der Nachbarfelder im *leeren Raum* liegt + // dann keine Objekte setzen + if (*(mdata->m_base_map->ind(nbi,nbj)) == 0) + { + skip = true; + } + } + + + + // Bitmaske fuer Diagonalen + diagi = i + diag[k][0]; + diagj = j + diag[k][1]; + + if ( diagi>=0 && diagj>=0 && diagi<hdimx && diagj<hdimy) + { + if (*(mdata->m_base_map->ind(diagi,diagj)) >= 1 && + *(mdata->m_base_map->ind(diagi,j)) == -1 && + *(mdata->m_base_map->ind(i,diagj)) == -1) + { + dmask +=1; + } + } + + } + + //std::cout << bmask[dmask] <<" "; + if (skip) + continue; + + // Template und dessen Winkel bestimmen + templ = borders[bmask[mask]]; + angle = rotmask[mask] *PI/2; + + diagtempl = smallcorners[diagbmask[dmask]]; + float diagangle = diagrotmask[dmask] *PI/2; + + // gemeinsames Template aus Innenecken und Rand herstellen + if (templ == "$border(filled)" && diagtempl !="") + { + templ ="$border"; + templ += diagtempl; + angle = diagangle; + } + else if (templ == "$border(side)" && diagtempl == "(one_smallcorner)") + { + if (angle == diagangle) + { + templ = "$border(side)(right_smallcorner)"; + } + else + { + templ = "$border(side)(left_smallcorner)"; + } + } + else + { + templ += diagtempl; + } + + DEBUGX("placing type (%i %i) %s",i,j,templ.c_str()); + + mdata->m_region->createObjectGroup(templ,Vector(i*8+4,j*8+4),angle); + } + //std::cout << "\n"; + } + + + +} + +void MapGenerator::insertSpawnpoints(MapData* mdata, RegionData* rdata) +{ + // Punkte an denen Spawnpoints möglich sind + std::vector< std::pair<int,int> > points; + + int hdimx = rdata->m_dimx/2; + int hdimy = rdata->m_dimy/2; + + // moegliche Orte fuer Spawnpoints ermitteln + for (int i=0; i<hdimx; i++) + { + for (int j=0; j< hdimy;j++) + { + // nur erreichbare Felder + if (*(mdata->m_base_map->ind(i,j)) !=1) + { + continue; + } + + points.push_back(std::make_pair(i,j)); + } + } + + + // Spawnpoints platzieren + std::list<RegionData::SpawnGroup>::iterator st; + WorldObject* wo; + bool stop = false; + for (st = rdata->m_monsters.begin(); st != rdata->m_monsters.end() &&!stop; ++st) + { + // aufhoeren, wenn keine Orte mehr vorhanden + + DEBUGX("%s x %i",st->m_monsters.c_str(),st->m_number); + for (int i=0; i< st->m_number; i++) + { + int r = Random::randi(points.size()); + wo = new Spawnpoint(st->m_monsters); + + mdata->m_region->insertObject(wo,Vector(points[r].first*8+4, points[r].second*8+4)); + + DEBUGX("placing spawnpoint for %s at %i %i",st->m_monsters.c_str(), points[r].first*8+4, points[r].second*8+4); + + points[r] = points.back(); + points.resize(points.size() -1); + if (points.empty()) + { + stop = true; + break; + } + } + } +} + + +void MapGenerator::createExits(MapData* mdata, RegionData* rdata) +{ + int dimx = rdata->m_dimx/2; + int dimy = rdata->m_dimy/2; + + std::list<RegionExit>::iterator it; + Vector pos; + for (it = rdata->m_exits.begin(); it != rdata->m_exits.end(); ++it) + { + mdata->m_region->addExit(*it); + + // Bei den Ausgaengen keine Monster + if (rdata->m_region_template =="") + { + pos = mdata->m_region->getLocation(it->m_exit_name); + int cx = int(pos.m_x/8); + int cy = int(pos.m_y/8); + for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++) + { + for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++) + { + if (*(mdata->m_base_map->ind(i,j))==1) + { + *(mdata->m_base_map->ind(i,j)) = 2; + } + } + } + } + + } + + if (rdata->m_has_waypoint) + { + Vector pos = mdata->m_region->getLocation("WaypointLoc"); + WorldObject* wo = new Waypoint(); + mdata->m_region->insertObject(wo,pos); + mdata->m_region->getWaypointLocation() = pos; + + //mdata->m_region->insertObject(wo,pos); + DEBUGX("waypoint at %f %f %i",pos.m_x, pos.m_y,wo->getId()); + + // Bei den Ausgaengen keine Monster + if (rdata->m_region_template =="") + { + int cx = int(pos.m_x/8); + int cy = int(pos.m_y/8); + for (int i=MathHelper::Max(0,cx-2); i<MathHelper::Min(dimx,cx+2); i++) + { + for (int j=MathHelper::Max(0,cy-2); j<MathHelper::Min(dimy,cy+2); j++) + { + if (*(mdata->m_base_map->ind(i,j))==1) + { + *(mdata->m_base_map->ind(i,j)) = 2; + } + } + } + } + } +} + +void MapGenerator::insertBlockedArea(MapData* mdata, Shape s) +{ + // Groesse des Templates in 4x4 Feldern + Vector ext = s.getAxisExtent(); + Vector emin = s.m_center - ext; + Vector emax = s.m_center + ext; + int imin = int(emin.m_x / 8); + int jmin = int(emin.m_y / 8); + int imax = int( ceil(emax.m_x / 8)); + int jmax = int( ceil(emax.m_y / 8)); + + for (int i=imin; i< imax; i++) + { + for (int j=jmin; j<jmax; j++) + { + if (*(mdata->m_base_map->ind(i,j))==1) + { + *(mdata->m_base_map->ind(i,j)) = 2; + } + } + } +} + + +void MapGenerator::createPerlinNoise(Matrix2d<float> *data, int dimx, int dimy,int startfreq, float persistance, bool bounds) +{ + Matrix2d<float>* tmp= new Matrix2d<float>(dimx+1, dimy+1); + tmp->clear(); + float* weight = new float[MathHelper::Min(dimx,dimy)]; + float ampl =1; + int dx,dy; + float invdist; + + if (startfreq > dimx || startfreq > dimy) + { + startfreq = MathHelper::Min(dimx,dimy); + } + + DEBUGX("Perlin noise dimx %i dimy %i",dimx,dimy); + + // Perlin Noise Algorithmus + // Aenderung hier: Schleife geht ueber den Abstand zwischen den Stuetzstellen + for (int dist = startfreq; dist>0 ;dist/=2) + { + // Dimension des Zufallszahlenfeldes fuer diesen Abstand + dx = 2+(dimx-2)/dist; + dy = 2+(dimy-2)/dist; + + DEBUGX("distance %i tmp array %i %i",dist,dx,dy); + + // anlegen der Zufallszahlen fuer die aktuelle Frequenz + for (int i=0;i<=dx;i++) + { + for (int j=0;j<=dy;j++) + { + *(tmp->ind(i,j)) = Random::random()* ampl; + + } + + } + + // Interpolation (nur fuer Abstand >1) + if (dist>1) + { + invdist = 1.0f/dist; + + for (int k=0;k<dist;k++) + { + weight[k] = k*invdist; + } + + + + for (int i=0;i<dx;i++) + { + for (int j=0;j<dy;j++) + { + for (int k=0;k<dist;k++) + { + for (int l=0;l<dist;l++) + { + if (i*dist+k< dimx && j*dist+l< dimy) + { + *(data->ind(i*dist+k,j*dist+l)) += (*(tmp->ind(i,j))*(1-weight[k])*(1-weight[l]) + + *(tmp->ind(i+1,j))*weight[k]*(1-weight[l]) + + *(tmp->ind(i+1,j+1))*weight[k]*weight[l] + + *(tmp->ind(i,j+1))*(1-weight[k])*weight[l]) ; + } + } + } + } + } + } + else + { + for (int i=0;i<dimx;i++) + { + for (int j=0;j<dimy;j++) + { + *(data->ind(i,j)) +=*(tmp->ind(i,j)); + } + } + } + + ampl *= persistance; + /* + if (bounds) + { + + std::cout.width(6); + std::cout << "\n"; + for (int j=0;j<dy;j++) + { + for (int i=0;i<dx;i++) + { + + std::cout << *(tmp->ind(i,j))<<" "; + } + std::cout << "\n"; + } + } + if (bounds) + { + + std::cout.width(6); + std::cout << "\n"; + for (int j=0;j<dimy;j++) + { + for (int i=0;i<dimx;i++) + { + std::cout << *(data->ind(i,j))<<" "; + } + std::cout << "\n"; + } + } + */ + } + + // Maximum und Minimum suchen + float fmax =0,fmin = 1000000; + for (int i=0;i<dimx;i++) + { + for (int j=0;j<dimy;j++) + { + if (*(data->ind(i,j)) > fmax) + { + fmax = *(data->ind(i,j)); + } + if (*(data->ind(i,j)) < fmin) + { + fmin = *(data->ind(i,j)); + } + + + } + } + + // normieren auf [0..1] + for (int i=0;i<dimx;i++) + { + for (int j=0;j<dimy;j++) + { + *(data->ind(i,j)) -= fmin; + if (fmax-fmin !=0) + { + *(data->ind(i,j)) /= (fmax-fmin); + } + } + } + + + // Raender anlegen + if (bounds) + { + float bnd = MathHelper::Min(5.0f, MathHelper::Min(dimx/3.0f,dimy/3.0f)); + float dist; + for (int i=0;i<dimx;i++) + { + for (int j=0;j<dimy;j++) + { + dist = MathHelper::Min(MathHelper::Min(i,dimx-i-1),MathHelper::Min(j,dimy-j-1)); + if (dist<bnd) + { + *(data->ind(i,j)) = *(data->ind(i,j))*(dist)/bnd + (bnd-dist)/bnd; + } + } + } + } + + /* + //Debugging + + std::cout << "\n"; + for (int j=0;j<dimy;j++) + { + for (int i=0;i<dimx;i++) + { + std::cout << *(data->ind(i,j))<<" "; + } + std::cout << "\n"; + } + */ + delete[] weight; + delete tmp; +} + + +
--- a/src/core/monster.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/monster.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -145,7 +145,7 @@ bool tmp=Monster::init(); if(!tmp) { - DEBUG("Initialisierung des Monsters fehlgeschlagen!"); + SW_DEBUG("Initialisierung des Monsters fehlgeschlagen!"); } } @@ -611,7 +611,7 @@ Action::ActionInfo* aci = Action::getActionInfo(act); if (aci == 0) { - DEBUG("unknown action %s",act.c_str()); + SW_DEBUG("unknown action %s",act.c_str()); return; } @@ -953,7 +953,7 @@ if (valname.find("ai_ability_rating:") == 0) { std::string ablt = valname.substr(18); // ai_ability_rating: abschneiden - DEBUG("ability %s",ablt.c_str()); + SW_DEBUG("ability %s",ablt.c_str()); std::map<std::string, AbilityInfo>::iterator at; at = getBaseAttrMod()->m_abilities.find(ablt); @@ -983,7 +983,7 @@ if (valname.find("ai_ability_rating:") == 0) { std::string ablt = valname.substr(18); // ai_ability_rating: abschneiden - DEBUG("ability %s",ablt.c_str()); + SW_DEBUG("ability %s",ablt.c_str()); std::map<std::string, AbilityInfo>::iterator at; at = getBaseAttrMod()->m_abilities.find(ablt);
--- a/src/core/nlfgclientnetwork.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/nlfgclientnetwork.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -43,7 +43,7 @@ unsigned success = nlfg_connect(hostname, req_port); if (!success) { - DEBUG("error connecting to server"); + SW_DEBUG("error connecting to server"); m_status = NET_ERROR; } else @@ -54,7 +54,7 @@ void NLFGClientNetwork::serverDisconnect() { - DEBUG("closing connection"); + SW_DEBUG("closing connection"); nlfg_disconnect(); // wait to deliver disconnect message #ifdef WIN32 @@ -89,11 +89,11 @@ switch (id) { case NLFG_CONNECTED: - DEBUG("connected to server"); + SW_DEBUG("connected to server"); m_status = NET_CONNECTED; break; case NLFG_DISCONNECTED: - DEBUG("connection timed out"); + SW_DEBUG("connection timed out"); m_status =NET_TIMEOUT; break; }
--- a/src/core/nlfgservernetwork.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/nlfgservernetwork.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -75,17 +75,17 @@ case NLFG_CONNECTED: slot = insertNewSlot(packet->addr); pushNewLoginSlot(slot); - DEBUG("connection accepted for slot %i", slot); + SW_DEBUG("connection accepted for slot %i", slot); break; case NLFG_DISCONNECTED: - DEBUG("slot %i disconnected",slot); + SW_DEBUG("slot %i disconnected",slot); delete m_slots[slot]; m_slots[slot]=0; break; default: - DEBUG("unknown id: %i",id); + SW_DEBUG("unknown id: %i",id); break; }
--- a/src/core/options.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/options.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -149,7 +149,7 @@ bool loadOkay = doc.LoadFile(); ElementAttrib attr; - DEBUG ("Reading user modifiable options from file [%s]", filename.c_str ()); + SW_DEBUG ("Reading user modifiable options from file [%s]", filename.c_str ()); if (loadOkay) { TiXmlNode* child; @@ -289,14 +289,14 @@ } // if root == <Options> else { - DEBUG ("The file [%s] does not look like an options file. Reverting to default options.", filename.c_str ()); + SW_DEBUG ("The file [%s] does not look like an options file. Reverting to default options.", filename.c_str ()); setToDefaultOptions(); return false; } } // if (loadOkay) else { - DEBUG ("Could not read data from file [%s]. Reverting to default options.", filename.c_str ()); + SW_DEBUG ("Could not read data from file [%s]. Reverting to default options.", filename.c_str ()); setToDefaultOptions(); return false; } @@ -427,7 +427,7 @@ void Options::setSoundVolume(float vol) { - DEBUG ("Setting sound volume to: %.2f", vol); + SW_DEBUG ("Setting sound volume to: %.2f", vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Effect, vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0); //SoundSystem::setSoundVolume(vol); @@ -441,7 +441,7 @@ void Options::setMusicVolume (float vol) { - DEBUG ("Setting music volume to: %.2f", vol); + SW_DEBUG ("Setting music volume to: %.2f", vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Music, vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0); //MusicManager::instance().setMusicVolume(vol);
--- a/src/core/pathfind.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/pathfind.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -443,7 +443,7 @@ if (block[i][j]=='X') { - DEBUG("blockiertes Feld betreten"); + SW_DEBUG("blockiertes Feld betreten"); qmax = 1000000; for (k=0;k<4;++k) {
--- a/src/core/player.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/player.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -88,7 +88,7 @@ bool tmp=Player::init(); if (!tmp) { - DEBUG("Initialiserung des Players fehlgeschlagen!"); + SW_DEBUG("Initialiserung des Players fehlgeschlagen!"); } } @@ -231,7 +231,7 @@ void Player::revive() { - DEBUG("reviving"); + SW_DEBUG("reviving"); getRegion()->changeObjectGroup(this,PLAYER); getDynAttr()->m_health = getBaseAttrMod()->m_max_health; @@ -379,7 +379,7 @@ } else { - DEBUG("goal is too far away"); + SW_DEBUG("goal is too far away"); } } } @@ -500,7 +500,7 @@ { if (ainfo != 0) { - DEBUG("Basisaktion von %s verwendet",com->m_type.c_str()); + SW_DEBUG("Basisaktion von %s verwendet",com->m_type.c_str()); com->m_type = ainfo->m_base_action; } } @@ -731,7 +731,7 @@ m_timers_max[it->m_consume_timer_nr-1] = it->m_consume_timer; addToNetEventMask(NetEvent::DATA_TIMER); } - DEBUG("started timer %i for %f",it->m_consume_timer_nr, it->m_consume_timer); + SW_DEBUG("started timer %i for %f",it->m_consume_timer_nr, it->m_consume_timer); } else { @@ -1522,7 +1522,7 @@ default: - DEBUG("unknown command: %i",command->m_button); + SW_DEBUG("unknown command: %i",command->m_button); } if (oldcommand != *getNextCommand() && delay>0) @@ -1656,7 +1656,7 @@ } else { - DEBUG("no item found at %f %f",goal.m_x,goal.m_y); + SW_DEBUG("no item found at %f %f",goal.m_x,goal.m_y); } } else @@ -1971,7 +1971,7 @@ m_emotion_set = m_look.m_emotion_set; int cnt; cv->fromBuffer(cnt); - DEBUG("number of items: %i",cnt); + SW_DEBUG("number of itSW_DEBUG%i",cnt); for ( short i = 0; i< cnt; i++) { readItem(cv);
--- a/src/core/projectile.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/projectile.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -391,7 +391,7 @@ // zufaelliges weiterspringen, Chance 50% if (rand()<RAND_MAX*0.5) { - DEBUG("prob bounce"); + SW_DEBUG("prob bounce"); bounce = true; } }
--- a/src/core/region.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/region.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -344,7 +344,7 @@ m_light(this) { - DEBUG ("creating region [%s]", m_name.c_str ()); + SW_DEBUG ("creating region [%s]", m_name.c_str ()); m_data_grid.clear(); m_height.clear(); @@ -399,7 +399,7 @@ } catch (std::exception& e) { - DEBUG ("Region creation caught exception: %s", e.what ()); + SW_DEBUG ("Region creation caught exception: %s", e.what ()); } } } @@ -997,7 +997,7 @@ // Wenn das Element bereits existiert ist die Antwort false if (result==false) { - DEBUG("Object with id %i already exists",object->getId()); + SW_DEBUG("Object with id %i already exists",object->getId()); return result; } @@ -1118,7 +1118,7 @@ if (subtype == "") { - DEBUG("no subtype found for generictype %s",generictype.c_str()); + SW_DEBUG("no subtype found for generictype %s",generictype.c_str()); return 0; } @@ -1126,7 +1126,7 @@ WorldObject::Type type = ObjectFactory::getObjectBaseType(subtype); if (type == "NONE") { - DEBUG("no base type for subtype %s",subtype.c_str()); + SW_DEBUG("no base type for subtype %s",subtype.c_str()); return 0; } @@ -1135,7 +1135,7 @@ if (object ==0) { - DEBUG("could not create object for generictype %s",generictype.c_str()); + SW_DEBUG("could not create object for generictype %s",generictype.c_str()); return 0; } @@ -1162,7 +1162,7 @@ bool ret = insertObject(object,pos,angle); if (!ret) { - DEBUG("insertion of object %s failed",object->getNameId().c_str()); + SW_DEBUG("insertion of object %s failed",object->getNameId().c_str()); } return object->getId(); @@ -1317,7 +1317,7 @@ if (mgroup == 0) { - DEBUG("monster group %s not found",mgname.c_str()); + SW_DEBUG("monster group %s not found",mgname.c_str()); return; } @@ -1467,7 +1467,7 @@ } else { - DEBUG("no object with id %i",id); + SW_DEBUG("no object with id %i",id); } return false; } @@ -2167,7 +2167,7 @@ WorldObject* oldobj = getObject(obj->getId()); if (oldobj != 0) { - DEBUG("Object %i already exists",oldobj->getId()); + SW_DEBUG("Object %i already exists",oldobj->getId()); oldobj->destroy(); deleteObject(oldobj); delete oldobj; @@ -2197,7 +2197,7 @@ Projectile* oldproj = getProjectile(proj->getId()); if (oldproj != 0) { - DEBUG("Projectile %i already exists",oldproj->getId()); + SW_DEBUG("Projectile %i already exists",oldproj->getId()); deleteProjectile(oldproj); delete oldproj; } @@ -2236,7 +2236,7 @@ if (m_dialogues.count(id) >0) { - DEBUG("Dialogue %i already exists",id); + SW_DEBUG("Dialogue %i already exists",id); deleteDialogue(m_dialogues[id]); } @@ -3141,7 +3141,7 @@ void Region::addMusicTrack(MusicTrack track) { - DEBUG ("Region: adding music track: %s", track.c_str ()); + SW_DEBUG ("Region: adding music track: %s", track.c_str ()); // MusicTrack copiedName = track; copiedName = SoundHelper::getNameWithPathForMusicTrack (copiedName);
--- a/src/core/scriptobject.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/scriptobject.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -70,7 +70,7 @@ { Vector speed = EventSystem::getVector(EventSystem::getLuaState(),-1); lua_pop(EventSystem::getLuaState(), 1); - DEBUG("speed %f %f",speed.m_x,speed.m_y); + SW_DEBUG("speed %f %f",speed.m_x,speed.m_y); setSpeed(speed); return 1; }
--- a/src/core/servernetwork.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/servernetwork.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -46,7 +46,7 @@ ServerNetwork::ServerNetwork(int max_slots) : Network() { - DEBUG("Max slots %d", max_slots); + SW_DEBUG("Max slots %d", max_slots); m_slots.resize(max_slots); m_max_slots = max_slots; m_active = false;
--- a/src/core/sumwarshelper.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/sumwarshelper.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -470,13 +470,13 @@ // return the first entry in the map? if (! guiAspectRatios_.empty ()) { - DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): zero height specied; returning any available ratio!"); + SW_DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): zero height specied; returning any available ratio!"); return guiAspectRatios_.begin ()->first; } else { // this should not occur! - DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiAspectRatios_! (empty map)"); + SW_DEBUG ("WARNING (SumwarsHelper::getNearestAspectRatioStringForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiAspectRatios_! (empty map)"); return returnValue; } } @@ -518,13 +518,13 @@ // return the first entry in the map? if (! guiDefaultFonts_.empty ()) { - DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): zero height specied; returning any available font!"); + SW_DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): zero height specied; returning any available font!"); return guiDefaultFonts_.begin ()->second; } else { // this should not occur! - DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiDefaultFonts_! (empty map)"); + SW_DEBUG ("WARNING (SumwarsHelper::getRecommendedDefaultFontForWindowSize): getNearestAspectRatioStringForWindowSize has no access to guiDefaultFonts_! (empty map)"); return returnValue; } } @@ -557,7 +557,7 @@ */ void SumwarsHelper::addResourceLocationList (const std::vector<std::string> &locList, const std::string &groupToAddTo) { - DEBUG ("SumwarsHelper: Adding resource locations (%d items)...", locList.size ()); + SW_DEBUG ("SumwarsHelper: Adding resource locations (%d items)...", locList.size ()); for (std::vector<std::string>::const_iterator it = locList.begin(); it!= locList.end(); ++it ) { addResourceLocation (*it, groupToAddTo); @@ -612,7 +612,7 @@ } else { - DEBUG ("SumwarsHelper: There is a variable in use that is not YET defined: %s", variableName.c_str ()); + SW_DEBUG ("SumwarsHelper: There is a variable in use that is not YET defined: %s", variableName.c_str ()); } } } @@ -627,12 +627,12 @@ if (bCanAddThis) { - DEBUG ("SumwarsHelper: Adding location to resource list: [%s], group:[%s]", location.c_str (), secName.c_str ()); + SW_DEBUG ("SumwarsHelper: Adding location to resource list: [%s], group:[%s]", location.c_str (), secName.c_str ()); Ogre::ResourceGroupManager::getSingleton ().addResourceLocation (location, typeName, secName, true); } else { - DEBUG ("SumwarsHelper: Adding location to incomplete resource group list: [%s], group:[%s]. Try calling [retryToAddIncompleteResourceDirs] later on.", location.c_str (), secName.c_str ()); + SW_DEBUG ("SumwarsHelper: Adding location to incomplete resource group list: [%s], group:[%s]. Try calling [retryToAddIncompleteResourceDirs] later on.", location.c_str (), secName.c_str ()); incompleteResourceGroupDirs_ [secName] = location; } } @@ -646,7 +646,7 @@ */ void SumwarsHelper::setPrefferedAspectRatioString (const std::string& aspectRatio) { - DEBUG ("SumwarsHelper: setting preffered aspect ratio string to: %s", aspectRatio.c_str ()); + SW_DEBUG ("SumwarsHelper: setting preffered aspect ratio string to: %s", aspectRatio.c_str ()); getEditableApplicationVariablesMapping ()["ASPECT_RATIO"] = aspectRatio; }
--- a/src/core/treasure.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/treasure.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -74,7 +74,7 @@ { addToNetEventMask(NetEvent::DATA_FLAGS); - DEBUG("treasure opened"); + SW_DEBUG("treasure opened"); m_open = true; m_open_timer = 0;
--- a/src/core/world.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/world.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -186,7 +186,7 @@ if (m_data_reload_requests & DATA_LUACODE) { - DEBUG("Loading lua files."); + SW_DEBUG("Loading lua files."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("lua","*.lua"); for (it = files->begin(); it != files->end(); ++it) { @@ -200,7 +200,7 @@ // Aktionen initialisieren if (m_data_reload_requests & DATA_ABILITIES) { - DEBUG("Loading ability data."); + SW_DEBUG("Loading ability data."); Action::init(); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("abilities","*.xml"); @@ -217,7 +217,7 @@ if (m_data_reload_requests & DATA_MONSTERS) { - DEBUG("Loading monster data."); + SW_DEBUG("Loading monster data."); // Monster Data ObjectFactory::init(); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("monsters","*.xml"); @@ -237,7 +237,7 @@ if (m_data_reload_requests & DATA_PROJECTILES) { - DEBUG("Loading missile data."); + SW_DEBUG("Loading missile data."); // Projectile Data files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("projectiles","*.xml"); for (it = files->begin(); it != files->end(); ++it) @@ -252,7 +252,7 @@ if (m_data_reload_requests & DATA_OBJECTS) { - DEBUG("Loading fixed object data."); + SW_DEBUG("Loading fixed object data."); // fixed object Data files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("objects","*.xml"); for (it = files->begin(); it != files->end(); ++it) @@ -275,7 +275,7 @@ if (m_data_reload_requests & DATA_EVENTS) { - DEBUG("Loading region data."); + SW_DEBUG("Loading region data."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("world","*.xml"); for (it = files->begin(); it != files->end(); ++it) { @@ -288,7 +288,7 @@ if (m_data_reload_requests & DATA_EVENTS) { - DEBUG("Loading npc data."); + SW_DEBUG("Loading npc data."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("npc","*.xml"); for (it = files->begin(); it != files->end(); ++it) @@ -299,7 +299,7 @@ worldloader.loadNPCData(file.c_str()); } - DEBUG("Loading quest data."); + SW_DEBUG("Loading quest data."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("quests","*.xml"); for (it = files->begin(); it != files->end(); ++it) @@ -497,7 +497,7 @@ header.fromString(data); if (header.m_content == PTYPE_C2S_SAVEGAME) { - DEBUG("got savegame from slot %i",(*i)); + SW_DEBUG("got savegame from slot %i",(*i)); if (m_player_slots->size() < (unsigned)m_max_nr_players) { @@ -507,7 +507,7 @@ { // reject the player, if the server is full // send a reject notification - DEBUG("Rejected Savegame from Slot %i", (*i)); + SW_DEBUG("Rejected Savegame from Slot %i", (*i)); PackageHeader header; header.m_content = PTYPE_S2C_REJECT; header.m_number =1; @@ -523,7 +523,7 @@ } else { - DEBUG("unknown type %i",header.m_content); + SW_DEBUG("unknown type %i",header.m_content); } m_network->deallocatePacket(data); } @@ -777,7 +777,7 @@ ERRORMSG("cant open new party"); } p->clear(); - DEBUG("opened Party %i",p->getId()); + SW_DEBUG("opened Party %i",p->getId()); } p->addMember(player->getId()); } @@ -870,7 +870,7 @@ } // Auf Datenanfrage seitens des Client warten player->setState(WorldObject::STATE_REGION_DATA_WAITING,false); - DEBUG("waiting for a client data request"); + SW_DEBUG("waiting for a client data request"); } @@ -916,7 +916,7 @@ { if (!reg->hasLocation(m_region_enter_loc[player->getId()])) { - DEBUG("location %s does not exist",m_region_enter_loc[player->getId()].c_str()); + SW_DEBUG("location %s does not exist",m_region_enter_loc[player->getId()].c_str()); m_region_enter_loc[player->getId()] = m_player_start_location.second; static_cast<Player*>(player)->setRevivePosition(m_player_start_location); @@ -1551,7 +1551,7 @@ } - DEBUG("player %i has quit",pl->getId()); + SW_DEBUG("player %i has quit",pl->getId()); delete pl; continue; @@ -1560,7 +1560,7 @@ // Spielern die auf Daten zur aktuellen Region warten, Daten senden if (pl->getState() == WorldObject::STATE_REGION_DATA_REQUEST) { - DEBUG("send data request to server"); + SW_DEBUG("send data request to server"); // Client wartet auf Daten zur Region pl->setState(WorldObject::STATE_REGION_DATA_WAITING,false); @@ -1611,7 +1611,7 @@ if (cv->getDelay()>1000) { - DEBUG("got packet with delay %f",cv->getDelay()); + SW_DEBUG("got packet with delay %f",cv->getDelay()); } headerp.fromString(cv); @@ -1712,7 +1712,7 @@ cv->fromBuffer(id); WorldObject* player; - DEBUG("got data for player %s id %i",subt.c_str(),id); + SW_DEBUG("got data for player %s id %i",subt.c_str(),id); // Spieler entweder neu anlegen oder aus den existierenden herraussuchen if (m_players->count(id)==0) @@ -1734,7 +1734,7 @@ else if (headerp.m_content == PTYPE_S2C_REGION) { // Daten zu einer Region erhalten - DEBUG("got data for region %i",headerp.m_number); + SW_DEBUG("got data for region %i",headerp.m_number); short dimx, dimy; // Groesse der Region @@ -1767,20 +1767,20 @@ { int id; cv->fromBuffer(id); - DEBUG("ID at server %i (old ID %i)",id, m_local_player->getId()); + SW_DEBUG("ID at server %i (old ID %i)",id, m_local_player->getId()); m_players->erase(m_local_player->getId()); m_local_player->setId(id); int frac; cv->fromBuffer(frac); m_local_player->setFraction((Fraction::Id) frac); - DEBUG("fraction %i",frac); + SW_DEBUG("fraction %i",frac); insertPlayer(m_local_player, LOCAL_SLOT); } else if (headerp.m_content == PTYPE_S2C_REJECT) { - DEBUG("Got notification that the server rejected the Savegame"); + SW_DEBUG("Got notification that the server rejected the Savegame"); if (m_network != 0) { m_network->setSlotStatus(NET_SLOTS_FULL); @@ -1910,7 +1910,7 @@ } else { - DEBUG("got package with unknown type %i", headerp.m_content); + SW_DEBUG("got package with unknown type %i", headerp.m_content); } m_network->deallocatePacket(cv); @@ -2260,7 +2260,7 @@ if (event->m_type == NetEvent::PARTY_RELATION_CHANGED) { - DEBUG("party %i changed relation to %i to %i",event->m_data, event->m_id, getParty(event->m_data)->getRelations()[event->m_id]); + SW_DEBUG("party %i changed relation to %i to %i",event->m_data, event->m_id, getParty(event->m_data)->getRelations()[event->m_id]); cv->toBuffer(static_cast<char>(getParty(event->m_data)->getRelations()[event->m_id])); } @@ -2398,7 +2398,7 @@ } else { - DEBUG("projectile %i for event does not exist",event.m_id); + SW_DEBUG("projectile %i for event does not exist",event.m_id); return false; } } @@ -2643,7 +2643,7 @@ char tmp; cv->fromBuffer(tmp); setRelation(event.m_id, event.m_data, (Fraction::Relation) tmp); - DEBUG("set relation %i %i to %i",event.m_id, event.m_data, (int) tmp); + SW_DEBUG("set relation %i %i to %i",event.m_id, event.m_data, (int) tmp); break; @@ -2810,7 +2810,7 @@ } else if (request->m_data == ClientDataRequest::OBJECT) { - DEBUG("Daten zu Objekt %i gefordert",request->m_id); + SW_DEBUG("Daten zu Objekt %i gefordert",request->m_id); if (region!=0) { // Daten werden per Event aktualisiert
--- a/src/core/worldloader.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/worldloader.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -67,7 +67,7 @@ bool WorldLoader::loadRegionData(const char* pFilename) { - DEBUG ("Loading region data from file: [%s]", pFilename); + SW_DEBUG ("Loading region data from file: [%s]", pFilename); TiXmlDocument doc(pFilename); bool loadOkay = doc.LoadFile(); @@ -169,7 +169,7 @@ if (music != "") { rdata->m_music_tracks.push_back(music); - DEBUG ("Loading region [%s]. Adding music track to region data: %s", rdata->m_name.c_str (), music.c_str ()); + SW_DEBUG ("Loading region [%s]. Adding music track to region data: %s", rdata->m_name.c_str (), music.c_str ()); } } else if (child2->Type()!=TiXmlNode::TINYXML_COMMENT)
--- a/src/core/worldobject.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/core/worldobject.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -227,14 +227,14 @@ { if (getType() == "PLAYER") { - DEBUG("You cant change the fraction of a player"); + SW_DEBUG("You cant change the fraction of a player"); return false; } std::string fraction = lua_tostring(EventSystem::getLuaState() ,-1); lua_pop(EventSystem::getLuaState(), 1); Fraction::Id id = World::getWorld()->getFractionId(fraction); setFraction(id); - DEBUG("fraction is now %i",getFraction()); + SW_DEBUG("fraction is now %i",getFraction()); return true; } else if (valname == "position")
--- a/src/gui/application.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/application.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -157,7 +157,7 @@ LogManager::instance ().addLog ("stdout", new StdOutLog(Log::LOGLEVEL_DEBUG)); LogManager::instance ().addLog ("logfile", new FileLog (operationalPath + "/sumwars.log", Log::LOGLEVEL_DEBUG)); - DEBUG ("Initialized logging. Level: %d", Log::LOGLEVEL_DEBUG); + SW_DEBUG ("Initialized logging. Level: %d", Log::LOGLEVEL_DEBUG); Timer tm; m_timer.start(); @@ -199,7 +199,7 @@ ERRORMSG("Sound initialisation failed"); } - DEBUG ("Reading options file (options.xml)..."); + SW_DEBUG ("Reading options file (options.xml)..."); // Augustin Preda, 2011.11.15: trial code: load the options.xml file; it's required // TODO: don't load it again later. Currently it's done via m_document->loadSettings(); Options::getInstance()->readFromFile(operationalPath + "/options.xml"); @@ -267,7 +267,7 @@ return false; } - DEBUG("time to start %f",tm.getTime()); + SW_DEBUG("time to start %f",tm.getTime()); // Ressourcen laden ret = loadResources(); if (ret == false) @@ -275,7 +275,7 @@ ERRORMSG("could not load ressources"); } - DEBUG ("Application initialized. Storing data in folder [%s]\n\n", operationalPath.c_str ()); + SW_DEBUG ("Application initialized. Storing data in folder [%s]\n\n", operationalPath.c_str ()); // debugging //MyFrameListener* mfl = new MyFrameListener(m_main_window,m_document); //m_ogre_root->addFrameListener(mfl); @@ -380,14 +380,14 @@ { count =0; - DEBUG("average stats over %i frames",nr); - DEBUG("frame time: %f (%f fps)",time[0]/nr, 1000/(time[0]/nr)); - DEBUG("app update time: %f",time[1]/nr); - DEBUG("message pump time: %f",time[2]/nr); - DEBUG("world update time: %f",time[3]/nr); - DEBUG("scene update time: %f",time[4]/nr); - DEBUG("gui update time: %f",time[5]/nr); - DEBUG("ogre time: %f \n",time[6]/nr); + SW_DEBUG("average stats over %i frames",nr); + SW_DEBUG("frame time: %f (%f fps)",time[0]/nr, 1000/(time[0]/nr)); + SW_DEBUG("app update time: %f",time[1]/nr); + SW_DEBUG("message pump time: %f",time[2]/nr); + SW_DEBUG("world update time: %f",time[3]/nr); + SW_DEBUG("scene update time: %f",time[4]/nr); + SW_DEBUG("gui update time: %f",time[5]/nr); + SW_DEBUG("ogre time: %f \n",time[6]/nr); for (int i=0; i<7; i++) @@ -404,7 +404,7 @@ time[1] += t; if (t > 20) { - DEBUG("update time was %f",t); + SW_DEBUG("update time was %f",t); } float musicUpdateTimer = frametime; @@ -499,7 +499,7 @@ SoundHelper::signalSoundManager (); } - DEBUG ("Application: run function has run its course"); + SW_DEBUG ("Application: run function has run its course"); } @@ -552,13 +552,13 @@ it != myCfgMap.end (); ++ it) { - DEBUG ("option name=[%s], val=[%s]", it->second.name.c_str (), it->second.currentValue.c_str ()); + SW_DEBUG ("option name=[%s], val=[%s]", it->second.name.c_str (), it->second.currentValue.c_str ()); } Ogre::ConfigOptionMap::iterator opt_it = myCfgMap.find ("Video Mode"); if (opt_it != myCfgMap.end ()) { - DEBUG ("Currently selected video mode: %s", opt_it->second.currentValue.c_str ()); + SW_DEBUG ("Currently selected video mode: %s", opt_it->second.currentValue.c_str ()); returnValue = opt_it->second.currentValue; std::string sLeft, sRight; int nPos = returnValue.find (" "); @@ -604,7 +604,7 @@ */ bool Application::initOgre() { - DEBUG("init ogre"); + SW_DEBUG("init ogre"); // Create window. // Here, we have 2 options: @@ -657,8 +657,8 @@ usedResolution = retrieveRenderSystemWindowSize (videoModeWidth, videoModeHeight); Options::getInstance ()->setUsedResolution (usedResolution); - DEBUG ("Stored used resolution into global options [%s]", usedResolution.c_str ()); - DEBUG ("Size should be %d x %d", videoModeWidth, videoModeHeight); + SW_DEBUG ("Stored used resolution into global options [%s]", usedResolution.c_str ()); + SW_DEBUG ("Size should be %d x %d", videoModeWidth, videoModeHeight); // // Platform specific code: @@ -782,7 +782,7 @@ bool Application::configureOgre() { - DEBUG("configure ogre"); + SW_DEBUG("configure ogre"); // Use the default logging level. // Possible options: @@ -806,7 +806,7 @@ bool Application::setupResources() { - DEBUG("initalizing resources"); + SW_DEBUG("initalizing resources"); #ifdef NOMIPMAPS Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0); #endif @@ -868,17 +868,17 @@ bool Application::initGettext() { - DEBUG("initializing internationalisation"); + SW_DEBUG("initializing internationalisation"); Ogre::StringVectorPtr path = Ogre::ResourceGroupManager::getSingleton().findResourceLocation("translation", "*"); - DEBUG("Application initializing Gettext lib with [%s]", path.get ()->at (0).c_str ()); + SW_DEBUG("Application initializing Gettext lib with [%s]", path.get ()->at (0).c_str ()); Gettext::init("", path.get()->at(0)); - DEBUG("Application initializing Gettext locale is [%s]", Gettext::getLocale ()); + SW_DEBUG("Application initializing Gettext locale is [%s]", Gettext::getLocale ()); return true; } bool Application::initCEGUI() { - DEBUG("init CEGUI\n"); + SW_DEBUG("init CEGUI\n"); // Log level new CEGUI::DefaultLogger(); @@ -886,10 +886,10 @@ CEGUI::DefaultLogger::getSingleton().setLogFilename(SumwarsHelper::getStorageBasePath() + "/" + SumwarsHelper::userPath() + "/CEGUI.log"); // Bootstrap the CEGUI System - DEBUG ("Bootstrapping the CEGUI system"); + SW_DEBUG ("Bootstrapping the CEGUI system"); CEGUI::OgreRenderer::bootstrapSystem(); - DEBUG ("Getting the XML parser"); + SW_DEBUG ("Getting the XML parser"); CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser(); if (NULL == parser) @@ -900,20 +900,20 @@ if (parser->isPropertyPresent("SchemaDefaultResourceGroup")) parser->setProperty("SchemaDefaultResourceGroup", "GUI_XML_schemas"); - DEBUG ("Loading (CEGUI) schemes..."); + SW_DEBUG ("Loading (CEGUI) schemes..."); // Load schemes - DEBUG ("Loading scheme: SWB.scheme"); + SW_DEBUG ("Loading scheme: SWB.scheme"); CEGUIUtility::loadScheme ((CEGUI::utf8*)"SWB.scheme", (CEGUI::utf8*)"GUI"); - DEBUG ("Loading scheme: TaharezLook.scheme"); + SW_DEBUG ("Loading scheme: TaharezLook.scheme"); CEGUIUtility::loadScheme ((CEGUI::utf8*)"TaharezLook.scheme", (CEGUI::utf8*)"GUI"); - DEBUG ("Loading scheme: SumWarsExtras.scheme"); + SW_DEBUG ("Loading scheme: SumWarsExtras.scheme"); CEGUIUtility::loadScheme ((CEGUI::utf8*)"SumWarsExtras.scheme", (CEGUI::utf8*)"GUI"); // Load imagesets CEGUIUtility::loadImageset("skills.imageset"); - DEBUG ("Creating hardcoded images from file"); + SW_DEBUG ("Creating hardcoded images from file"); try { @@ -922,14 +922,14 @@ } catch (CEGUI::Exception& e) { - DEBUG("CEGUI exception %s",e.getMessage().c_str()); + SW_DEBUG("CEGUI exception %s",e.getMessage().c_str()); } m_cegui_system = CEGUI::System::getSingletonPtr(); /*CEGUI::LuaScriptModule &scriptm(CEGUI::LuaScriptModule::create()); m_cegui_system->setScriptingModule(&scriptm);*/ - DEBUG ("Setting cursor defaults"); + SW_DEBUG ("Setting cursor defaults"); // Set the mouse cursor. CEGUIUtility::setDefaultMouseCursor (m_cegui_system, Options::getInstance ()->getCeguiCursorSkin (), "MouseArrow"); @@ -940,7 +940,7 @@ CEGUI::Tooltip* defaultTT = CEGUI::System::getSingletonPtr ()->getDefaultGUIContext ().getDefaultTooltipObject (); if (0 != defaultTT) { - DEBUG ("Default tooltip is: %s", defaultTT->getNamePath ().c_str ()); + SW_DEBUG ("Default tooltip is: %s", defaultTT->getNamePath ().c_str ()); defaultTT->setHoverTime (0.5f); // set it to 0.5 seconds. } @@ -962,16 +962,16 @@ // Note: you could also add custom fonts here, by calling CEGUIUtility::addFont. // But all fonts can now be specified in the skin's scheme file. This means, we don't need to specify any fonts here. - DEBUG ("Creating fonts"); + SW_DEBUG ("Creating fonts"); // Set the default font to use based on the current display resolution. int configuredWidth, configuredHeight; SumwarsHelper::getSizesFromResolutionString (Options::getInstance ()->getUsedResolution (), configuredWidth, configuredHeight); std::string defaultFontName = SumwarsHelper::getSingletonPtr ()->getRecommendedDefaultFontForWindowSize (configuredWidth, configuredHeight); - DEBUG ("For the current display resolution (%d x %d), the system has decreed that the recommended font is: %s", configuredWidth, configuredHeight, defaultFontName.c_str ()); + SW_DEBUG ("For the current display resolution (%d x %d), the system has decreed that the recommended font is: %s", configuredWidth, configuredHeight, defaultFontName.c_str ()); CEGUIUtility::setDefaultFont ((CEGUI::utf8*)defaultFontName.c_str ()); - DEBUG ("Creating own factory for tooltips"); + SW_DEBUG ("Creating own factory for tooltips"); // Insert own factories. // TODO: check if this is really needed. Couldn't the custom tooltip just be added to the scheme? std::stringstream ss; ss << Options::getInstance ()->getCeguiSkin () << "/CustomTooltip"; @@ -998,7 +998,7 @@ //TODO: rename function. It doesn't have to point to openAL as a sound lib. bool Application::initOpenAL() { - DEBUG ("initOpenAL"); + SW_DEBUG ("initOpenAL"); //SoundSystem::init(); //bool err = SoundSystem::checkErrors(); //return !err; @@ -1025,7 +1025,7 @@ } catch (std::exception &e) { - DEBUG ("Application::initOpenAL caught exception: %s", e.what ()); + SW_DEBUG ("Application::initOpenAL caught exception: %s", e.what ()); return false; } @@ -1036,7 +1036,7 @@ bool Application::createDocument() { - DEBUG("create document\n"); + SW_DEBUG("create document\n"); m_document = new Document(); m_document->loadSettings(); @@ -1056,7 +1056,7 @@ bool Application::createView() { - DEBUG("create view\n"); + SW_DEBUG("create view\n"); m_main_window = new MainWindow(m_ogre_root, m_cegui_system,m_window,m_document); #ifdef SUMWARS_BUILD_TOOLS @@ -1095,7 +1095,7 @@ if (datagroups & World::DATA_IMAGES) { - DEBUG("Loading images."); + SW_DEBUG("Loading images."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("itempictures","*.png"); for (it = files->begin(); it != files->end(); ++it) { @@ -1134,13 +1134,13 @@ if (datagroups & World::DATA_MODELS) { - DEBUG("Loading models."); + SW_DEBUG("Loading models."); Ogre::ResourceGroupManager::getSingleton().loadResourceGroup("General"); updateStartScreen(0.35); } if (datagroups & World::DATA_PARTICLESYSTEMS) { - DEBUG("Loading particlesystems."); + SW_DEBUG("Loading particlesystems."); //Ogre::ResourceGroupManager::getSingleton().addResourceGroupListener (&myListener); Ogre::ResourceGroupManager::getSingleton().loadResourceGroup("Particles"); @@ -1160,7 +1160,7 @@ } catch (Ogre::Exception& e) { - DEBUG("failed with exception %s",e.what()); + SW_DEBUG("failed with exception %s",e.what()); } } } @@ -1181,7 +1181,7 @@ if (datagroups & World::DATA_ABILITIES) { EventSystem::init(); - DEBUG("Loading ability data."); + SW_DEBUG("Loading ability data."); Action::init(); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("abilities","*.xml"); @@ -1201,7 +1201,7 @@ // Spielerklassen initialisieren if (datagroups & World::DATA_PLAYERCLASSES) { - DEBUG("Loading playerclasses."); + SW_DEBUG("Loading playerclasses."); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("playerclasses","*.xml"); for (it = files->begin(); it != files->end(); ++it) { @@ -1217,7 +1217,7 @@ if (datagroups & World::DATA_ITEMS) { - DEBUG("Loading items."); + SW_DEBUG("Loading items."); // Items initialisieren ItemFactory::init(); files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("items","*.xml"); @@ -1267,7 +1267,7 @@ if (datagroups & World::DATA_RENDERINFO) { - DEBUG("Loading renderinfo."); + SW_DEBUG("Loading renderinfo."); // Render Infos files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("renderinfo","*.xml"); @@ -1284,7 +1284,7 @@ if (datagroups & World::DATA_SOUND) { - DEBUG("Loading sound."); + SW_DEBUG("Loading sound."); // Sounds files = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("sounddata","*.xml"); @@ -1295,7 +1295,7 @@ file += it->filename; //SoundSystem::loadSoundData(file.c_str()); - DEBUG ("Loading sound file [%s]", file.c_str ()); + SW_DEBUG ("Loading sound file [%s]", file.c_str ()); SoundHelper::loadSoundGroupsFromFile (file); updateStartScreen(0.9); @@ -1343,7 +1343,7 @@ xmlFileName.append ("/"); xmlFileName.append (it->filename); - DEBUG ("Located resource file for menu music: %s", xmlFileName.c_str ()); + SW_DEBUG ("Located resource file for menu music: %s", xmlFileName.c_str ()); if (! SoundHelper::loadPlaylistFromXMLFile (xmlFileName)) { ERRORMSG ("Could not successfully load playlist from given file: %s", xmlFileName.c_str ()); @@ -1435,7 +1435,7 @@ World* world = World::getWorld(); if (world->getDataReloadRequests() != World::DATA_NONE) { - DEBUG("reload request %x",world->getDataReloadRequests()); + SW_DEBUG("reload request %x",world->getDataReloadRequests()); int datagroups = world->getDataReloadRequests(); @@ -1452,7 +1452,7 @@ // this occurs when ressources are loaded while running if (m_running) { - DEBUG ("Update start screen while running..."); + SW_DEBUG ("Update start screen while running..."); return; } @@ -1495,7 +1495,7 @@ if (rw && rw == m_window) { - DEBUG ("Application got a window closing event."); + SW_DEBUG ("Application got a window closing event."); if (m_document != 0) {
--- a/src/gui/ceguiutility.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/ceguiutility.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -352,7 +352,7 @@ parentPtr->addChildWindow (childPtr); #else parentPtr->addChild (childPtr); - DEBUG ("[ceguiutil] Added item: [%s] to [%s]", childPtr->getNamePath ().c_str (), parentPtr->getNamePath ().c_str ()); + SW_DEBUG ("[ceguiutil] Added item: [%s] to [%s]", childPtr->getNamePath ().c_str (), parentPtr->getNamePath ().c_str ()); #endif } @@ -386,7 +386,7 @@ void CEGUIUtility::loadImageset (const CEGUI::String& name) { - DEBUG ("Loading imageset file [%s]", name.c_str ()); + SW_DEBUG ("Loading imageset file [%s]", name.c_str ()); #ifdef CEGUI_07 CEGUI::ImagesetManager::getSingleton().create(name); #else @@ -427,7 +427,7 @@ } int numChildren = startingWindow->getChildCount (); - DEBUG ("%s%s (%d children)", ss.str ().c_str (), startingWindow->getName().c_str (), numChildren); + SW_DEBUG ("%s%s (%d children)", ss.str ().c_str (), startingWindow->getName().c_str (), numChildren); for (int i = 0; i < numChildren; ++ i) { CEGUI::Window* childPtr = startingWindow->getChildAtIdx (i); @@ -449,7 +449,7 @@ CEGUI::Window* root = sys->getDefaultGUIContext().getRootWindow(); if (0 == root) { - DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window"); + SW_DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window"); return 0; } @@ -457,7 +457,7 @@ { if (name.length () <= 0) { - DEBUG ("Warning! Attempting to get an unnamed widget from the root window"); + SW_DEBUG ("Warning! Attempting to get an unnamed widget from the root window"); } if (root->isChild (name)) @@ -473,7 +473,7 @@ else { int numChildren = root->getChildCount (); - DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ()); + SW_DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ()); for (int i = 0; i < numChildren; ++ i) { CEGUI::Window* childPtr = root->getChildAtIdx (i); @@ -482,11 +482,11 @@ continue; } - DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); + SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); } // Show how much of the path was matched. - DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ()); + SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ()); } } } @@ -494,7 +494,7 @@ { // Just display the list of child nodes. Then repackage the exception and throw it further along. int numChildren = root->getChildCount (); - DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ()); + SW_DEBUG ("Could not find child [%s] within %d children of root [%s]", name.c_str (), numChildren, root->getName ().c_str ()); for (int i = 0; i < numChildren; ++ i) { CEGUI::Window* childPtr = root->getChildAtIdx (i); @@ -503,11 +503,11 @@ continue; } - DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); + SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); } // Show how much of the path was matched. - DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ()); + SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath (root, name).c_str ()); throw ex; } #endif @@ -520,7 +520,7 @@ CEGUI::Window* root = sys->getDefaultGUIContext().getRootWindow(); if (0 == root) { - DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window"); + SW_DEBUG ("Warning! Attempting to get a unnamed widget from a NULL window"); return 0; } @@ -528,7 +528,7 @@ { if (name.length () <= 0) { - DEBUG ("Warning! Attempting to get an unnamed widget from the root window"); + SW_DEBUG ("Warning! Attempting to get an unnamed widget from the root window"); } if (root->isChild (name)) @@ -614,7 +614,7 @@ currentWidget = childPtr; result.append ("/"); result.append (currentWidget->getName ()); - DEBUG ("Child [%d]: [%s]", i, currentWidget->getName ().c_str ()); + SW_DEBUG ("Child [%d]: [%s]", i, currentWidget->getName ().c_str ()); // Move to the next token (child name) in the string. ++ currentToken; @@ -623,7 +623,7 @@ if (!foundChild) { - DEBUG ("Could not find child [%s] within %d children of [%s]", castedName.c_str (), numChildren, currentWidget->getName ().c_str ()); + SW_DEBUG ("Could not find child [%s] within %d children of [%s]", castedName.c_str (), numChildren, currentWidget->getName ().c_str ()); for (int i = 0; i < numChildren; ++ i) { CEGUI::Window* childPtr = currentWidget->getChildAtIdx (i); @@ -632,7 +632,7 @@ continue; } - DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); + SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); } } } @@ -651,7 +651,7 @@ #else if (0 == parentWnd) { - DEBUG ("Null parent received."); + SW_DEBUG ("Null parent received."); return 0; } @@ -668,7 +668,7 @@ else { int numChildren = parentWnd->getChildCount (); - DEBUG ("Could not find child [%s] within %d children of [%s]", name.c_str (), numChildren, parentWnd->getName ().c_str ()); + SW_DEBUG ("Could not find child [%s] within %d children of [%s]", name.c_str (), numChildren, parentWnd->getName ().c_str ()); for (int i = 0; i < numChildren; ++ i) { CEGUI::Window* childPtr = parentWnd->getChildAtIdx (i); @@ -677,11 +677,11 @@ continue; } - DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); + SW_DEBUG ("Child [%d]: [%s]", i, childPtr->getName ().c_str ()); } // Show how much of the path was matched. - DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath(parentWnd, name).c_str()); + SW_DEBUG ("Matched items: [%s]", CEGUIUtility::getMatchingPath(parentWnd, name).c_str()); } } #endif
--- a/src/gui/charcreate.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/charcreate.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -30,7 +30,7 @@ : Window (doc) , m_ceguiSkinName (ceguiSkinName) { - DEBUG ("CharCreate window created with cegui skin [%s]", m_ceguiSkinName.c_str ()); + SW_DEBUG ("CharCreate window created with cegui skin [%s]", m_ceguiSkinName.c_str ()); // Create GUI Elements CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); @@ -156,7 +156,7 @@ bool CharCreate::onClassSelected(const CEGUI::EventArgs& evt) { - DEBUG ("CharCreate::onClassSelected"); + SW_DEBUG ("CharCreate::onClassSelected"); CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); CEGUI::String widgetName = CEGUIUtility::getNameForWidget("ClassList"); CEGUI::Listbox* classlist = static_cast<CEGUI::Listbox*> (CEGUIUtility::getWindowForLoadedLayoutEx(m_window, widgetName));
--- a/src/gui/charinfo.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/charinfo.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -28,13 +28,13 @@ CEGUI::FrameWindow* char_info = (CEGUI::FrameWindow*) (CEGUIUtility::loadLayoutFromFile ("characterscreen.layout")); if (!char_info) { - DEBUG ("WARNING: Failed to load [%s]", "characterscreen.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen.layout"); } CEGUI::Window* char_info_holder = CEGUIUtility::loadLayoutFromFile ("characterscreen_holder.layout"); if (!char_info_holder) { - DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (char_info_holder, "CharInfo_Holder"); @@ -45,8 +45,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen."); - if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen."); + if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen."); } m_window = char_info_holder; @@ -232,7 +232,7 @@ if (label->getText()!= (CEGUI::utf8*) out_stream.str().c_str()) { - DEBUG("set class label"); + SW_DEBUG("set class label"); label->setText((CEGUI::utf8*) out_stream.str().c_str()); }
--- a/src/gui/clipboard.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/clipboard.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -17,13 +17,13 @@ Clipboard::Clipboard () { - DEBUG ("Clipboard costructor!"); + SW_DEBUG ("Clipboard costructor!"); } bool Clipboard::copy (bool cutInsteadOfCopy) { - DEBUG ("Reached Clipboard copy; cut? %d", cutInsteadOfCopy); + SW_DEBUG ("Reached Clipboard copy; cut? %d", cutInsteadOfCopy); CEGUI::Window* sheet = CEGUIUtility::getRootSheet (CEGUI::System::getSingletonPtr ()); if (!sheet) return false; @@ -89,10 +89,10 @@ bool Clipboard::paste () { - DEBUG ("Reached clipboard paste..."); + SW_DEBUG ("Reached clipboard paste..."); std::string clipboardContents = _readFromClipboard (); - DEBUG ("Got clipboard text to be: %s", clipboardContents.c_str ()); + SW_DEBUG ("Got clipboard text to be: %s", clipboardContents.c_str ()); CEGUI::Window* sheet = CEGUIUtility::getRootSheet (CEGUI::System::getSingletonPtr ()); if (!sheet) return false; @@ -144,7 +144,7 @@ edit->setText( newtext.erase( beg, len ) ); } - DEBUG ("Selection start idx: %d", beg); + SW_DEBUG ("Selection start idx: %d", beg); // Now paste the new text. CEGUI::String newtext = edit->getText(); @@ -159,7 +159,7 @@ edit->setCaretIndex (beg + clipboardContents.length ()); #endif - DEBUG ("updated edit box contents"); + SW_DEBUG ("updated edit box contents"); } else {
--- a/src/gui/controlpanel.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/controlpanel.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -32,13 +32,13 @@ CEGUI::Window* ctrl_panel = CEGUIUtility::loadLayoutFromFile ("controlpanel.layout"); if (!ctrl_panel) { - DEBUG ("WARNING: Failed to load [%s]", "controlpanel.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "controlpanel.layout"); } CEGUI::Window* ctrl_panel_holder = CEGUIUtility::loadLayoutFromFile ("controlpanel_holder.layout"); if (!ctrl_panel_holder) { - DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "characterscreen_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (ctrl_panel_holder, "ControlPanel_Holder"); @@ -49,8 +49,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for control panel."); - if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for control panel."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for control panel."); + if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for control panel."); } m_window = ctrl_panel_holder;
--- a/src/gui/dialoguewindow.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/dialoguewindow.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -29,13 +29,13 @@ CEGUI::FrameWindow* dialog_wnd = static_cast<CEGUI::FrameWindow*> (CEGUIUtility::loadLayoutFromFile ("dialogwindow.layout")); if (!dialog_wnd) { - DEBUG ("WARNING: Failed to load [%s]", "dialogwindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "dialogwindow.layout"); } CEGUI::Window* dialog_wnd_holder = CEGUIUtility::loadLayoutFromFile ("dialogwindow_holder.layout"); if (!dialog_wnd_holder) { - DEBUG ("WARNING: Failed to load [%s]", "dialogwindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "dialogwindow_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (dialog_wnd_holder, "DialogWindow_Holder"); @@ -46,8 +46,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for dialog screen."); - if (!wndDialogWindow) DEBUG ("ERROR: Unable to get the window for dialog screen."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for dialog screen."); + if (!wndDialogWindow) SW_DEBUG ("ERROR: Unable to get the window for dialog screen."); } m_window = dialog_wnd_holder; @@ -101,23 +101,23 @@ upper_bar->setVisible(bar_vis); lower_bar->setVisible(bar_vis); m_window->setVisible (bar_vis); - DEBUG ("Set both lower and upper bar visibility to %d", bar_vis); + SW_DEBUG ("Set both lower and upper bar visibility to %d", bar_vis); // note: remove this (only debug) if (bar_vis) { - DEBUG ("object visibility set to true: %s", upper_bar->getNamePath ().c_str ()); + SW_DEBUG ("object visibility set to true: %s", upper_bar->getNamePath ().c_str ()); CEGUI::Window *tmp; tmp = CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "DialogWindow"); - DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); + SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); tmp = CEGUIUtility::getWindow ("GameScreen/DialogWindow_Holder"); - DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); + SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); if (! tmp->isVisible ()) { tmp->setVisible (true); } tmp = CEGUIUtility::getWindow ("GameScreen"); - DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); + SW_DEBUG ("object visibility of %s is %d", tmp->getNamePath ().c_str (), tmp->isVisible ()); } } @@ -179,7 +179,7 @@ if (wname->getText() != (CEGUI::utf8*) name.c_str()) { wname->setText((CEGUI::utf8*) name.c_str()); - DEBUG ("Set text of widget (a) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ()); + SW_DEBUG ("Set text of widget (a) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ()); } if (!wname->isVisible()) @@ -217,7 +217,7 @@ wtext->setText((CEGUI::utf8*)txt.text.c_str()); #else wtext->setText((CEGUI::utf8*)text.c_str()); - DEBUG ("Set text of widget (b) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ()); + SW_DEBUG ("Set text of widget (b) [%s] to [%s]", wname->getNamePath ().c_str (), wname->getText ().c_str ()); #endif } wtext->setVisible(true); @@ -413,7 +413,7 @@ label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,picsize+10), CEGUI::UDim(0,5))); label->setText(""); - DEBUG ("Set text of widget (c) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); + SW_DEBUG ("Set text of widget (c) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); label->setAlpha(0.9); stream.str(""); @@ -446,7 +446,7 @@ if (label->getText() != (CEGUI::utf8*) text.c_str()) { - DEBUG ("diff label [%s], [%s]", label->getText ().c_str (), text.c_str ()); + SW_DEBUG ("diff label [%s], [%s]", label->getText ().c_str (), text.c_str ()); const CEGUI::Font* font = label->getFont(); @@ -458,7 +458,7 @@ FormatedText txt = CEGUIUtility::fitTextToWindow((CEGUI::utf8*) text.c_str(), maxwidth, CEGUIUtility::WordWrapLeftAligned, font); size_t lines = txt.lines; label->setText((CEGUI::utf8*) txt.text.c_str()); - DEBUG ("Set text of widget (d) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); + SW_DEBUG ("Set text of widget (d) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); // Test to see whether the text can fit a single line if (txt.lines <= 1) @@ -589,7 +589,7 @@ if (label->getText() != ctext) { label->setText((CEGUI::utf8*)ctext); - DEBUG ("Set text of widget (e) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); + SW_DEBUG ("Set text of widget (e) [%s] to [%s]", label->getNamePath ().c_str (), label->getText ().c_str ()); } label->setPosition(CEGUI::UVector2(CEGUI::UDim(0,horzoffset), CEGUI::UDim(0,height))); @@ -661,7 +661,7 @@ if (label->getText() != expectedString) { - DEBUG ("Updating text of widget (f) [%s] to [%s] (prev [%s])", label->getNamePath ().c_str (), expectedString.c_str (), label->getText ().c_str ()); + SW_DEBUG ("Updating text of widget (f) [%s] to [%s] (prev [%s])", label->getNamePath ().c_str (), expectedString.c_str (), label->getText ().c_str ()); label->setText((CEGUI::utf8*)expectedString.c_str()); } @@ -714,7 +714,7 @@ bool DialogueWindow::onAnswerClicked(const CEGUI::EventArgs& evt) { - DEBUG ("DialogueWindow::onAnswerClicked"); + SW_DEBUG ("DialogueWindow::onAnswerClicked"); const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt); unsigned int id = we.window->getID(); @@ -729,7 +729,7 @@ const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt); CEGUI::String lineText = "[colour='FFFFDD66']"; - DEBUG ("Entered area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ()); + SW_DEBUG ("Entered area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ()); // we.window->setTextParsingEnabled (true); we.window->setText ("-"); we.window->invalidate (true); @@ -747,7 +747,7 @@ const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt); //DEBUG ("Left area for: %s", we.window->getText ().c_str ()); - DEBUG ("Left area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ()); + SW_DEBUG ("Left area for: %s (%s)", we.window->getNamePath ().c_str (), we.window->getTextVisual ().c_str ()); CEGUI::String lineText = "[colour='FFFFFFFF']"; we.window->setText ("-"); we.window->invalidate (true); @@ -757,7 +757,7 @@ bool DialogueWindow::onTextClicked(const CEGUI::EventArgs& evt) { - DEBUG ("DialogueWindow::onTextClicked"); + SW_DEBUG ("DialogueWindow::onTextClicked"); CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt);
--- a/src/gui/graphicmanager.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/graphicmanager.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -163,7 +163,7 @@ void GraphicManager::clearRenderInfos() { - DEBUG("clearing all renderinfos"); + SW_DEBUG("clearing all renderinfos"); // delete the renderinfo Data std::map<std::string, GraphicRenderInfo*>::iterator it; for (it = m_render_infos.begin(); it != m_render_infos.end(); ++it) @@ -461,7 +461,7 @@ catch (Ogre::Exception& e) { WARNING("can't create mesh %s", info.m_source.c_str()); - DEBUG ("(Caught exception: %s)", e.what ()); + SW_DEBUG ("(Caught exception: %s)", e.what ()); obj_ent = m_scene_manager->createEntity(name, "dummy_r.mesh"); } obj= static_cast<Ogre::MovableObject*>(obj_ent); @@ -476,7 +476,7 @@ catch (Ogre::Exception& e) { WARNING("can't create particle system %s", info.m_source.c_str()); - DEBUG ("(Caught exception: %s)", e.what ()); + SW_DEBUG ("(Caught exception: %s)", e.what ()); } obj= static_cast<Ogre::MovableObject*>(part); }
--- a/src/gui/graphicobject.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/graphicobject.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -317,7 +317,7 @@ std::map <std::string, SoundObject>::iterator it = m_soundobjects.find (object.m_objectname.c_str ()); if (it != m_soundobjects.end ()) { - DEBUG ("WARNING: %s: subobject %s already exists", m_name.c_str(), object.m_objectname.c_str()); + SW_DEBUG ("WARNING: %s: subobject %s already exists", m_name.c_str(), object.m_objectname.c_str()); } if (m_soundobjects.count(object.m_objectname) >0) { @@ -330,7 +330,7 @@ m_soundobjects[object.m_objectname] = SoundObject (name); //m_soundobjects[object.m_objectname] = name; - DEBUG ("setting soundobject with name [%s] to: (%s)", object.m_objectname.c_str (), name.c_str ()); + SW_DEBUG ("setting soundobject with name [%s] to: (%s)", object.m_objectname.c_str (), name.c_str ()); } else { @@ -1005,7 +1005,7 @@ // TODO:XXX: This is where a play command should be triggered. it->second.play (); - DEBUG ("setting sound object [%s] to sound [%s]", it->first.c_str (), part->m_animation.c_str ()); + SW_DEBUG ("setting sound object [%s] to sound [%s]", it->first.c_str (), part->m_animation.c_str ()); } } }
--- a/src/gui/inventory.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/inventory.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -32,16 +32,16 @@ CEGUI::Window* inventory = CEGUIUtility::loadLayoutFromFile ("inventory.layout"); if (!inventory) { - DEBUG ("WARNING: Failed to load [%s]", "inventory.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "inventory.layout"); } CEGUI::Window* inv_holder = CEGUIUtility::loadLayoutFromFile ("inventory_holder.layout"); if (!inv_holder) { - DEBUG ("WARNING: Failed to load [%s]", "inventory_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "inventory_holder.layout"); } - DEBUG ("Placing layout into holder"); + SW_DEBUG ("Placing layout into holder"); inventory->setVisible (true); inv_holder->setVisible (true); //CEGUIUtility::addChildWidget (inv_holder, inventory); @@ -55,8 +55,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for inventory."); - if (!wndInventory) DEBUG ("ERROR: Unable to get the window for inventory."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for inventory."); + if (!wndInventory) SW_DEBUG ("ERROR: Unable to get the window for inventory."); } m_window = inv_holder; @@ -398,7 +398,7 @@ if(s == Inventory::StateSmall) { - DEBUG ("Changed state to small inventory"); + SW_DEBUG ("Changed state to small inventory"); CEGUI::TabButton *tabBtn; tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton")); @@ -417,7 +417,7 @@ } else if(s == Inventory::StateMedium) { - DEBUG ("Changed state to medium inventory"); + SW_DEBUG ("Changed state to medium inventory"); CEGUI::TabButton *tabBtn; tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton")); @@ -436,7 +436,7 @@ } else if(s == Inventory::StateBig) { - DEBUG ("Changed state to big inventory"); + SW_DEBUG ("Changed state to big inventory"); CEGUI::TabButton *tabBtn; tabBtn = static_cast<CEGUI::TabButton*> (CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "Inventory/inventory_aux/StashHolder/SmallTabButton")); @@ -512,7 +512,7 @@ const CEGUI::WindowEventArgs* args = static_cast<const CEGUI::WindowEventArgs*>(&evt); std::string name = args->window->getName().c_str(); - DEBUG ("Inventory: Switch Tab [%s]", name.c_str ()); + SW_DEBUG ("Inventory: Switch Tab [%s]", name.c_str ()); if(name == "SmallTabButton") {
--- a/src/gui/main_gui.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/main_gui.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -222,7 +222,7 @@ */ catch (CEGUI::Exception& e) { - DEBUG("Program died with exception %s", e.getMessage().c_str()); + SW_DEBUG("Program died with exception %s", e.getMessage().c_str()); } // Ende return 0;
--- a/src/gui/mainmenu.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/mainmenu.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -45,7 +45,7 @@ , m_ceguiSkinName (ceguiSkinName) , m_starMenuRoot (0) { - DEBUG ("MainMenu created"); + SW_DEBUG ("MainMenu created"); m_savegame_player =""; m_savegame_player_object =0; @@ -74,7 +74,7 @@ } CEGUI::Window* wndHeld = CEGUIUtility::getWindowForLoadedLayoutEx (m_starMenuRoot, "MainMenuRoot"); - DEBUG ("Placing layout into holder"); + SW_DEBUG ("Placing layout into holder"); m_starMenuRoot->setVisible (true); #if 0 @@ -162,7 +162,7 @@ if (verlbl) { verlbl->setText(CEGUI::String("Version: ").append(SUMWARS_VERSION)); - DEBUG ("Set sumwars version text to : [%s]", verlbl->getText ().c_str ()); + SW_DEBUG ("Set sumwars version text to : [%s]", verlbl->getText ().c_str ()); } CEGUI::FrameWindow* lbl; @@ -384,7 +384,7 @@ bool MainMenu::onShown( const CEGUI::EventArgs& evt ) { - DEBUG ("Main menu shown"); + SW_DEBUG ("Main menu shown"); Ogre::Root *root = Ogre::Root::getSingletonPtr(); if (!m_sceneCreated) { @@ -408,14 +408,14 @@ } catch (std::exception& e) { - DEBUG ("Encountered error while trying to switch to the menu playlist: %s", e.what ()); + SW_DEBUG ("Encountered error while trying to switch to the menu playlist: %s", e.what ()); } return true; } bool MainMenu::onHidden( const CEGUI::EventArgs& evt ) { - DEBUG ("Main menu hidden"); + SW_DEBUG ("Main menu hidden"); Ogre::Root *root = Ogre::Root::getSingletonPtr(); if (m_sceneCreated) { @@ -836,7 +836,7 @@ } catch (std::exception& e) { - DEBUG ("[MainMenu] Caught exception in scene creation: [%s]", e.what ()); + SW_DEBUG ("[MainMenu] Caught exception in scene creation: [%s]", e.what ()); } }
--- a/src/gui/mainwindow.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/mainwindow.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -92,21 +92,21 @@ bool result = true; m_ceguiSkinName = Options::getInstance ()->getCeguiSkin (); - DEBUG ("Main Window (init): Cegui skin name found in options as: [%s]", m_ceguiSkinName.c_str ()); + SW_DEBUG ("Main Window (init): Cegui skin name found in options as: [%s]", m_ceguiSkinName.c_str ()); // Set-up the main menu. - DEBUG ("Setting up the root window."); + SW_DEBUG ("Setting up the root window."); result &= setupRootWindow(); // Initialize the input devices - DEBUG ("Initializing input devices."); + SW_DEBUG ("Initializing input devices."); result &= initInputs(); - DEBUG ("Initializing graphics."); + SW_DEBUG ("Initializing graphics."); GraphicManager::init(); // Set-up the main menu. - DEBUG ("Initializing main menu."); + SW_DEBUG ("Initializing main menu."); result &= setupMainMenu(); CEGUIUtility::addChildWidget (m_root_window, m_main_menu); @@ -114,7 +114,7 @@ CEGUIUtility::setRootSheet (CEGUI::System::getSingletonPtr(), m_root_window); // Set-up the main game window/screen - DEBUG ("Initializing main game screen."); + SW_DEBUG ("Initializing main game screen."); result &= setupGameScreen(); CEGUIUtility::addChildWidget (m_root_window, m_game_screen); @@ -206,7 +206,7 @@ std::string layoutFile ("startscreen.layout"); CEGUI::Window* start_screen_holder = CEGUIUtility::loadLayoutFromFile (layoutFile); - DEBUG ("Loaded layout file [%s]", layoutFile.c_str ()); + SW_DEBUG ("Loaded layout file [%s]", layoutFile.c_str ()); if (start_screen_holder) { @@ -231,42 +231,42 @@ ERRORMSG ("WARNING: Failed to load [%s]", layoutFile.c_str ()); } - DEBUG ("Creating credits window"); + SW_DEBUG ("Creating credits window"); CreditsWindow* crd = new CreditsWindow (m_document, m_ceguiSkinName); m_sub_windows["CreditsWindow"] = crd; crd->getCEGUIWindow ()->setMousePassThroughEnabled (true); CEGUIUtility::addChildWidget (m_main_menu, crd->getCEGUIWindow()); - DEBUG ("Creating main menu"); + SW_DEBUG ("Creating main menu"); Window * wnd = new MainMenu(m_document, m_ceguiSkinName); m_sub_windows["MainMenu"] = wnd; wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true); CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow()); - DEBUG ("Creating character screen"); + SW_DEBUG ("Creating character screen"); wnd = new CharCreate (m_document, m_ceguiSkinName); m_sub_windows["CharCreate"] = wnd; wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true); CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow()); - DEBUG ("Creating options window"); + SW_DEBUG ("Creating options window"); wnd = new OptionsWindow(m_document,m_keyboard, m_ceguiSkinName); m_sub_windows["Options"] = wnd; wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true); CEGUIUtility::addChildWidget (m_root_window, wnd->getCEGUIWindow()); - DEBUG ("Creating game hosting screen"); + SW_DEBUG ("Creating game hosting screen"); wnd = new HostGameWindow(m_document); m_sub_windows["HostGame"] = wnd; wnd->getCEGUIWindow ()->setMousePassThroughEnabled (true); CEGUIUtility::addChildWidget (m_main_menu, wnd->getCEGUIWindow()); - DEBUG ("Creating game joining screen"); + SW_DEBUG ("Creating game joining screen"); wnd = new JoinGameWindow(m_document); m_sub_windows["JoinGame"] = wnd; @@ -1256,7 +1256,7 @@ void MainWindow::setupChatContent() { - DEBUG ("Setting up chat content GUI window"); + SW_DEBUG ("Setting up chat content GUI window"); CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); CEGUI::Window* label; @@ -2302,7 +2302,7 @@ if (refresh) { - DEBUG ("*** main window expecting refresh for region [%s]", pl->getRegion ()->getName ().c_str ()); + SW_DEBUG ("*** main window expecting refresh for region [%s]", pl->getRegion ()->getName ().c_str ()); timer.start(); MinimapWindow* myMinimap = static_cast<MinimapWindow*> (m_sub_windows["Minimap"]); @@ -2659,7 +2659,7 @@ } catch (std::exception& e) { - DEBUG ("Caught exception: [%s]", e.what ()); + SW_DEBUG ("Caught exception: [%s]", e.what ()); } return CEGUIUtility::injectMousePosition (m_cegui_system, evt.state.X.abs, evt.state.Y.abs); @@ -2700,7 +2700,7 @@ // if the returned window is anything else than "GameScreen" then CEGUI needs to process the input CEGUI::Window* mouseWindow = CEGUIUtility::getWindowContainingMouse (m_cegui_system); - DEBUG ("Mouse Pressed. Mouse window is [%s]", mouseWindow->getName ().c_str ()); + SW_DEBUG ("Mouse Pressed. Mouse window is [%s]", mouseWindow->getName ().c_str ()); if (! (mouseWindow->getName () == "SW")) { ret = true; // set ret to false if the events where processed by the invisible window @@ -2843,7 +2843,7 @@ { if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl)) { - DEBUG ("MainWindow:: ctrl + c pressed!"); + SW_DEBUG ("MainWindow:: ctrl + c pressed!"); SWUtil::Clipboard::getSingletonPtr ()->copy (); } } @@ -2851,7 +2851,7 @@ { if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl)) { - DEBUG ("MainWindow:: ctrl + X pressed!"); + SW_DEBUG ("MainWindow:: ctrl + X pressed!"); SWUtil::Clipboard::getSingletonPtr ()->cut (); } } @@ -2859,7 +2859,7 @@ { if (m_keyboard->isModifierDown (OIS::Keyboard::Ctrl)) { - DEBUG ("MainWindow:: ctrl + V pressed!"); + SW_DEBUG ("MainWindow:: ctrl + V pressed!"); SWUtil::Clipboard::getSingletonPtr ()->paste (); } } @@ -2926,7 +2926,7 @@ if (pl2 ==0) return true; - DEBUG("party member Click %i",id); + SW_DEBUG("party member Click %i",id); m_document->getGUIState()->m_cursor_object_id = id; if (we.button == CEGUI::LeftButton)
--- a/src/gui/minimapwindow.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/minimapwindow.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -48,16 +48,16 @@ CEGUI::Window* minimapWnd = CEGUIUtility::loadLayoutFromFile ("minimapwindow.layout"); if (!minimapWnd) { - DEBUG ("WARNING: Failed to load [%s]", "minimapwindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "minimapwindow.layout"); } CEGUI::Window* minimapWnd_holder = CEGUIUtility::loadLayoutFromFile ("minimapwindow_holder.layout"); if (!minimapWnd_holder) { - DEBUG ("WARNING: Failed to load [%s]", "minimapwindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "minimapwindow_holder.layout"); } - DEBUG ("Placing layout into holder"); + SW_DEBUG ("Placing layout into holder"); minimapWnd->setVisible (true); minimapWnd_holder->setVisible (true); @@ -69,8 +69,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for inventory."); - if (!wndHeld) DEBUG ("ERROR: Unable to get the window for inventory."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for inventory."); + if (!wndHeld) SW_DEBUG ("ERROR: Unable to get the window for inventory."); } m_window = minimapWnd_holder; @@ -175,7 +175,7 @@ label->setInheritsAlpha (false); label->setAlwaysOnTop(true); - DEBUG("creating Window!"); + SW_DEBUG("creating Window!"); ncount ++; }
--- a/src/gui/networkwindows.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/networkwindows.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -21,7 +21,7 @@ HostGameWindow::HostGameWindow (Document* doc) :Window(doc) { - DEBUG ("HostGameWindow being created"); + SW_DEBUG ("HostGameWindow being created"); CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); CEGUI::PushButton* btn; CEGUI::Editbox* box; @@ -30,13 +30,13 @@ CEGUI::FrameWindow* host_game = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("hostgamewindow.layout"); if (!host_game) { - DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow.layout"); } CEGUI::Window* host_game_holder = CEGUIUtility::loadLayoutFromFile ("hostgamewindow_holder.layout"); if (!host_game_holder) { - DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "hostgamewindow_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (host_game_holder, "HostGameWindow_Holder"); @@ -47,8 +47,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen."); - if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen."); + if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen."); } m_window = host_game_holder; @@ -174,7 +174,7 @@ JoinGameWindow::JoinGameWindow (Document* doc) :Window(doc) { - DEBUG ("JoinGameWindow being created"); + SW_DEBUG ("JoinGameWindow being created"); CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); CEGUI::PushButton* btn; CEGUI::Editbox* box; @@ -183,13 +183,13 @@ CEGUI::FrameWindow* join_game = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("joingamewindow.layout"); if (!join_game) { - DEBUG ("WARNING: Failed to load [%s]", "joingamewindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "joingamewindow.layout"); } CEGUI::Window* join_game_holder = CEGUIUtility::loadLayoutFromFile ("joingamewindow_holder.layout"); if (!join_game_holder) { - DEBUG ("WARNING: Failed to load [%s]", "joingamewindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "joingamewindow_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (join_game_holder, "JoinGameWindow_Holder"); @@ -200,8 +200,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen."); - if (!wndCharInfo) DEBUG ("ERROR: Unable to get the window for char screen."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen."); + if (!wndCharInfo) SW_DEBUG ("ERROR: Unable to get the window for char screen."); } m_window = join_game_holder; @@ -301,7 +301,7 @@ stream.str(box->getText().c_str()); stream >> port; - DEBUG("join game %i %s",port,hostname.c_str()); + SW_DEBUG("join game %i %s",port,hostname.c_str()); options->setPort(port); options->setServerHost(hostname);
--- a/src/gui/optionswindow.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/optionswindow.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -45,7 +45,7 @@ m_keyboard = keyboard; - DEBUG ("OptionsWindow being created using cegui skin [%s]", m_ceguiSkinName.c_str ()); + SW_DEBUG ("OptionsWindow being created using cegui skin [%s]", m_ceguiSkinName.c_str ()); // Generate GUI Elements CEGUI::WindowManager& win_mgr = CEGUI::WindowManager::getSingleton(); @@ -54,14 +54,14 @@ CEGUI::FrameWindow* options = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("optionswindow.layout"); if (!options) { - DEBUG ("WARNING: Failed to load [%s]", "optionswindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "optionswindow.layout"); } // Load the holder layout. This should be diffeent for each aspect ratio. CEGUI::Window* options_holder = CEGUIUtility::loadLayoutFromFile ("options_holder.layout"); if (!options_holder) { - DEBUG ("WARNING: Failed to load [%s]", "options_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "options_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (options_holder, "OptionsWindow_Holder"); @@ -72,8 +72,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for options window."); - if (!wndHeldWindow) DEBUG ("ERROR: Unable to get the window for options window."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for options window."); + if (!wndHeldWindow) SW_DEBUG ("ERROR: Unable to get the window for options window."); } @@ -81,7 +81,7 @@ options_holder->setAlwaysOnTop (true); m_window = options_holder; - DEBUG ("OptionsWindow (ctor) loaded layout"); + SW_DEBUG ("OptionsWindow (ctor) loaded layout"); // Rahmen fuer das Menue Savegame auswaehlen CEGUI::TabControl* optionstab = (CEGUI::TabControl*) CEGUIUtility::getWindowForLoadedLayoutEx (options, "OptionsWindowTab"); @@ -115,7 +115,7 @@ label->subscribeEvent (CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber (&OptionsWindow::onGUIItemClicked, this)); label->setInheritsAlpha(false); - DEBUG ("OptionsWindow (ctor) adding labels"); + SW_DEBUG ("OptionsWindow (ctor) adding labels"); int targets[9] = {SHOW_INVENTORY, SHOW_CHARINFO, SHOW_SKILLTREE, SHOW_PARTYMENU, SHOW_CHATBOX, SHOW_QUESTINFO, SHOW_MINIMAP, SWAP_EQUIP, SHOW_ITEMLABELS}; @@ -141,7 +141,7 @@ //label->subscribeEvent(CEGUIUtility::EventMouseEntersWindowArea (), CEGUI::Event::Subscriber(&OptionsWindow::onButtonItemHover, this)); } - DEBUG ("Adding difficulty combo-box");//xxx + SW_DEBUG ("Adding difficulty combo-box");//xxx CEGUI::Combobox* diffcbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/DifficultyBox")); diffcbo->addItem(new ListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Easy"),Options::EASY)); diffcbo->addItem(new ListItem((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) gettext("Normal"),Options::NORMAL)); @@ -154,7 +154,7 @@ diffcbo->setItemSelectState( (size_t) (Options::getInstance()->getDifficulty()-1),true); connectWidgetSoundEvents ("OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/DifficultyBox", "combobox"); - DEBUG ("Adding sliders"); + SW_DEBUG ("Adding sliders"); slider = static_cast<CEGUI::Scrollbar*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGameplay/TextSpeedSlider")); slider->setPageSize (0.01f); slider->setDocumentSize(1.0f); @@ -228,7 +228,7 @@ } catch (std::exception& e) { - DEBUG ("Caught exception while creating events for optional object. Carrying on after the exception [%s]", e.what()); + SW_DEBUG ("Caught exception while creating events for optional object. Carrying on after the exception [%s]", e.what()); } @@ -254,7 +254,7 @@ locale = locale.substr(0,pos); } - DEBUG ("OptionsWindow (ctor) current locale is [%s]", locale.c_str ()); + SW_DEBUG ("OptionsWindow (ctor) current locale is [%s]", locale.c_str ()); for (int i=0; i < (int)cbo->getItemCount(); i++) { @@ -276,7 +276,7 @@ if (Options::getInstance ()->isWindowedFullscreenModeSupported ()) { - DEBUG ("Windowed fullscreen mode supported! Adding combobox item."); + SW_DEBUG ("Windowed fullscreen mode supported! Adding combobox item."); std::string modeName = gettext("Window (Fullscreen)"); std::string recommended = gettext (" - recommended"); std::string sum = modeName + recommended; @@ -285,7 +285,7 @@ } else { - DEBUG ("Windowed fullscreen mode NOT supported!"); + SW_DEBUG ("Windowed fullscreen mode NOT supported!"); } cbo->setReadOnly(true); @@ -338,7 +338,7 @@ // Get the resolution in the current options set. std::string usedResolution = Options::getInstance ()->getUsedResolution (); - DEBUG ("Used resolution is: [%s]", usedResolution.c_str ()); + SW_DEBUG ("Used resolution is: [%s]", usedResolution.c_str ()); // Get the list of available resolutions for the selected video driver. std::vector <std::string> resolutions = Options::getInstance ()->getEditableResolutionsMapping ()[selectedVideoDriver]; @@ -426,12 +426,12 @@ } else { - DEBUG ("Options Window init: could not find item named %s", widgetName.c_str()); + SW_DEBUG ("Options Window init: could not find item named %s", widgetName.c_str()); } } catch(std::exception& e) { - DEBUG ("Caught exception and continuing [%s]", e.what ()); + SW_DEBUG ("Caught exception and continuing [%s]", e.what ()); } reset(); @@ -631,18 +631,18 @@ } catch (std::exception& e) { - DEBUG ("Caught an exception while connecting widget sound events (will continue) [%s]", e.what ()); + SW_DEBUG ("Caught an exception while connecting widget sound events (will continue) [%s]", e.what ()); } } else { - DEBUG ("Developer message: widget type [%s] not recognized in connecting widget sound events", widgetType.c_str ()); + SW_DEBUG ("Developer message: widget type [%s] not recognized in connecting widget sound events", widgetType.c_str ()); } } catch (std::exception& e) { - DEBUG ("Caught exception: %s", e.what ()); + SW_DEBUG ("Caught exception: %s", e.what ()); } } @@ -718,7 +718,7 @@ bool OptionsWindow::onButtonOkClicked (const CEGUI::EventArgs& evt) { - DEBUG ("[Ok] button clicked in options. Attempting to save them"); + SW_DEBUG ("[Ok] button clicked in options. Attempting to save them"); // TODO: move video mode checks to separate function? or just wait for the full integration with the rest of the options? // Play the sound @@ -736,14 +736,14 @@ CEGUI::Combobox* cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/VideoDriverBox")); if (cbo == 0) { - DEBUG ("Could not find widget [VideoDriverBox]"); + SW_DEBUG ("Could not find widget [VideoDriverBox]"); return false; } CEGUI::ListboxItem* item = cbo->getSelectedItem(); if (item == 0) { - DEBUG ("Could not find selected item in widget [VideoDriverBox]. Searching via text values. (slower)"); + SW_DEBUG ("Could not find selected item in widget [VideoDriverBox]. Searching via text values. (slower)"); CEGUI::String currentText = cbo->getText(); for (unsigned i = 0; i < cbo->getItemCount (); i ++) @@ -757,7 +757,7 @@ if (item == 0) { - DEBUG ("Could not find selected item in widget [VideoDriverBox]. Unable to store any changes!!!"); + SW_DEBUG ("Could not find selected item in widget [VideoDriverBox]. Unable to store any changes!!!"); } std::string selectedDriverName (Options::getInstance ()->getUsedVideoDriver ()); @@ -772,14 +772,14 @@ cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/DisplayModeBox")); if (cbo == 0) { - DEBUG ("Could not find widget [DisplayModeBox]"); + SW_DEBUG ("Could not find widget [DisplayModeBox]"); return false; } item = cbo->getSelectedItem(); if (item == 0) { - DEBUG ("Could not find selected item in widget [DisplayModeBox]. Searching via text values. (slower)"); + SW_DEBUG ("Could not find selected item in widget [DisplayModeBox]. Searching via text values. (slower)"); CEGUI::String currentText = cbo->getText(); for (unsigned i = 0; i < cbo->getItemCount (); i ++) @@ -792,7 +792,7 @@ } if (item == 0) { - DEBUG ("Could not find selected item in widget [DisplayModeBox]. Unable to store any changes!!!"); + SW_DEBUG ("Could not find selected item in widget [DisplayModeBox]. Unable to store any changes!!!"); } DisplayModes userMode = Options::getInstance ()->getUsedDisplayMode (); @@ -801,10 +801,10 @@ { size_t selectionIndex = (int)cbo->getItemIndex (item); - DEBUG ("selected display mode %s",item->getText().c_str()); + SW_DEBUG ("selected display mode %s",item->getText().c_str()); userMode = (DisplayModes)selectionIndex; - DEBUG ("Index of combobox selection is: %d. New display mode set to %d", selectionIndex, userMode); + SW_DEBUG ("Index of combobox selection is: %d. New display mode set to %d", selectionIndex, userMode); someVideoSettingsWereChanged |= (userMode != Options::getInstance ()->getUsedDisplayMode ()); } @@ -814,7 +814,7 @@ if (cbo == 0) { - DEBUG ("Could not find widget [ResolutionBox]"); + SW_DEBUG ("Could not find widget [ResolutionBox]"); return false; } @@ -823,7 +823,7 @@ { userResolution = Options::getInstance ()->getUsedResolution (); } - DEBUG ("selected userResolution %s", userResolution.c_str()); + SW_DEBUG ("selected userResolution %s", userResolution.c_str()); if (userMode == WINDOWED_FULLSCREEN) { @@ -832,7 +832,7 @@ int desktopHeight = (int)GetSystemMetrics (SM_CYSCREEN); userResolution = SumwarsHelper::getUpdatedResolutionString (userResolution, desktopWidth, desktopHeight); #endif - DEBUG ("Updated selected userResolution to [%s]", userResolution.c_str()); + SW_DEBUG ("Updated selected userResolution to [%s]", userResolution.c_str()); } someVideoSettingsWereChanged |= (userResolution != Options::getInstance ()->getUsedResolution ()); @@ -842,14 +842,14 @@ cbo = static_cast<CEGUI::Combobox*>(CEGUIUtility::getWindowForLoadedLayoutEx (m_window, "OptionsWindow/OptionsWindowTab/__auto_TabPane__/OptionsGraphic/ShadowsDropDownList")); if (cbo == 0) { - DEBUG ("Could not find widget [ShadowsDropDownList]"); + SW_DEBUG ("Could not find widget [ShadowsDropDownList]"); return false; } item = cbo->getSelectedItem(); if (item == 0) { - DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Searching via text values. (slower)"); + SW_DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Searching via text values. (slower)"); CEGUI::String currentText = cbo->getText(); for (unsigned i = 0; i < cbo->getItemCount (); i ++) @@ -863,7 +863,7 @@ if (item == 0) { - DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Unable to store any changes!!!"); + SW_DEBUG ("Could not find selected item in widget [ShadowsDropDownList]. Unable to store any changes!!!"); } Options::ShadowMode newShadowSettings = Options::getInstance ()->getShadowMode (); @@ -878,7 +878,7 @@ } - DEBUG ("Used shadow mode (old - new) : %d - %d", Options::getInstance ()->getShadowMode (), newShadowSettings); + SW_DEBUG ("Used shadow mode (old - new) : %d - %d", Options::getInstance ()->getShadowMode (), newShadowSettings); someVideoSettingsWereChanged |= (newShadowSettings != Options::getInstance ()->getShadowMode ()); @@ -912,7 +912,7 @@ { if (e.getNumber () == Ogre::Exception::ERR_FILE_NOT_FOUND) { - DEBUG ("Could not find OGRE config file"); + SW_DEBUG ("Could not find OGRE config file"); return false; } else @@ -931,7 +931,7 @@ Ogre::String resolutionValueToSet (""); resolutionValueToSet = Options::getInstance ()->getUsedResolution (); - DEBUG ("Saving options; will set resolution to : [%s]", resolutionValueToSet.c_str()); + SW_DEBUG ("Saving options; will set resolution to : [%s]", resolutionValueToSet.c_str()); // Update the settings; Ogre::ConfigFile::SectionIterator iSection = cfg.getSectionIterator (); @@ -1020,7 +1020,7 @@ CEGUI::Scrollbar* slider = static_cast<CEGUI::Scrollbar*>(we.window); float vol = slider->getScrollPosition(); - DEBUG("sound volume change to %f",vol); + SW_DEBUG("sound volume change to %f",vol); //SoundSystem::setSoundVolume(vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Effect, vol); SoundManager::getPtr ()->getRepository ()->setVolumeForCategory (gussound::GSC_Master, 1.0); @@ -1040,11 +1040,11 @@ if (item != 0) { Options::getInstance()->setDifficulty(static_cast<Options::Difficulty>(item->getID())); - DEBUG ("Difficulty changed. %s", item->getText ().c_str ()); + SW_DEBUG ("Difficulty changed. %s", item->getText ().c_str ()); } else { - DEBUG ("Difficulty changed. Unknown!"); + SW_DEBUG ("Difficulty changed. Unknown!"); } return true; @@ -1172,7 +1172,7 @@ bool OptionsWindow::onDisplayModeSelected (const CEGUI::EventArgs& evt) { - DEBUG ("Display mode selected"); + SW_DEBUG ("Display mode selected"); const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt); @@ -1180,7 +1180,7 @@ if (cbo == 0) { - DEBUG ("CEGUI ERROR: source widget is NULL"); + SW_DEBUG ("CEGUI ERROR: source widget is NULL"); return false; } @@ -1188,7 +1188,7 @@ if (item == 0) { - DEBUG ("CEGUI ERROR: No valid selection in source widget"); + SW_DEBUG ("CEGUI ERROR: No valid selection in source widget"); return false; } @@ -1234,7 +1234,7 @@ std::string usedResolution = Options::getInstance ()->getUsedResolution (); - DEBUG ("Will try to show that the used resolution is [%s]", usedResolution.c_str ()); + SW_DEBUG ("Will try to show that the used resolution is [%s]", usedResolution.c_str ()); for (size_t i = 0; i < cbo->getItemCount (); ++ i) { @@ -1244,9 +1244,9 @@ { cbo->setItemSelectState(i, true); - DEBUG ("Located item [%s] at [%d]", itemText.c_str (), i); + SW_DEBUG ("Located item [%s] at [%d]", itemText.c_str (), i); } - DEBUG ("Compared with [%s]", itemText.c_str ()); + SW_DEBUG ("Compared with [%s]", itemText.c_str ()); } cbo->handleUpdatedListItemData(); } @@ -1258,7 +1258,7 @@ bool OptionsWindow::onVideoDriverSelected (const CEGUI::EventArgs& evt) { - DEBUG ("Video Driver selected"); + SW_DEBUG ("Video Driver selected"); const CEGUI::MouseEventArgs& we = static_cast<const CEGUI::MouseEventArgs&>(evt); @@ -1283,7 +1283,7 @@ int currentWidth (0), currentHeight (0); SumwarsHelper::getSizesFromResolutionString (Options::getInstance ()->getUsedResolution (), currentWidth, currentHeight); - DEBUG ("Selected video driver: %s", videoDriver.c_str ()); + SW_DEBUG ("Selected video driver: %s", videoDriver.c_str ()); // Get the list of available resolutions for the selected video driver. std::vector <std::string> resolutions = Options::getInstance ()->getEditableResolutionsMapping ()[videoDriver]; @@ -1303,7 +1303,7 @@ for (std::vector <std::string>::const_iterator it = resolutions.begin (); it != resolutions.end (); ++ it) { - DEBUG ("New mode: %s", it->c_str ()); + SW_DEBUG ("New mode: %s", it->c_str ()); cbo->addItem (new StrListItem ((CEGUI::utf8*) m_ceguiSkinName.c_str (), (CEGUI::utf8*) it->c_str (), "", 0)); if (*it == usedResolution) {
--- a/src/gui/questinfo.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/questinfo.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -34,12 +34,12 @@ CEGUI::FrameWindow* quest_info = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("questinfo.layout"); if (!quest_info) { - DEBUG ("WARNING: Failed to load [%s]", "questinfo.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "questinfo.layout"); } CEGUI::Window* quest_info_holder = CEGUIUtility::loadLayoutFromFile ("questinfo_holder.layout"); if (!quest_info_holder) { - DEBUG ("WARNING: Failed to load [%s]", "questinfo_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "questinfo_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (quest_info_holder, "QuestInfo_Holder"); @@ -50,8 +50,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for quests."); - if (!wndQuest) DEBUG ("ERROR: Unable to get the window for quests."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for quests."); + if (!wndQuest) SW_DEBUG ("ERROR: Unable to get the window for quests."); } m_window = quest_info_holder;
--- a/src/gui/savegamelist.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/savegamelist.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -154,11 +154,11 @@ CEGUI::String layoutRootItemName (CEGUIUtility::getNameForWidget(s.str ().append ("SaveItemRoot"))); try { - DEBUG ("Trying to get existing item %s", layoutRootItemName.c_str ()); + SW_DEBUG ("Trying to get existing item %s", layoutRootItemName.c_str ()); saveItem = CEGUIUtility::getWindowForLoadedLayout(m_window, layoutRootItemName); if (!saveItem) { - DEBUG ("Could not get item; will have to load"); + SW_DEBUG ("Could not get item; will have to load"); needToLoadLayout = true; } } @@ -169,9 +169,9 @@ if (needToLoadLayout) { - DEBUG ("Loading layout file [saveitem.layout]"); + SW_DEBUG ("Loading layout file [saveitem.layout]"); saveItem = (CEGUI::FrameWindow*) (CEGUIUtility::loadLayoutFromFile ("saveitem.layout")); - DEBUG ("Loaded layout file [saveitem.layout]"); + SW_DEBUG ("Loaded layout file [saveitem.layout]"); //saveItem = (CEGUI::Window*) win_mgr.loadWindowLayout("saveitem.layout", s.str()); m_currentSelected = saveItem; saveItem->setName (layoutRootItemName); @@ -252,7 +252,7 @@ CEGUI::Window* wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName); if (wndPtr) { - DEBUG ("Setting save button avatar for [%s] to [%s]", wndPtr->getNamePath ().c_str (), imageName.c_str ()); + SW_DEBUG ("Setting save button avatar for [%s] to [%s]", wndPtr->getNamePath ().c_str (), imageName.c_str ()); wndPtr->setProperty("Image", imageName); } else @@ -310,7 +310,7 @@ CEGUI::String widgetName = CEGUIUtility::getNameForWidget("SaveItemRoot_Avatar"); #endif CEGUI::Window* wndPtr = CEGUIUtility::getWindowForLoadedLayout(saveItem, widgetName); - DEBUG ("Setting save button avatar for [%s] to [%s]", widgetName.c_str (), imageName.c_str ()); + SW_DEBUG ("Setting save button avatar for [%s] to [%s]", widgetName.c_str (), imageName.c_str ()); if (wndPtr) { wndPtr->setProperty("Image", imageName); @@ -458,7 +458,7 @@ std::string prefix = we.window->getName().c_str(); std::string saveWidgetName = prefix; - DEBUG ("A character save has been chosen (widget [%s]", prefix.c_str ()); + SW_DEBUG ("A character save has been chosen (widget [%s]", prefix.c_str ()); prefix.erase(prefix.length()-12, prefix.length()); #ifdef CEGUI_07 @@ -472,7 +472,7 @@ if (it != m_fileSaveMapping.end ()) { name = m_fileSaveMapping [saveWidgetName]; - DEBUG ("got mapping for [%s] as [%s]", saveWidgetName.c_str (), name.c_str ()); + SW_DEBUG ("got mapping for [%s] as [%s]", saveWidgetName.c_str (), name.c_str ()); } else { @@ -492,7 +492,7 @@ { if (m_document->getSaveFile() != "") { - DEBUG("savegame accepted %s", m_document->getSaveFile().c_str()); + SW_DEBUG("savegame accepted %s", m_document->getSaveFile().c_str()); m_document->getGUIState()->m_shown_windows = Document::START_MENU; m_document->setModified(Document::WINDOWS_MODIFIED); }
--- a/src/gui/scene.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/scene.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -367,8 +367,8 @@ float duration = timer.getTime (); if (duration >= 80) { - DEBUG ("scene update update took: %.2f ms. Up to ugo: %.2f", duration, beforeUGO); - DEBUG ("Up to createscene: %.2f ms.", durationUpToCrScene); + SW_DEBUG ("scene update update took: %.2f ms. Up to ugo: %.2f", duration, beforeUGO); + SW_DEBUG ("Up to createscene: %.2f ms.", durationUpToCrScene); } } @@ -710,7 +710,7 @@ if ((pl ==0 && m_temp_player!="")) { - DEBUG("deleting inv player"); + SW_DEBUG("deleting inv player"); m_temp_player=""; GraphicManager::destroyGraphicObject(m_temp_player_object); m_temp_player_object =0; @@ -1067,11 +1067,11 @@ indices[index_offset] = pLong[k] + static_cast<unsigned long>(offset); if (indices[index_offset] <0 || indices[index_offset] >= vertex_count) { - DEBUG("-----------------------------"); - DEBUG("illegal index %i at pos %i",indices[index_offset], offset); - DEBUG("submesh %i triangle %i", i,k); - DEBUG("vertex count %i index count %i",vertex_count, index_count); - DEBUG("32bit index %i shared %i",use32bitindexes, submesh->useSharedVertices); + SW_DEBUG("-----------------------------"); + SW_DEBUG("illegal index %i at pos %i",indices[index_offset], offset); + SW_DEBUG("submesh %i triangle %i", i,k); + SW_DEBUG("vertex count %i index count %i",vertex_count, index_count); + SW_DEBUG("32bit index %i shared %i",use32bitindexes, submesh->useSharedVertices); } index_offset++; } @@ -1084,10 +1084,10 @@ static_cast<unsigned long>(offset); if (indices[index_offset] <0 || indices[index_offset] >= vertex_count) { - DEBUG("illegal index %i at pos %i",indices[index_offset], index_offset); - DEBUG("submesh %i triangle %i", i,k); - DEBUG("vertex count %i index count %i",vertex_count, index_count); - DEBUG("32bit index %i shared %i",use32bitindexes, submesh->useSharedVertices); + SW_DEBUG("illegal index %i at pos %i",indices[index_offset], index_offset); + SW_DEBUG("submesh %i triangle %i", i,k); + SW_DEBUG("vertex count %i index count %i",vertex_count, index_count); + SW_DEBUG("32bit index %i shared %i",use32bitindexes, submesh->useSharedVertices); } index_offset++; }
--- a/src/gui/skilltree.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/skilltree.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -53,12 +53,12 @@ CEGUI::TabControl* skilltree = (CEGUI::TabControl*) CEGUIUtility::loadLayoutFromFile ("skilltree.layout"); if (!skilltree) { - DEBUG ("WARNING: Failed to load [%s]", "skilltree.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "skilltree.layout"); } CEGUI::Window* skilltree_holder = CEGUIUtility::loadLayoutFromFile ("skilltree_holder.layout"); if (!skilltree_holder) { - DEBUG ("WARNING: Failed to load [%s]", "skilltree_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "skilltree_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (skilltree_holder, "Skilltree_Holder"); @@ -69,8 +69,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for skills."); - if (!wndSkilltree) DEBUG ("ERROR: Unable to get the window for skills."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for skills."); + if (!wndSkilltree) SW_DEBUG ("ERROR: Unable to get the window for skills."); } m_window = skilltree_holder; @@ -307,7 +307,7 @@ imageWidgetName.erase (string_pos, 31); } m_skill_widgets_pics[cnt] = imageWidgetName; - DEBUG ("Added widget name (img) [%s]", imageWidgetName.c_str ()); + SW_DEBUG ("Added widget name (img) [%s]", imageWidgetName.c_str ()); // // Setup the button to be used to learn the corresponding skill. @@ -343,7 +343,7 @@ btnWidgetName.erase (string_pos, 31); } m_skill_widgets_btns[cnt] = btnWidgetName; - DEBUG ("Added widget name (btn) [%s]", btnWidgetName.c_str ()); + SW_DEBUG ("Added widget name (btn) [%s]", btnWidgetName.c_str ()); // // Set the skill picture settings. This loads the picture and sets specific properties. @@ -415,7 +415,7 @@ depsWidgetName.erase (string_pos, 31); } m_skill_widgets_connections[m_nr_dependencies] = depsWidgetName; - DEBUG ("Added widget name (conn) [%s]", depsWidgetName.c_str ()); + SW_DEBUG ("Added widget name (conn) [%s]", depsWidgetName.c_str ()); m_nr_dependencies++; @@ -471,7 +471,7 @@ } else { - DEBUG ("Property not found: OverlayColour (in %s)", label->getNamePath().c_str()); + SW_DEBUG ("Property not found: OverlayColour (in %s)", label->getNamePath().c_str()); } std::string skillButtonWidget = m_skill_widgets_btns[j]; @@ -635,7 +635,7 @@ if (label2->getParent() != label->getParent()) { - DEBUG ("Reassigning siblings: [%s], to image widgets [%s]", label->getNamePath ().c_str (), label2->getNamePath ().c_str ()); + SW_DEBUG ("Reassigning siblings: [%s], to image widgets [%s]", label->getNamePath ().c_str (), label2->getNamePath ().c_str ()); if (label->getParent() != 0) {
--- a/src/gui/soundhelper.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/soundhelper.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -137,7 +137,7 @@ // we need to calculate the weight for this one. SoundManager::getPtr ()->getSoundGroup (groupName)->addEmptySlot (emptySoundWeight); - DEBUG ("Added for group [%s], probability %f, member weights %d, final sound weight %d", groupName.c_str (), probability, sumOfMemberWeights, emptySoundWeight); + SW_DEBUG ("Added for group [%s], probability %f, member weights %d, final sound weight %d", groupName.c_str (), probability, sumOfMemberWeights, emptySoundWeight); } } else @@ -194,7 +194,7 @@ } catch (std::exception& e) { - DEBUG ("Caught exception while trying to add to playlist [%s] track file [%s]: %s", playlistName.c_str (), fileName.c_str (), e.what ()); + SW_DEBUG ("Caught exception while trying to add to playlist [%s] track file [%s]: %s", playlistName.c_str (), fileName.c_str (), e.what ()); return false; } return true; @@ -280,7 +280,7 @@ SoundManager::getPtr ()->getMusicPlayer ()->setPlaylistRepeat (playlistName, repeatOption); SoundManager::getPtr ()->getMusicPlayer ()->setPlaylistShuffle (playlistName, shuffleOption); - DEBUG ("Got playlist: %s, repeat: %d, shuffle: %d", playlistName.c_str (), repeatOption, shuffleOption); + SW_DEBUG ("Got playlist: %s, repeat: %d, shuffle: %d", playlistName.c_str (), repeatOption, shuffleOption); for (child = node->FirstChild (); child != 0; child = child->NextSibling ()) { @@ -327,7 +327,7 @@ } catch (std::exception& e) { - DEBUG ("Encountered exception: %s", e.what ()); + SW_DEBUG ("Encountered exception: %s", e.what ()); } } @@ -350,7 +350,7 @@ catch (std::exception& e) { // This can happen if the group name is not valid. Or if the group has missing files. Or if the group is empty. - DEBUG ("Caught exception while trying to play sound group [%s]: %s", soundGroupID.c_str (), e.what ()); + SW_DEBUG ("Caught exception while trying to play sound group [%s]: %s", soundGroupID.c_str (), e.what ()); } }
--- a/src/gui/soundobject.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/soundobject.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -63,7 +63,7 @@ void SoundObject::setSoundData (const std::string& data) { - DEBUG ("Setting sound data for [%s] to : [%s]", m_name.c_str (), data.c_str ()); + SW_DEBUG ("Setting sound data for [%s] to : [%s]", m_name.c_str (), data.c_str ()); m_soundData = data; }
--- a/src/gui/tooltipmanager.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/tooltipmanager.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -34,7 +34,7 @@ void TooltipManager::createTooltip ( CEGUI::Window* win, std::list< std::string > textlist, float timeVisible, const CEGUI::Font* font, Tooltip::TooltipType type ) { - DEBUG ("Creating a tooltip for duration: %.2f", timeVisible); + SW_DEBUG ("Creating a tooltip for duration: %.2f", timeVisible); CEGUI::Window *gamescreen = CEGUIUtility::getWindow ("SW"); std::string msg (""); CEGUI::UVector2 size;
--- a/src/gui/tradewindow.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/tradewindow.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -36,12 +36,12 @@ CEGUI::FrameWindow* trade = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("tradewindow.layout"); if (!trade) { - DEBUG ("WARNING: Failed to load [%s]", "tradewindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "tradewindow.layout"); } CEGUI::Window* trade_holder = CEGUIUtility::loadLayoutFromFile ("tradewindow_holder.layout"); if (!trade_holder) { - DEBUG ("WARNING: Failed to load [%s]", "tradewindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "tradewindow_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (trade_holder, "TradeWindow_Holder"); @@ -52,8 +52,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for trade."); - if (!wndTrade) DEBUG ("ERROR: Unable to get the window for trade."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for trade."); + if (!wndTrade) SW_DEBUG ("ERROR: Unable to get the window for trade."); } m_window = trade_holder;
--- a/src/gui/worldmap.cpp Sat Mar 08 19:58:40 2014 +0100 +++ b/src/gui/worldmap.cpp Sat Mar 08 21:52:56 2014 +0100 @@ -29,13 +29,13 @@ CEGUI::Window* worldmap = (CEGUI::FrameWindow*) CEGUIUtility::loadLayoutFromFile ("worldmapwindow.layout"); if (!worldmap) { - DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow.layout"); } CEGUI::Window* worldmap_holder = CEGUIUtility::loadLayoutFromFile ("worldmapwindow_holder.layout"); if (!worldmap_holder) { - DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow_holder.layout"); + SW_DEBUG ("WARNING: Failed to load [%s]", "worldmapwindow_holder.layout"); } CEGUI::Window* wndHolder = CEGUIUtility::getWindowForLoadedLayoutEx (worldmap_holder, "WorldmapWindow_Holder"); @@ -47,8 +47,8 @@ } else { - if (!wndHolder) DEBUG ("ERROR: Unable to get the window holder for char screen."); - if (!wndHeldWindow) DEBUG ("ERROR: Unable to get the window for the worldmap screen."); + if (!wndHolder) SW_DEBUG ("ERROR: Unable to get the window holder for char screen."); + if (!wndHeldWindow) SW_DEBUG ("ERROR: Unable to get the window for the worldmap screen."); } m_window = worldmap_holder;