Fixed bug: Units have wrong colors, if level is loaded with GUI.

This commit is contained in:
johns 2002-03-19 21:54:42 +00:00
parent 5054a64e6c
commit 14a689c110
5 changed files with 13 additions and 9 deletions

View file

@ -745,6 +745,7 @@
<LI>Added display of orders if shift key is hold.
<LI>Added display of orders after command for 2s.
<LI>Fixed bug: Add to selections with shift and rectangle didn't work.
<LI>Fixed bug: Units have wrong colors, if level is loaded with GUI.
<LI>+++
</UL>
</UL>

View file

@ -367,6 +367,14 @@ global void CreateGame(char* filename, WorldMap* map)
PfHierInitialize ();
#endif /* HIERARCHIC_PATHFINDER */
//
// FIXME: The palette is loaded after the units are created.
// FIXME: This loops fixes the colors of the units.
//
for( i=0; i<NumUnits; ++i ) {
Units[i]->Colors=Units[i]->Player->UnitColors;
}
GameResult=GameNoResult;
}

View file

@ -120,7 +120,6 @@ global void CleanPlayers(void)
}
ThisPlayer=NULL;
memset(Players,0,sizeof(Players));
SetPlayersPalette();
NumPlayers=0;
//
@ -789,6 +788,7 @@ global void PlayersEachSecond(void)
** FIXME: use function pointer here.
**
** @param player Pointer to player.
** @param sprite The sprite in which the colors should be changed.
*/
global void GraphicPlayerPixels(const Player* player,const Graphic* sprite)
{

View file

@ -776,7 +776,7 @@ global void LoadPud(const char* pud,WorldMap* map)
int height;
int aiopps;
if (!(map->Info)) {
if (!map->Info) {
map->Info = GetPudInfo(pud);
}
if( !(input=CLopen(pud)) ) {

View file

@ -283,13 +283,7 @@ global Unit* MakeUnit(UnitType* type,Player* player)
}
unit->Player=player;
unit->Stats=&type->Stats[unit->Player->Player];
DebugLevel0Fn("%d\n",sizeof(player->UnitColors));
#if __GNUC__>=3
#warning "Compiler error or coding error?"
memcpy(&unit->Colors,&player->UnitColors,sizeof(player->UnitColors));
#else
unit->Colors=player->UnitColors;
#endif
if( type->CanCastSpell ) {
unit->Mana=MAGIC_FOR_NEW_UNITS;
@ -302,8 +296,9 @@ global Unit* MakeUnit(UnitType* type,Player* player)
unit->Wait=1;
unit->Reset=1;
unit->Removed=1;
#ifdef NEW_DECODRAW
unit->deco=NULL;
// JOHNS: not needed unit->deco=NULL;
#endif
// Invisible as default for submarines