int World::getIntFromColor(sf::Color color) { switch (color.toInteger()) { case 0x00FF00FF: //Gräs return 0; case 0xFF0000FF: //Träd på gräs return 1; case 0x7F6A00FF: //Bro return 2; case 0xFF8800FF: //Hus00 return 3; case 0xFF8801FF: //Hus01 return 4; case 0xFF8802FF: //Hus02 return 5; case 0xFF8803FF: //Hus03 return 6; case 0xFF8810FF: //Hus10 return 7; case 0xFF8811FF: //Hus11 return 8; case 0xFF8812FF: //Hus12 return 9; case 0xFF8813FF: //Hus13 return 10; case 0xFF8820FF: //Hus20 return 11; case 0xFF8821FF: //Hus21 return 12; case 0xFF8822FF: //Hus22 return 13; case 0xFF8823FF: //Hus23 return 14; case 0xFF8830FF: //Hus30 return 15; case 0xFF8831FF: //Hus31 return 16; case 0xFF8832FF: //Hus32 return 17; case 0xFF8833FF: //Hus33 return 18; case 0x7F7F7FFF: //Berg på gräs return 19; case 0x0000FFFF: //Vatten return 20; case 0xFF7F00FF: //Stubbe på gräs return 21; case 0x00FFFFFF: //Snö return 22; case 0xFFFF00FF: //Träd på gräs return 23; case 0xFF006EFF: //Kaktus return 24; case 0xFF6A00FF: //Sand return 25; case 0x404040FF: //Palm return 26; case 0xFF0022FF: //Lava return 100; case 0x808080FF: //Lavasten return 101; case 0x7F3300FF: //Nedbrunnet träd return 102; case 0x123456FF: //Fontän return 200; case 0xFF1000FF: //Sand (kan EJ gå på) return 201; case 0x7F1C00FF: //Nedbrunnet träd på gräs return 900; case 0x77617CFF: //Sten på gräs return 902; default: return -1; } }
template <> inline std::string toString<sf::Color>(const sf::Color& value) { std::ostringstream oss; oss << std::hex << value.toInteger(); return oss.str(); }