1
0
forked from 0ad/0ad
0ad/source/tools/atlas/GameInterface/Handlers/Map.cpp
Ykkrosh cf37e9cbe6 Atlas: Added a button. Reorganised game<->UI communication system.
main.cpp: Allowed correct operation when not calling Init/Shutdown.
Game.cpp: Stopped complaint when starting game with no GUI.

This was SVN commit r2446.
2005-06-27 23:04:34 +00:00

30 lines
600 B
C++

#include "precompiled.h"
#include "MessageHandler.h"
#include "graphics/Patch.h"
#include "ps/Game.h"
namespace AtlasMessage {
void fGenerateMap(IMessage* msg)
{
mGenerateMap* cmd = static_cast<mGenerateMap*>(msg);
int tiles = cmd->size * PATCH_SIZE + 1;
u16* heightmap = new u16[tiles*tiles];
for (int y = 0; y < tiles; ++y)
for (int x = 0; x < tiles; ++x)
heightmap[x + y*tiles] = 32768;
g_Game->GetWorld()->GetTerrain()->Resize(cmd->size);
g_Game->GetWorld()->GetTerrain()->SetHeightMap(heightmap);
delete[] heightmap;
}
REGISTER(GenerateMap);
}