mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
wrong naming for pointer
This commit is contained in:
parent
3c07a2b35b
commit
2e7a0be516
|
@ -300,100 +300,100 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
|
|||
for(int h = 0; h < pConf->m_aRuns.size(); ++h) {
|
||||
CRun *pRun = &pConf->m_aRuns[h];
|
||||
|
||||
// don't make copy if it's requested
|
||||
CLayerTiles* readLayer;
|
||||
if (pRun->m_AutomapCopy) {
|
||||
readLayer = new CLayerTiles(pLayer->m_Width, pLayer->m_Height);
|
||||
} else {
|
||||
readLayer = pLayer;
|
||||
}
|
||||
|
||||
// copy tiles
|
||||
if (pRun->m_AutomapCopy) {
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *in = &pLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
CTile *out = &readLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auto map
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *pTile = &(readLayer->m_pTiles[y*pLayer->m_Width+x]);
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
|
||||
for(int i = 0; i < pRun->m_aIndexRules.size(); ++i)
|
||||
{
|
||||
bool RespectRules = true;
|
||||
for(int j = 0; j < pRun->m_aIndexRules[i].m_aRules.size() && RespectRules; ++j)
|
||||
{
|
||||
CPosRule *pRule = &pRun->m_aIndexRules[i].m_aRules[j];
|
||||
|
||||
int CheckIndex, CheckFlags;
|
||||
int CheckX = x + pRule->m_X;
|
||||
int CheckY = y + pRule->m_Y;
|
||||
if(CheckX >= 0 && CheckX < pLayer->m_Width && CheckY >= 0 && CheckY < pLayer->m_Height) {
|
||||
int CheckTile = CheckY * pLayer->m_Width + CheckX;
|
||||
CheckIndex = pLayer->m_pTiles[CheckTile].m_Index;
|
||||
CheckFlags = pLayer->m_pTiles[CheckTile].m_Flags;
|
||||
} else {
|
||||
CheckIndex = -1;
|
||||
CheckFlags = 0;
|
||||
}
|
||||
|
||||
if(pRule->m_Value == CPosRule::INDEX)
|
||||
{
|
||||
bool PosRuleTest = false;
|
||||
for(int i = 0; i < pRule->m_aIndexList.size(); ++i) {
|
||||
if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag))
|
||||
PosRuleTest = true;
|
||||
}
|
||||
if(!PosRuleTest)
|
||||
RespectRules = false;
|
||||
}
|
||||
else if(pRule->m_Value == CPosRule::NOTINDEX)
|
||||
{
|
||||
bool PosRuleTest = true;
|
||||
for(int i = 0; i < pRule->m_aIndexList.size(); ++i) {
|
||||
if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag))
|
||||
PosRuleTest = false;
|
||||
}
|
||||
if(!PosRuleTest)
|
||||
RespectRules = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(RespectRules &&
|
||||
(pRun->m_aIndexRules[i].m_RandomProbability >= 1.0 || (float)rand() / ((float)RAND_MAX + 1) < pRun->m_aIndexRules[i].m_RandomProbability))
|
||||
{
|
||||
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
||||
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overwrite tiles
|
||||
if (pRun->m_AutomapCopy) {
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *in = &readLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
CTile *out = &pLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clean-up
|
||||
if (pRun->m_AutomapCopy)
|
||||
delete readLayer;
|
||||
// don't make copy if it's requested
|
||||
CLayerTiles* pReadLayer;
|
||||
if (pRun->m_AutomapCopy) {
|
||||
pReadLayer = new CLayerTiles(pLayer->m_Width, pLayer->m_Height);
|
||||
} else {
|
||||
pReadLayer = pLayer;
|
||||
}
|
||||
|
||||
// copy tiles
|
||||
if (pRun->m_AutomapCopy) {
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *in = &pLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
CTile *out = &pReadLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// auto map
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *pTile = &(pReadLayer->m_pTiles[y*pLayer->m_Width+x]);
|
||||
m_pEditor->m_Map.m_Modified = true;
|
||||
|
||||
for(int i = 0; i < pRun->m_aIndexRules.size(); ++i)
|
||||
{
|
||||
bool RespectRules = true;
|
||||
for(int j = 0; j < pRun->m_aIndexRules[i].m_aRules.size() && RespectRules; ++j)
|
||||
{
|
||||
CPosRule *pRule = &pRun->m_aIndexRules[i].m_aRules[j];
|
||||
|
||||
int CheckIndex, CheckFlags;
|
||||
int CheckX = x + pRule->m_X;
|
||||
int CheckY = y + pRule->m_Y;
|
||||
if(CheckX >= 0 && CheckX < pLayer->m_Width && CheckY >= 0 && CheckY < pLayer->m_Height) {
|
||||
int CheckTile = CheckY * pLayer->m_Width + CheckX;
|
||||
CheckIndex = pLayer->m_pTiles[CheckTile].m_Index;
|
||||
CheckFlags = pLayer->m_pTiles[CheckTile].m_Flags;
|
||||
} else {
|
||||
CheckIndex = -1;
|
||||
CheckFlags = 0;
|
||||
}
|
||||
|
||||
if(pRule->m_Value == CPosRule::INDEX)
|
||||
{
|
||||
bool PosRuleTest = false;
|
||||
for(int i = 0; i < pRule->m_aIndexList.size(); ++i) {
|
||||
if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag))
|
||||
PosRuleTest = true;
|
||||
}
|
||||
if(!PosRuleTest)
|
||||
RespectRules = false;
|
||||
}
|
||||
else if(pRule->m_Value == CPosRule::NOTINDEX)
|
||||
{
|
||||
bool PosRuleTest = true;
|
||||
for(int i = 0; i < pRule->m_aIndexList.size(); ++i) {
|
||||
if(CheckIndex == pRule->m_aIndexList[i].m_ID && (pRule->m_aIndexList[i].m_Flag == -1 || CheckFlags == pRule->m_aIndexList[i].m_Flag))
|
||||
PosRuleTest = false;
|
||||
}
|
||||
if(!PosRuleTest)
|
||||
RespectRules = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(RespectRules &&
|
||||
(pRun->m_aIndexRules[i].m_RandomProbability >= 1.0 || (float)rand() / ((float)RAND_MAX + 1) < pRun->m_aIndexRules[i].m_RandomProbability))
|
||||
{
|
||||
pTile->m_Index = pRun->m_aIndexRules[i].m_ID;
|
||||
pTile->m_Flags = pRun->m_aIndexRules[i].m_Flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overwrite tiles
|
||||
if (pRun->m_AutomapCopy) {
|
||||
for(int y = 0; y < pLayer->m_Height; y++) {
|
||||
for(int x = 0; x < pLayer->m_Width; x++)
|
||||
{
|
||||
CTile *in = &pReadLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
CTile *out = &pLayer->m_pTiles[y*pLayer->m_Width+x];
|
||||
out->m_Index = in->m_Index;
|
||||
out->m_Flags = in->m_Flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clean-up
|
||||
if (pRun->m_AutomapCopy)
|
||||
delete pReadLayer;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue