forked from Mirrors/openclonk
Miscellanous cleanup
parent
4b022c0a45
commit
eaeae35af9
|
@ -108,7 +108,6 @@ public:
|
||||||
T * OTable = Table;
|
T * OTable = Table;
|
||||||
Table = new T[Capacity];
|
Table = new T[Capacity];
|
||||||
Clear();
|
Clear();
|
||||||
//memset(Table, 0, sizeof (T *) * NCapacity);
|
|
||||||
for (unsigned int i = 0; i < OCapacity; ++i)
|
for (unsigned int i = 0; i < OCapacity; ++i)
|
||||||
{
|
{
|
||||||
if (OTable[i])
|
if (OTable[i])
|
||||||
|
|
|
@ -3655,8 +3655,7 @@ BOOL C4Game::CheckObjectEnumeration()
|
||||||
cObj = clnk->Obj;
|
cObj = clnk->Obj;
|
||||||
if (cObj->Number<1)
|
if (cObj->Number<1)
|
||||||
{
|
{
|
||||||
LogF("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, C4IdText(cObj->id), cObj->GetX());
|
LogFatal(FormatString("Invalid object enumeration number (%d) of object %s (x=%d)", cObj->Number, C4IdText(cObj->id), cObj->GetX()).getData()); return FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
// Max
|
// Max
|
||||||
if (cObj->Number>iMax) iMax=cObj->Number;
|
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)
|
for (clnk2=Objects.First; clnk2 && (cObj2=clnk2->Obj); clnk2=clnk2->Next)
|
||||||
if (cObj2!=cObj)
|
if (cObj2!=cObj)
|
||||||
if (cObj->Number==cObj2->Number)
|
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)
|
for (clnk2=Objects.InactiveObjects.First; clnk2 && (cObj2=clnk2->Obj); clnk2=clnk2->Next)
|
||||||
if (cObj2!=cObj)
|
if (cObj2!=cObj)
|
||||||
if (cObj->Number==cObj2->Number)
|
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
|
// next
|
||||||
if (!clnk->Next)
|
if (!clnk->Next)
|
||||||
if (clnk == Objects.Last) clnk=Objects.InactiveObjects.First; else clnk=NULL;
|
if (clnk == Objects.Last) clnk=Objects.InactiveObjects.First; else clnk=NULL;
|
||||||
|
|
|
@ -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
|
// get drawing pos, then subtract original target pos to get drawing pos on landscape
|
||||||
if (!iParX && GetX()<0)
|
if (!iParX && GetX()<0)
|
||||||
// HUD element at right viewport pos
|
// HUD element at right viewport pos
|
||||||
riX=float(GetX())+tx+fctViewport.Wdt;
|
riX=fixtof(fix_x)+tx+fctViewport.Wdt;
|
||||||
else
|
else
|
||||||
// regular parallaxity
|
// regular parallaxity
|
||||||
riX=float(GetX())-(tx*(iParX-100)/100);
|
riX=fixtof(fix_x)-(tx*(iParX-100)/100);
|
||||||
if (!iParY && GetY()<0)
|
if (!iParY && GetY()<0)
|
||||||
// HUD element at bottom viewport pos
|
// HUD element at bottom viewport pos
|
||||||
riY=float(GetY())+ty+fctViewport.Hgt;
|
riY=fixtof(fix_y)+ty+fctViewport.Hgt;
|
||||||
else
|
else
|
||||||
// regular parallaxity
|
// regular parallaxity
|
||||||
riY=float(GetY())-(ty*(iParY-100)/100);
|
riY=fixtof(fix_y)-(ty*(iParY-100)/100);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4Object::PutAwayUnusedObject(C4Object *pToMakeRoomForObject)
|
bool C4Object::PutAwayUnusedObject(C4Object *pToMakeRoomForObject)
|
||||||
|
|
|
@ -90,26 +90,34 @@ CStdWindow * CStdWindow::Init(CStdApp * pApp, const char * Title, CStdWindow * p
|
||||||
ButtonReleaseMask;
|
ButtonReleaseMask;
|
||||||
attr.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), ((XVisualInfo*)Info)->visual, AllocNone);
|
attr.colormap = XCreateColormap(dpy, DefaultRootWindow(dpy), ((XVisualInfo*)Info)->visual, AllocNone);
|
||||||
unsigned long attrmask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
unsigned long attrmask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||||
Pixmap bitmap;
|
Pixmap bitmap = 0;
|
||||||
if (HideCursor)
|
if (HideCursor) {
|
||||||
{
|
|
||||||
// Hide the mouse cursor
|
// Hide the mouse cursor
|
||||||
XColor cursor_color;
|
XColor cursor_color;
|
||||||
// We do not care what color the invisible cursor has
|
// We do not care what color the invisible cursor has
|
||||||
memset(&cursor_color, 0, sizeof(cursor_color));
|
memset(&cursor_color, 0, sizeof(cursor_color));
|
||||||
bitmap = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), "\000", 1, 1);
|
bitmap = XCreateBitmapFromData(dpy, DefaultRootWindow(dpy), "\000", 1, 1);
|
||||||
attr.cursor = XCreatePixmapCursor(dpy, bitmap, bitmap, &cursor_color, &cursor_color, 0, 0);
|
if (bitmap) {
|
||||||
attrmask |= CWCursor;
|
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),
|
wnd = XCreateWindow(dpy, DefaultRootWindow(dpy),
|
||||||
0, 0, 640, 480, 0, ((XVisualInfo*)Info)->depth, InputOutput, ((XVisualInfo*)Info)->visual,
|
0, 0, 640, 480, 0, ((XVisualInfo*)Info)->depth, InputOutput, ((XVisualInfo*)Info)->visual,
|
||||||
attrmask, &attr);
|
attrmask, &attr);
|
||||||
if (HideCursor)
|
if (attr.cursor)
|
||||||
{
|
|
||||||
XFreeCursor(dpy, attr.cursor);
|
XFreeCursor(dpy, attr.cursor);
|
||||||
|
if (bitmap)
|
||||||
XFreePixmap(dpy, bitmap);
|
XFreePixmap(dpy, bitmap);
|
||||||
}
|
|
||||||
if (!wnd) {
|
if (!wnd) {
|
||||||
Log("Error creating window.");
|
Log("Error creating window.");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue