diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index d80c52e82..7df8a04b9 100644 --- a/Editor/Road Smoothing.cpp +++ b/Editor/Road Smoothing.cpp @@ -408,10 +408,15 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) i = gsRoadMacroStartIndex[ iMacroID ]; while( gRoadMacros[ i ].sMacroID == iMacroID ) { - AddToUndoList( iMapIndex + gRoadMacros[ i ].sOffset ); - RemoveAllObjectsOfTypeRange( iMapIndex + gRoadMacros[ i ].sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); + // need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size + INT32 sdX = gRoadMacros[ i ].sOffset % OLD_WORLD_COLS; + INT32 sdY = gRoadMacros[ i ].sOffset / OLD_WORLD_COLS; + INT32 sOffset = sdY*WORLD_COLS + sdX; + // + AddToUndoList( iMapIndex + sOffset ); + RemoveAllObjectsOfTypeRange( iMapIndex + sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex ); - AddObjectToHead( iMapIndex + gRoadMacros[ i ].sOffset, usTileIndex ); + AddObjectToHead( iMapIndex + sOffset, usTileIndex ); i++; } } diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 5c2752f14..efa73a4ed 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -4336,7 +4336,7 @@ UINT32 EditScreenHandle( void ) //Calculate general mouse information GetMouseXY( &sGridX, &sGridY ); - iMapIndex = sGridY * WORLD_COLS + sGridX; + iMapIndex = (INT32)sGridY * WORLD_COLS + sGridX; DetermineUndoState();