This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9932 for ps


Ignore:
Timestamp:
07/30/11 14:07:27 (13 years ago)
Author:
philip
Message:

Use player colours for territory borders in minimap

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/graphics/TerritoryTexture.cpp

    r9889 r9932  
    2222#include "graphics/Terrain.h"
    2323#include "lib/bits.h"
     24#include "ps/Overlay.h"
    2425#include "ps/Profile.h"
    2526#include "renderer/Renderer.h"
    2627#include "simulation2/Simulation2.h"
     28#include "simulation2/components/ICmpPlayer.h"
     29#include "simulation2/components/ICmpPlayerManager.h"
    2730#include "simulation2/components/ICmpTerrain.h"
    2831#include "simulation2/components/ICmpTerritoryManager.h"
     
    172175    int alphaFalloff = 0x20;
    173176
     177    CmpPtr<ICmpPlayerManager> cmpPlayerManager(m_Simulation, SYSTEM_ENTITY);
     178
    174179    u8* p = bitmap;
    175180    for (ssize_t j = 0; j < h; ++j)
     
    178183        {
    179184            u8 val = territories.get(i, j);
    180             switch (val)
     185
     186            CColor color(1, 0, 1, 1);
     187            if (!cmpPlayerManager.null())
    181188            {
    182             // TODO: use player colours or something
    183             case 1: *p++ = 0x00; *p++ = 0x00; *p++ = 0xFF; break;
    184             case 2: *p++ = 0x00; *p++ = 0xFF; *p++ = 0x00; break;
    185             case 3: *p++ = 0xFF; *p++ = 0x00; *p++ = 0x00; break;
    186             case 4: *p++ = 0x00; *p++ = 0xFF; *p++ = 0xFF; break;
    187             case 5: *p++ = 0xFF; *p++ = 0xFF; *p++ = 0x00; break;
    188             case 6: *p++ = 0xFF; *p++ = 0x00; *p++ = 0xFF; break;
    189             default: *p++ = 0xFF; *p++ = 0xFF; *p++ = 0xFF; break;
     189                CmpPtr<ICmpPlayer> cmpPlayer(m_Simulation, cmpPlayerManager->GetPlayerByID(val));
     190                if (!cmpPlayer.null())
     191                    color = cmpPlayer->GetColour();
    190192            }
     193
     194            *p++ = (int)(color.b*255.f);
     195            *p++ = (int)(color.g*255.f);
     196            *p++ = (int)(color.r*255.f);
    191197
    192198            if ((i > 0 && territories.get(i-1, j) != val)
Note: See TracChangeset for help on using the changeset viewer.