diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d781325ab..b5881f19b 100644
a
|
b
|
static void fLoseInventory(ArgArray args) {
|
298 | 298 | g_private->inventory.clear(); |
299 | 299 | } |
300 | 300 | |
| 301 | bool inInventory(Common::String &bmp) { |
| 302 | for (NameList::const_iterator it = g_private->inventory.begin(); it != g_private->inventory.end(); ++it) { |
| 303 | if (*it == bmp) |
| 304 | return true; |
| 305 | } |
| 306 | return false; |
| 307 | } |
| 308 | |
301 | 309 | static void fInventory(ArgArray args) { |
302 | 310 | // assert types |
303 | 311 | Datum b1 = args[0]; |
… |
… |
static void fInventory(ArgArray args) {
|
354 | 362 | g_private->playSound(g_private->getTakeLeaveSound(), 1, false, false); |
355 | 363 | } |
356 | 364 | |
357 | | g_private->inventory.push_back(bmp); |
| 365 | if (!inInventory(bmp)) |
| 366 | g_private->inventory.push_back(bmp); |
358 | 367 | } else { |
359 | 368 | if (v1.type == NAME) { |
360 | 369 | if (strcmp(c.u.str, "\"REMOVE\"") == 0) { |
361 | 370 | v1.u.sym->u.val = 0; |
362 | | g_private->inventory.remove(bmp); |
| 371 | if (inInventory(bmp)) |
| 372 | g_private->inventory.remove(bmp); |
363 | 373 | } else { |
364 | 374 | v1.u.sym->u.val = 1; |
365 | | g_private->inventory.push_back(bmp); |
| 375 | if (!inInventory(bmp)) |
| 376 | g_private->inventory.push_back(bmp); |
366 | 377 | } |
367 | 378 | } else { |
368 | | g_private->inventory.push_back(bmp); |
| 379 | if (!inInventory(bmp)) |
| 380 | g_private->inventory.push_back(bmp); |
369 | 381 | } |
370 | 382 | if (v2.type == NAME) |
371 | 383 | v2.u.sym->u.val = 1; |