Fix: sometimes items moved by the MOVEITEM assignment are left unreachable

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8100 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-03-09 20:18:35 +00:00
parent 908923e813
commit 1689f1b571
9 changed files with 37 additions and 7 deletions
+13 -6
View File
@@ -7139,9 +7139,9 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
std::map<UINT8, std::pair<UINT8, UINT8> > sectormercmap; // this map uses the sectors we take stuff from as keys and the number of mercs as elements
// we need a gridno to which we drop stuff
INT32 sDropOffGridNo = gMapInformation.sCenterGridNo;
if ( !GridNoOnVisibleWorldTile( sDropOffGridNo ) )
sDropOffGridNo = RandomGridNo();
INT32 sDropOffGridNo = NOWHERE;
if ( (gWorldSectorX == sMapX) && (gWorldSectorY == sMapY) && (gbWorldSectorZ == bZ) )
sDropOffGridNo = gMapInformation.sCenterGridNo;
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt = 0;
@@ -7176,7 +7176,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
sectormercmap[targetsector] = pair;
}
if ( pSoldier->sGridNo != NOWHERE )
if ( TileIsOutOfBounds(sDropOffGridNo) && !TileIsOutOfBounds( pSoldier->sGridNo ) )
sDropOffGridNo = pSoldier->sGridNo;
}
}
@@ -7185,10 +7185,17 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
// no mercs that move stuff here, exit
if ( sectormercmap.empty() )
return;
CHAR16 wSectorName[ 64 ];
GetShortSectorString( sMapX, sMapY, wSectorName );
// if we don't have a valid spot to drop gear at, don't do so - better than having tons of items unreachable
if ( TileIsOutOfBounds( sDropOffGridNo ) )
{
ScreenMsg( FONT_MCOLOR_RED, MSG_INTERFACE, pMapErrorString[50], wSectorName );
return;
}
std::vector<WORLDITEM> pWorldItem_Target;//dnl ch75 271013
// now loop over all sectors from which we take stuff, and move the equipment
@@ -7336,7 +7343,7 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ )
CHAR16 wSectorName_Target[ 64 ];
GetShortSectorString( targetX, targetY, wSectorName_Target );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d items moved from %s to %s", moveditems, wSectorName_Target, wSectorName );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMapErrorString[51], moveditems, wSectorName_Target, wSectorName );
// if we didn't move any item, no need to save a changed inventory etc.
if ( !moveditems )
+3
View File
@@ -4670,6 +4670,9 @@ STR16 pMapErrorString[] =
L"车辆被损坏得太严重了!",
L"每个分区只能由两名佣兵来训练民兵。",
L"没有遥控员,机器人无法移动。请把他们分配在同一个小队。",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};
+3
View File
@@ -4672,6 +4672,9 @@ STR16 pMapErrorString[] =
L"Voertuig is te beschadigd!",
L"Let op dat maar twee huurlingen milities in een sector mogen trainen.",
L"De robot kan zich zonder bediening niet verplaatsen. Plaats ze in hetzelfde team.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};
+3
View File
@@ -4667,6 +4667,9 @@ STR16 pMapErrorString[] =
L"Vehicle is too damaged!",
L"Note that only two mercs may train militia in each sector.",
L"The robot can't move without its controller. Place them together in the same squad.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.",
// 51-55
L"%d items moved from %s to %s",
};
+3
View File
@@ -4675,6 +4675,9 @@ STR16 pMapErrorString[] =
L"Le véhicule est trop endommagé !",
L"Deux mercenaires au plus peuvent être assignés à l'entraînement de la milice dans chaque secteur.",
L"Le robot ne peut se déplacer sans son contrôleur. Mettez-les ensemble dans la même escouade.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};
+3 -1
View File
@@ -4639,7 +4639,9 @@ STR16 pMapErrorString[] =
L"Fahrzeug zu stark beschädigt!",
L"Nur zwei Söldner pro Sektor können Milizen trainieren.",
L"Roboter muss von jemandem bedient werden. Beide im selben Trupp platzieren.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d Gegenstände von %s nach %s bewegt",
};
// help text used during strategic route plotting
+3
View File
@@ -4665,6 +4665,9 @@ STR16 pMapErrorString[] =
L"Il veicolo è troppo danneggiato!",
L"Osservate che solo due mercenari potrebbero addestrare i militari in questo settore.",
L"Il robot non può muoversi senza il suo controller. Metteteli nella stessa squadra.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};
+3
View File
@@ -4676,6 +4676,9 @@ STR16 pMapErrorString[] =
L"Pojazd jest uszkodzony!",
L"Pamiętaj, że w jednym sektorze tylko dwóch najemników może trenować żołnierzy samoobrony.",
L"Robot nie może się poruszać bez operatora. Umieść ich razem w jednym oddziale.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};
+3
View File
@@ -4667,6 +4667,9 @@ STR16 pMapErrorString[] =
L"Машина сильно повреждена!",
L"Внимание! Тренировать ополченцев в одном секторе могут не более двух наёмников.",
L"Роботом обязательно нужно управлять. Назначьте наёмника с пультом и робота в один отряд.",
L"Items cannot be moved to %s, as no valid dropoff point was found. Please enter map to resolve this issue.", // TODO.Translate
// 51-55
L"%d items moved from %s to %s",
};