~ubuntu-branches/ubuntu/trusty/manaplus/trusty-proposed

« back to all changes in this revision

Viewing changes to src/resources/iteminfo.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-07-11 10:09:41 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20130711100941-f0rwuvcwgl8ulqo8
Tags: 1.3.7.7.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
239
239
void ItemInfo::setSpriteOrder(int *const ptr, const int direction,
240
240
                              const int n, const int def) const
241
241
{
242
 
    if (direction == -1)
 
242
    switch (direction)
243
243
    {
244
 
        for (int f = 0; f < 10; f ++)
245
 
        {
246
 
            if (ptr[f] == def)
247
 
                ptr[f] = n;
248
 
        }
249
 
        return;
 
244
        case -1:
 
245
        {
 
246
            for (int f = 0; f < 10; f ++)
 
247
            {
 
248
                if (ptr[f] == def)
 
249
                    ptr[f] = n;
 
250
            }
 
251
            return;
 
252
        }
 
253
        case -2:
 
254
        {
 
255
            ptr[DIRECTION_DOWN] = n;
 
256
            ptr[DIRECTION_DOWNLEFT] = n;
 
257
            ptr[DIRECTION_DOWNRIGHT] = n;
 
258
            return;
 
259
        }
 
260
        case -3:
 
261
        {
 
262
            ptr[DIRECTION_UP] = n;
 
263
            ptr[DIRECTION_UPLEFT] = n;
 
264
            ptr[DIRECTION_UPRIGHT] = n;
 
265
            return;
 
266
        }
 
267
        default:
 
268
            break;
250
269
    }
251
270
    if (direction < 0 || direction >= 9)
252
271
        return;
309
328
{
310
329
    mAnimationFiles[static_cast<int>(gender) + race * 4] = animationFile;
311
330
}
 
331
 
 
332
std::string ItemInfo::getColorName(const int idx) const
 
333
{
 
334
    if (!mColors)
 
335
        return std::string();
 
336
 
 
337
    const std::map <int, ColorDB::ItemColor>::const_iterator
 
338
        it = mColors->find(idx);
 
339
    if (it == mColors->end())
 
340
        return std::string();
 
341
    return it->second.name;
 
342
}
 
343
 
 
344
std::string ItemInfo::getColor(const int idx) const
 
345
{
 
346
    if (!mColors)
 
347
        return std::string();
 
348
 
 
349
    const std::map <int, ColorDB::ItemColor>::const_iterator
 
350
        it = mColors->find(idx);
 
351
    if (it == mColors->end())
 
352
        return std::string();
 
353
    return it->second.color;
 
354
}