blob: 22cc0c7abbf14abe7d8c6b55b501e4372d6f6467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "stdafx.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
#include "BiomeOverride.h"
BiomeOverride::BiomeOverride()
{
m_tile = 0;
m_topTile = 0;
m_biomeId = 0;
}
void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
{
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
dos->writeUTF(_toString(m_biomeId));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
dos->writeUTF(_toString(m_tile));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
dos->writeUTF(_toString(m_topTile));
}
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
{
if(attributeName.compare(L"tileId") == 0)
{
int value = _fromString<int>(attributeValue);
m_tile = value;
app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n",m_tile);
}
else if(attributeName.compare(L"topTileId") == 0)
{
int value = _fromString<int>(attributeValue);
m_topTile = value;
app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n",m_topTile);
}
else if(attributeName.compare(L"biomeId") == 0)
{
int value = _fromString<int>(attributeValue);
m_biomeId = value;
app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n",m_biomeId);
}
else
{
GameRuleDefinition::addAttribute(attributeName, attributeValue);
}
}
bool BiomeOverride::isBiome(int id)
{
return m_biomeId == id;
}
void BiomeOverride::getTileValues(BYTE &tile, BYTE &topTile)
{
if(m_tile != 0) tile = (BYTE)m_tile;
if(m_topTile != 0) topTile = (BYTE)m_topTile;
}
|