133 {
134 if ( !wpn || !mag )
135 return false;
136
137 if (
m_player.GetHumanInventory().GetEntityInHands() != wpn )
138 return false;
139
140 if ( mag.IsDamageDestroyed() || wpn.IsDamageDestroyed())
141 return false;
142
143
144
145
147 return false;
148
149 if ( reservationCheck && (
m_player.GetInventory().HasInventoryReservation(wpn, null) ||
m_player.GetInventory().HasInventoryReservation(mag, null)))
150 return false;
151
152
153 InventoryLocation invLoc;
154 invLoc = new InventoryLocation();
155
156 mag.GetInventory().GetCurrentInventoryLocation(invLoc);
157 Weapon_Base wnp2;
158
159
160 if( Class.CastTo(wnp2, invLoc.
GetParent()) )
161 return false;
162
163 int muzzleIndex = wpn.GetCurrentMuzzle();
164
165 Magazine mag2;
166 if( !Class.CastTo(mag2, wpn.GetMagazine(muzzleIndex)) )
167 return false;
168
169 if( GameInventory.CanSwapEntitiesEx( mag, mag2 ) )
170 return true;
171
172 InventoryLocation il = new InventoryLocation();
173
174 if( GameInventory.CanForceSwapEntitiesEx( mag, null, mag2, il ) )
175 return true;
176
177 return false;
178 }
proto native EntityAI GetParent()
returns parent of current inventory location