From 1ba80f34363078099874a0e253698e4d49a1a28d Mon Sep 17 00:00:00 2001 From: bugmonster Date: Mon, 17 May 2010 17:25:54 +0000 Subject: [PATCH] - Big Maps: fixed road placing in map editor git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3512 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/Road Smoothing.cpp | 11 ++++++++--- Editor/editscreen.cpp | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index d80c52e8..7df8a04b 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 5c2752f1..efa73a4e 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();