Merge with develop

This commit is contained in:
kervala 2016-01-06 16:06:23 +01:00
commit f6d4804411
5 changed files with 46 additions and 23 deletions

View file

@ -242,6 +242,10 @@ IF(WITH_QT5)
FIND_PACKAGE(Qt5LinguistTools) FIND_PACKAGE(Qt5LinguistTools)
FIND_PACKAGE(Qt5Network) FIND_PACKAGE(Qt5Network)
IF(WIN32)
FIND_PACKAGE(Qt5WinExtras)
ENDIF()
IF(QT_STATIC) IF(QT_STATIC)
ADD_DEFINITIONS(-DQT_STATICPLUGIN) ADD_DEFINITIONS(-DQT_STATICPLUGIN)
@ -250,6 +254,10 @@ IF(WITH_QT5)
# Gui # Gui
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL) SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL)
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::WinExtras)
ENDIF()
ADD_QT_LIBRARY(PrintSupport) ADD_QT_LIBRARY(PrintSupport)
IF(WIN32) IF(WIN32)

View file

@ -60,7 +60,11 @@ QVariant tiles_model::data(const QModelIndex &index, int role) const
{ {
CTile_Widget wiwi; CTile_Widget wiwi;
wiwi.initWidget(tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel()); wiwi.initWidget(tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel());
#ifdef USE_QT5
QPixmap pixpix = wiwi.grab(wiwi.contentsRect()); QPixmap pixpix = wiwi.grab(wiwi.contentsRect());
#else
QPixmap::grabWidget(wiwi, wiwi.contentsRect());
#endif
return pixpix; return pixpix;
} }
else if (role == Qt::UserRole + 1) else if (role == Qt::UserRole + 1)

View file

@ -65,7 +65,7 @@ public:
{ {
*this=other; *this=other;
} }
CAIEventType(const char *typeName) CAIEventType(const char *typeName)
{ {
// copy text from input string to _val variable // copy text from input string to _val variable
@ -75,7 +75,7 @@ public:
// if type name is longer than 8 characters it won't fit in an int64! // if type name is longer than 8 characters it won't fit in an int64!
nlassert(typeName[i]==0); nlassert(typeName[i]==0);
// pad out _val variable with 0s // pad out _val variable with 0s
while(i<8) while(i<8)
((char *)&_val)[i++]=0; ((char *)&_val)[i++]=0;
@ -88,7 +88,8 @@ public:
const CAIEventType &operator=(const CAIEventType &other) const CAIEventType &operator=(const CAIEventType &other)
{ {
_val=other._val; _val=other._val;
} return *this;
}
bool operator==(const CAIEventType &other) const bool operator==(const CAIEventType &other) const
{ {
return _val==other._val; return _val==other._val;
@ -133,7 +134,7 @@ private:
// base class IAIEvent // base class IAIEvent
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// This is the base class for classes of event sent from the game dev services to // This is the base class for classes of event sent from the game dev services to
// the AI. Note that the serial has a special syntax to allow for skipping of // the AI. Note that the serial has a special syntax to allow for skipping of
// unrecognised events. // unrecognised events.
class IAIEvent class IAIEvent
@ -173,7 +174,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the stunned creature id /// the stunned creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -199,7 +200,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the waked creature id /// the waked creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -227,7 +228,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the creature Id /// the creature Id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -259,7 +260,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the affected creature id /// the affected creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -291,7 +292,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the creature id /// the creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -317,7 +318,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the creature id /// the creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;
@ -342,7 +343,7 @@ public:
// note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters> // note serial should serialise: <Type> <uint16 sizeof(EventClass)> <event_parameters>
// the 'read' version of the serial should test the <sizeof> to ensure version robustness // the 'read' version of the serial should test the <sizeof> to ensure version robustness
virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream); virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
public: public:
/// the affected creature id /// the affected creature id
NLMISC::CEntityId CreatureId; NLMISC::CEntityId CreatureId;

View file

@ -1067,7 +1067,7 @@ NLMISC_COMMAND(accessPowo, "give access to the powo", "<uid> player_name number"
uint16 ownerId = buildingPlayer->getOwnerIdx( entityBase->getId() ); uint16 ownerId = buildingPlayer->getOwnerIdx( entityBase->getId() );
sint32 cell; sint32 cell;
buildingPlayer->addUser(c, 0, ownerId, cell); buildingPlayer->addUser(c, 0, ownerId, cell);
c->setPowoCell(cell); // c->setPowoCell(cell);
CBuildingManager::getInstance()->setRoomLifeTime(cell, TGameCycle(NLMISC::TGameTime(4*60*60) / CTickEventHandler::getGameTimeStep())); CBuildingManager::getInstance()->setRoomLifeTime(cell, TGameCycle(NLMISC::TGameTime(4*60*60) / CTickEventHandler::getGameTimeStep()));
log.displayNL("%d", cell); log.displayNL("%d", cell);
} }
@ -1098,7 +1098,7 @@ NLMISC_COMMAND(slide, "slide to the powo", "<uid> x y cell [z] [h]")
sint32 x; sint32 x;
sint32 y; sint32 y;
sint32 cell = c->getPowoCell(); sint32 cell = 0; // c->getPowoCell();
sint32 z = 0; sint32 z = 0;
float h = 0; float h = 0;

View file

@ -844,6 +844,7 @@ void CScreenshotIslands::processProximityBuffer(TBuffer & inputBuffer, uint32 li
bool lastValue = false; bool lastValue = false;
CVector2f firstPixelBorder; CVector2f firstPixelBorder;
firstPixelBorder.set(0.f, 0.f);
uint32 nbPixelsBorder = 0; uint32 nbPixelsBorder = 0;
for (uint32 x=0;x<lineLength;++x) for (uint32 x=0;x<lineLength;++x)
@ -907,6 +908,7 @@ void CScreenshotIslands::processProximityBuffer(TBuffer & inputBuffer, uint32 li
{ {
bool lastValue = false; bool lastValue = false;
CVector2f firstPixelBorder; CVector2f firstPixelBorder;
firstPixelBorder.set(0.f, 0.f);
uint32 nbPixelsBorder = 0; uint32 nbPixelsBorder = 0;
for(uint32 y=0; y<numLines; y++) for(uint32 y=0; y<numLines; y++)
@ -1379,11 +1381,18 @@ void CScreenshotIslands::buildIslandsTextures()
{ {
string seasonSuffix = *itSeason; string seasonSuffix = *itSeason;
int season; sint season = -1;
if(seasonSuffix=="_sp") season = CSeason::Spring;
else if(seasonSuffix=="_su") season = CSeason::Summer; if (seasonSuffix == "_sp") season = CSeason::Spring;
else if(seasonSuffix=="_au") season = CSeason::Autumn; else if (seasonSuffix == "_su") season = CSeason::Summer;
else if(seasonSuffix=="_wi") season = CSeason::Winter; else if (seasonSuffix == "_au") season = CSeason::Autumn;
else if (seasonSuffix == "_wi") season = CSeason::Winter;
if (season == -1)
{
nlwarning("Unknown season suffix %s, skipping...", seasonSuffix.c_str());
continue;
}
// Iterations on Continents // Iterations on Continents
TContinentsData::iterator itCont(_ContinentsData.begin()), lastCont(_ContinentsData.end()); TContinentsData::iterator itCont(_ContinentsData.begin()), lastCont(_ContinentsData.end());
@ -1673,11 +1682,9 @@ inline bool RGB2HSV(const CRGBA & rgba, uint & Hue, uint & Sat, uint & Val)
{ {
double Min_, Max_, Delta, H, S, V; double Min_, Max_, Delta, H, S, V;
H = 0.0;
Min_ = min(min(rgba.R, rgba.G), rgba.B); Min_ = min(min(rgba.R, rgba.G), rgba.B);
Max_ = max(max(rgba.R, rgba.G), rgba.B); Max_ = max(max(rgba.R, rgba.G), rgba.B);
Delta = ( Max_ - Min_); Delta = ( Max_ - Min_);
V = Max_;
if(Max_ != 0.0) if(Max_ != 0.0)
{ {
@ -1685,11 +1692,15 @@ inline bool RGB2HSV(const CRGBA & rgba, uint & Hue, uint & Sat, uint & Val)
} }
else else
{ {
S = 0.0; Hue = 0;
H = -1; Sat = 0;
Val = 0;
return false; return false;
} }
H = 0.0;
V = Max_;
if(rgba.R == Max_) if(rgba.R == Max_)
{ {
H = (rgba.G - rgba.B) / Delta; H = (rgba.G - rgba.B) / Delta;
@ -1762,7 +1773,6 @@ void CScreenshotIslands::buildBackTextureHLS(const std::string & islandName, con
} }
} }
// HLS order // HLS order
list< CRGBA > sortedHLS; list< CRGBA > sortedHLS;
list< CRGBA >::iterator itCol, itHLS; list< CRGBA >::iterator itCol, itHLS;