void Kingdom::ActionNewWeek(void) { ResetModes(DISABLEHIRES); // skip first day if(1 < world.CountDay()) { // castle New Week std::for_each(castles.begin(), castles.end(), std::mem_fun(&Castle::ActionNewWeek)); // heroes New Week std::for_each(heroes.begin(), heroes.end(), std::mem_fun(&Heroes::ActionNewWeek)); // debug an gift if(IS_DEVEL() && (CONTROL_HUMAN & GetControl())) { Funds gift(20, 20, 10, 10, 10, 10, 5000); DEBUG(DBG_GAME, DBG_INFO, "debug gift: " << gift.String()); resource += gift; } } // remove week visit object visit_object.remove_if(Visit::isWeekLife); UpdateRecruits(); }
void PuzzlesDraw(const Puzzle & pzl, const Surface & sf, s16 dstx, s16 dsty) { Display & display = Display::Get(); Cursor & cursor = Cursor::Get(); // show all for debug if(IS_DEVEL()) return; u8 alpha = 250; u32 ticket = 0; LocalEvent & le = LocalEvent::Get(); while(le.HandleEvents() && 0 < alpha) { if(Game::ShouldAnimateInfrequent(ticket, 1)) { cursor.Hide(); display.Blit(sf, dstx, dsty); for(size_t ii = 0; ii < pzl.size(); ++ii) { const Sprite & piece = AGG::GetICN(ICN::PUZZLE, ii); if(pzl.test(ii)) { Surface fade(piece.w(), piece.h()); fade.SetColorKey(); fade.Blit(piece); fade.SetAlpha(alpha); if(Settings::Get().QVGA()) display.Blit(fade, dstx + 8 + piece.x() - BORDERWIDTH, dsty + 8 + piece.y() - BORDERWIDTH); else display.Blit(fade, dstx + piece.x() - BORDERWIDTH, dsty + piece.y() - BORDERWIDTH); } else { if(Settings::Get().QVGA()) display.Blit(piece, dstx + 8 + piece.x() - BORDERWIDTH, dsty + 8 + piece.y() - BORDERWIDTH); else display.Blit(piece, dstx + piece.x() - BORDERWIDTH, dsty + piece.y() - BORDERWIDTH); } } cursor.Show(); display.Flip(); alpha -= 10; } ++ticket; } cursor.Hide(); }
/* redraw radar area for color */ void Interface::Radar::RedrawArea(const u8 color) { const Settings & conf = Settings::Get(); if(conf.ExtGameHideInterface() && !conf.ShowRadar()) return; Display & display = Display::Get(); const u16 world_w = world.w(); const u16 world_h = world.h(); const Surface *tile_surface = NULL; cursorArea->Hide(); spriteArea->Blit(x, y, display); for(s32 index = 0; index < world_w * world_h; ++index) { const Maps::Tiles & tile = world.GetTiles(index); bool show_tile = ! tile.isFog(color); #ifdef WITH_DEBUG show_tile = IS_DEVEL() || ! tile.isFog(color); #endif if(! show_tile) tile_surface = sf_black; else switch(tile.GetObject()) { case MP2::OBJ_HEROES: { const Heroes* hero = tile.GetHeroes(); if(hero) tile_surface = GetSurfaceFromColor(hero->GetColor()); } break; case MP2::OBJ_CASTLE: case MP2::OBJN_CASTLE: { const Castle* castle = world.GetCastle(index); if(castle) tile_surface = GetSurfaceFromColor(castle->GetColor()); } break; case MP2::OBJ_DRAGONCITY: //case MP2::OBJN_DRAGONCITY: case MP2::OBJ_LIGHTHOUSE: //case MP2::OBJN_LIGHTHOUSE: case MP2::OBJ_ALCHEMYLAB: //case MP2::OBJN_ALCHEMYLAB: case MP2::OBJ_MINES: //case MP2::OBJN_MINES: case MP2::OBJ_SAWMILL: //case MP2::OBJN_SAWMILL: tile_surface = GetSurfaceFromColor(tile.QuantityColor()); break; default: continue; } if(tile_surface) { float dstx = (index % world_w) * w / world_w; float dsty = (index / world_h) * h / world_w; tile_surface->Blit(x + static_cast<u16>(dstx), y + static_cast<u16>(dsty), display); } } }