Miscellanous cleanup

stable-5.2
Günther Brammer 2009-04-28 21:35:53 +02:00
parent 4b022c0a45
commit eaeae35af9
4 changed files with 23 additions and 17 deletions

View File

@ -108,7 +108,6 @@ public:
T * OTable = Table;
Table = new T[Capacity];
Clear();
//memset(Table, 0, sizeof (T *) * NCapacity);
for (unsigned int i = 0; i < OCapacity; ++i)
{
if (OTable[i])

View File

@ -3655,8 +3655,7 @@ BOOL C4Game::CheckObjectEnumeration()
cObj = clnk->Obj;
if (cObj->Number<1)
{
LogF("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, C4IdText(cObj->id), cObj->GetX());
return FALSE;
LogFatal(FormatString("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, C4IdText(cObj->id), cObj->GetX()).getData()); return FALSE;
}
// Max
if (cObj->Number>iMax) iMax=cObj->Number;
@ -3664,11 +3663,11 @@ BOOL C4Game::CheckObjectEnumeration()
for (clnk2=Objects.First; clnk2 && (cObj2=clnk2->Obj); clnk2=clnk2->Next)
if (cObj2!=cObj)
if (cObj->Number==cObj2->Number)
{ LogF("Duplicate object enumeration number %d (%s and %s)",cObj2->Number,cObj->GetName(),cObj2->GetName()); return FALSE; }
{ LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s)",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return FALSE; }
for (clnk2=Objects.InactiveObjects.First; clnk2 && (cObj2=clnk2->Obj); clnk2=clnk2->Next)
if (cObj2!=cObj)
if (cObj->Number==cObj2->Number)
{ LogF("Duplicate object enumeration number %d (%s and %s(i))",cObj2->Number,cObj->GetName(),cObj2->GetName()); return FALSE; }
{ LogFatal(FormatString("Duplicate object enumeration number %d (%s and %s(i))",cObj2->Number,cObj->GetName(),cObj2->GetName()).getData()); return FALSE; }
// next
if (!clnk->Next)
if (clnk == Objects.Last) clnk=Objects.InactiveObjects.First; else clnk=NULL;

View File

@ -5654,16 +5654,16 @@ void C4Object::GetViewPosPar(float &riX, float &riY, float tx, float ty, const C
// get drawing pos, then subtract original target pos to get drawing pos on landscape
if (!iParX && GetX()<0)
// HUD element at right viewport pos
riX=float(GetX())+tx+fctViewport.Wdt;
riX=fixtof(fix_x)+tx+fctViewport.Wdt;
else
// regular parallaxity
riX=float(GetX())-(tx*(iParX-100)/100);
riX=fixtof(fix_x)-(tx*(iParX-100)/100);
if (!iParY && GetY()<0)
// HUD element at bottom viewport pos
riY=float(GetY())+ty+fctViewport.Hgt;
riY=fixtof(fix_y)+ty+fctViewport.Hgt;
else
// regular parallaxity
riY=float(GetY())-(ty*(iParY-100)/100);
riY=fixtof(fix_y)-(ty*(iParY-100)/100);
}
bool C4Object::PutAwayUnusedObject(C4Object *pToMakeRoomForObject)

View File

@ -90,26 +90,34 @@ CStdWindow * CStdWindow::Init(CStdApp * pApp, const char * Title, CStdWindow * p
ButtonReleaseMask;
attr.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), ((XVisualInfo*)Info)->visual, AllocNone);
unsigned long attrmask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
Pixmap bitmap;
if (HideCursor)
{
Pixmap bitmap = 0;
if (HideCursor) {
// Hide the mouse cursor
XColor cursor_color;
// We do not care what color the invisible cursor has
memset(&cursor_color, 0, sizeof(cursor_color));
bitmap = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), "\000", 1, 1);
attr.cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &cursor_color, &cursor_color, 0, 0);
attrmask |= CWCursor;
if (bitmap) {
attr.cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &cursor_color, &cursor_color, 0, 0);
if (attr.cursor)
attrmask |= CWCursor;
else
Log("Error creating cursor.");
} else {
Log("Error creating bitmap for cursor.");
attr.cursor = 0;
}
} else {
attr.cursor = 0;
}
wnd = XCreateWindow(dpy, DefaultRootWindow(dpy),
0, 0, 640, 480, 0, ((XVisualInfo*)Info)->depth, InputOutput, ((XVisualInfo*)Info)->visual,
attrmask, &attr);
if (HideCursor)
{
if (attr.cursor)
XFreeCursor(dpy, attr.cursor);
if (bitmap)
XFreePixmap(dpy, bitmap);
}
if (!wnd) {
Log("Error creating window.");
return 0;