Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**** Sprite Aligner ****/
- /** Window used for aligning sprites. */
- struct SpriteAlignerWindow : Window {
- SpriteID current_sprite; ///< The currently shown sprite
- Scrollbar *vscroll;
- SmallMap<SpriteID, int> sprite_start_pos_map; ///< Mapping of offsets of all sprites viewed since opening the window
- SpriteAlignerWindow(WindowDesc *desc, WindowNumber wno) : Window(desc)
- {
- this->CreateNestedTree();
- this->vscroll = this->GetScrollbar(WID_SA_SCROLLBAR);
- this->FinishInitNested(wno);
- /* Oh yes, we assume there is at least one normal sprite! */
- while (GetSpriteType(this->current_sprite) != ST_NORMAL) SetCurrentSprite(this->current_sprite + 1);
- }
- void SetCurrentSprite(const SpriteID new_sprite)
- {
- this->current_sprite = new_sprite;
- if (this->sprite_start_pos_map.Contains(new_sprite)) return;
- /* Remember the original offset of the new sprite */
- this->sprite_start_pos_map.Insert(new_sprite, GetSprite(new_sprite, ST_NORMAL)->x_offs);
- }
- virtual void SetStringParameters(int widget) const
- {
- const Sprite *spr = GetSprite(this->current_sprite, ST_NORMAL);
- switch (widget) {
- case WID_SA_CAPTION:
- SetDParam(0, this->current_sprite);
- SetDParamStr(1, FioGetFilename(GetOriginFileSlot(this->current_sprite)));
- break;
- case WID_SA_OFFSETS: {
- SetDParam(0, spr->x_offs);
- SetDParam(1, spr->y_offs);
- break;
- }
- case WID_SA_OFFSETS_REL: {
- SetDParam(0, this->sprite_start_pos_map[this->current_sprite] - spr->x_offs);
- SetDParam(1, this->sprite_start_pos_map[this->current_sprite] - spr->y_offs);
- break;
- }
- default:
- break;
- }
- }
- [SRC] Compiling newgrf_debug_gui.cpp
- /home/tim/ttdp/openttd/trunk/src/newgrf_debug_gui.cpp: In member function ‘virtual void SpriteAlignerWindow::SetStringParameters(int) const’:
- /home/tim/ttdp/openttd/trunk/src/newgrf_debug_gui.cpp:846:65: error: passing ‘const SmallMap<unsigned int, int>’ as ‘this’ argument of ‘U& SmallMap<T, U, S>::operator[](const T&) [with T = unsigned int; U = int; unsigned int S = 16u]’ discards qualifiers [-fpermissive]
- SetDParam(0, this->sprite_start_pos_map[this->current_sprite] - spr->x_offs);
- ^
- /home/tim/ttdp/openttd/trunk/src/newgrf_debug_gui.cpp:847:65: error: passing ‘const SmallMap<unsigned int, int>’ as ‘this’ argument of ‘U& SmallMap<T, U, S>::operator[](const T&) [with T = unsigned int; U = int; unsigned int S = 16u]’ discards qualifiers [-fpermissive]
- SetDParam(1, this->sprite_start_pos_map[this->current_sprite] - spr->y_offs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement