about summary refs log tree commit diff
path: root/src/game/editor/auto_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/editor/auto_map.cpp')
-rw-r--r--src/game/editor/auto_map.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/game/editor/auto_map.cpp b/src/game/editor/auto_map.cpp
index 528e459b..3abcf0f4 100644
--- a/src/game/editor/auto_map.cpp
+++ b/src/game/editor/auto_map.cpp
@@ -20,15 +20,15 @@ void CAutoMapper::Load(const char* pTileName)
 	IOHANDLE RulesFile = m_pEditor->Storage()->OpenFile(aPath, IOFLAG_READ, IStorage::TYPE_ALL);
 	if(!RulesFile)
 		return;
-	
+
 	CLineReader LineReader;
 	LineReader.Init(RulesFile);
-		
+
 	CConfiguration *pCurrentConf = 0;
 	CIndexRule *pCurrentIndex = 0;
-		
+
 	char aBuf[256];
-		
+
 	// read each line
 	while(char *pLine = LineReader.Get())
 	{
@@ -40,11 +40,11 @@ void CAutoMapper::Load(const char* pTileName)
 			{
 				// new configuration, get the name
 				pLine++;
-					
+
 				CConfiguration NewConf;
 				int ID = m_lConfigs.add(NewConf);
 				pCurrentConf = &m_lConfigs[ID];
-					
+
 				str_copy(pCurrentConf->m_aName, pLine, str_length(pLine));
 			}
 			else
@@ -54,15 +54,15 @@ void CAutoMapper::Load(const char* pTileName)
 					// new index
 					int ID = 0;
 					char aFlip[128] = "";
-						
+
 					sscanf(pLine, "Index %d %127s", &ID, aFlip);
-						
+
 					CIndexRule NewIndexRule;
 					NewIndexRule.m_ID = ID;
 					NewIndexRule.m_Flag = 0;
 					NewIndexRule.m_RandomValue = 0;
 					NewIndexRule.m_BaseTile = false;
-						
+
 					if(str_length(aFlip) > 0)
 					{
 						if(!str_comp(aFlip, "XFLIP"))
@@ -70,7 +70,7 @@ void CAutoMapper::Load(const char* pTileName)
 						else if(!str_comp(aFlip, "YFLIP"))
 							NewIndexRule.m_Flag = TILEFLAG_HFLIP;
 					}
-						
+
 					// add the index rule object and make it current
 					int ArrayID = pCurrentConf->m_aIndexRules.add(NewIndexRule);
 					pCurrentIndex = &pCurrentConf->m_aIndexRules[ArrayID];
@@ -85,9 +85,9 @@ void CAutoMapper::Load(const char* pTileName)
 					char aValue[128];
 					int Value = CPosRule::EMPTY;
 					bool IndexValue = false;
-						
+
 					sscanf(pLine, "Pos %d %d %127s", &x, &y, aValue);
-						
+
 					if(!str_comp(aValue, "FULL"))
 						Value = CPosRule::FULL;
 					else if(!str_comp_num(aValue, "INDEX", 5))
@@ -106,12 +106,12 @@ void CAutoMapper::Load(const char* pTileName)
 			}
 		}
 	}
-		
+
 	io_close(RulesFile);
-		
+
 	str_format(aBuf, sizeof(aBuf),"loaded %s", aPath);
 	m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "editor", aBuf);
-		
+
 	m_FileLoaded = true;
 }
 
@@ -127,14 +127,14 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
 {
 	if(!m_FileLoaded || pLayer->m_Readonly || ConfigID < 0 || ConfigID >= m_lConfigs.size())
 		return;
-	
+
 	CConfiguration *pConf = &m_lConfigs[ConfigID];
-	
+
 	if(!pConf->m_aIndexRules.size())
 		return;
-	
+
 	int BaseTile = 1;
-	
+
 	// find base tile if there is one
 	for(int i = 0; i < pConf->m_aIndexRules.size(); ++i)
 	{
@@ -144,7 +144,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
 			break;
 		}
 	}
-	
+
 	// auto map !
 	int MaxIndex = pLayer->m_Width*pLayer->m_Height;
 	for(int y = 0; y < pLayer->m_Height; y++)
@@ -159,7 +159,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
 
 			if(y == 0 || y == pLayer->m_Height-1 || x == 0 || x == pLayer->m_Width-1)
 				continue;
-				
+
 			for(int i = 0; i < pConf->m_aIndexRules.size(); ++i)
 			{
 				if(pConf->m_aIndexRules[i].m_BaseTile)
@@ -170,7 +170,7 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
 				{
 					CPosRule *pRule = &pConf->m_aIndexRules[i].m_aRules[j];
 					int CheckIndex = (y+pRule->m_Y)*pLayer->m_Width+(x+pRule->m_X);
-							
+
 					if(CheckIndex < 0 || CheckIndex >= MaxIndex)
 						RespectRules = false;
 					else
@@ -184,15 +184,15 @@ void CAutoMapper::Proceed(CLayerTiles *pLayer, int ConfigID)
 						{
 							if(pLayer->m_pTiles[CheckIndex].m_Index > 0 && pRule->m_Value == CPosRule::EMPTY)
 								RespectRules = false;
-									
+
 							if(pLayer->m_pTiles[CheckIndex].m_Index == 0 && pRule->m_Value == CPosRule::FULL)
 								RespectRules = false;
 						}
 					}
 				}
-					
+
 				if(RespectRules &&
-					(pConf->m_aIndexRules[i].m_RandomValue <= 1 || (int)((float)rand() / ((float)RAND_MAX + 1) * pConf->m_aIndexRules[i].m_RandomValue)  == 1))
+					(pConf->m_aIndexRules[i].m_RandomValue <= 1 || (int)((float)rand() / ((float)RAND_MAX + 1) * pConf->m_aIndexRules[i].m_RandomValue) == 1))
 				{
 					pTile->m_Index = pConf->m_aIndexRules[i].m_ID;
 					pTile->m_Flags = pConf->m_aIndexRules[i].m_Flag;