diff --git a/client/CAdvmapInterface.cpp b/client/CAdvmapInterface.cpp index cf50e7279..ebe51d7ce 100644 --- a/client/CAdvmapInterface.cpp +++ b/client/CAdvmapInterface.cpp @@ -853,7 +853,7 @@ void CTerrainRect::hover(bool on) } //Hoverable::hover(on); } -void CTerrainRect::showPath(const SDL_Rect * extRect) +void CTerrainRect::showPath(const SDL_Rect * extRect, SDL_Surface * to) { for (size_t i=0; i < currentPath->nodes.size()-1; ++i) { @@ -1130,60 +1130,60 @@ void CTerrainRect::showPath(const SDL_Rect * extRect) hvy = (y+arrows->ourImages[pn].bitmap->h)-(pos.y+pos.h); SDL_Rect prevClip; - SDL_GetClipRect(screen, &prevClip); - SDL_SetClipRect(screen, extRect); //preventing blitting outside of that rect + SDL_GetClipRect(to, &prevClip); + SDL_SetClipRect(to, extRect); //preventing blitting outside of that rect if(ADVOPT.smoothMove) //version for smooth hero move, with pos shifts { if (hvx<0 && hvy<0) { - CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, screen, &genRect(32, 32, x + moveX, y + moveY)); + CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, to, &genRect(32, 32, x + moveX, y + moveY)); } else if(hvx<0) { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, x + moveX, y + moveY)); + to, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, x + moveX, y + moveY)); } else if (hvy<0) { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, x + moveX, y + moveY)); + to, &genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, x + moveX, y + moveY)); } else { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap, &genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w-hvx, x + moveX, y + moveY)); + to, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w-hvx, x + moveX, y + moveY)); } } else //standard version { if (hvx<0 && hvy<0) { - CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, screen, &genRect(32, 32, x, y)); + CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[pn].bitmap, NULL, to, &genRect(32, 32, x, y)); } else if(hvx<0) { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, x, y)); + to, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w, x, y)); } else if (hvy<0) { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, x, y)); + to, &genRect(arrows->ourImages[pn].bitmap->h, arrows->ourImages[pn].bitmap->w-hvx, x, y)); } else { CSDL_Ext::blit8bppAlphaTo24bpp (arrows->ourImages[pn].bitmap, &genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx, 0, 0), - screen, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w-hvx, x, y)); + to, &genRect(arrows->ourImages[pn].bitmap->h-hvy, arrows->ourImages[pn].bitmap->w-hvx, x, y)); } } - SDL_SetClipRect(screen, &prevClip); + SDL_SetClipRect(to, &prevClip); } } //for (int i=0;inodes.size()-1;i++) @@ -1205,7 +1205,7 @@ void CTerrainRect::show(SDL_Surface * to) //SDL_FreeSurface(teren); if (currentPath && LOCPLINT->adventureInt->position.z==currentPath->startPos().z) //drawing path { - showPath(&pos); + showPath(&pos, to); } } diff --git a/client/CAdvmapInterface.h b/client/CAdvmapInterface.h index dd28bbc50..bcb20e7c1 100644 --- a/client/CAdvmapInterface.h +++ b/client/CAdvmapInterface.h @@ -88,7 +88,7 @@ public: void hover(bool on); void mouseMoved (const SDL_MouseMotionEvent & sEvent); void show(SDL_Surface * to); - void showPath(const SDL_Rect * extRect); + void showPath(const SDL_Rect * extRect, SDL_Surface * to); int3 whichTileIsIt(const int & x, const int & y); //x,y are cursor position int3 whichTileIsIt(); //uses current cursor pos }; diff --git a/client/CPreGame.cpp b/client/CPreGame.cpp index 56b16a979..80861ad79 100644 --- a/client/CPreGame.cpp +++ b/client/CPreGame.cpp @@ -1683,8 +1683,9 @@ void CTextInput::keyPressed( const SDL_KeyboardEvent & key ) text.resize(text.size()-1); break; default: - char c = key.keysym.unicode; - if(std::isprint(c)) + char c = key.keysym.unicode; //TODO 16-/>8 + static const std::string forbiddenChars = "<>:\"/\\|?*"; //if we are entering a filename, some special characters won't be allowed + if(!vstd::contains(forbiddenChars,c) && std::isprint(c)) text += c; break; } diff --git a/client/GUIBase.cpp b/client/GUIBase.cpp index 9df4369a0..e2ca819bd 100644 --- a/client/GUIBase.cpp +++ b/client/GUIBase.cpp @@ -318,11 +318,16 @@ void CGuiHandler::handleMoveInterested( const SDL_MouseMotionEvent & motion ) void CGuiHandler::fakeMouseMove() { + SDL_Event evnt; + SDL_MouseMotionEvent sme = {SDL_MOUSEMOTION, 0, 0, 0, 0, 0, 0}; int x, y; sme.state = SDL_GetMouseState(&x, &y); sme.x = x; sme.y = y; + + evnt.motion = sme; + current = &evnt; handleMoveInterested(sme); } diff --git a/hch/CObjectHandler.cpp b/hch/CObjectHandler.cpp index 8f6669801..6c7ae10bd 100644 --- a/hch/CObjectHandler.cpp +++ b/hch/CObjectHandler.cpp @@ -4777,14 +4777,10 @@ void CCartographer::buyMap (const CGHeroInstance *h, ui32 accept) const cb->giveResource (h->tempOwner, 6, -1000); FoWChange fw; fw.player = h->tempOwner; - int surface = 0; - if (cb->getTile(pos)->tertype == 8) //water - surface = 2; - else - surface = 1; - //reveal apropriate tiles - cb->getAllTiles (fw.tiles, h->tempOwner, pos.z, surface); + //subIDs of different types of cartographers: + //water = 0; land = 1; underground = 2; + cb->getAllTiles (fw.tiles, h->tempOwner, subID - 1, !subID + 1); //reveal appropriate tiles cb->sendAndApply (&fw); cb->setObjProperty (id, 10, h->tempOwner); } diff --git a/hch/CObjectHandler.h b/hch/CObjectHandler.h index 3ebb14e34..be8dc3b4a 100644 --- a/hch/CObjectHandler.h +++ b/hch/CObjectHandler.h @@ -186,6 +186,7 @@ public: template void serialize(Handler &h, const int version) { + h & static_cast(*this); h & players; } }; @@ -985,6 +986,7 @@ public: template void serialize(Handler &h, const int version) { + h & static_cast(*this); h & players; }