Jump to content
Eternal Lands Official Forums

jaceks

Members
  • Content count

    4
  • Joined

  • Last visited

About jaceks

  • Rank
    Newbie
  • Birthday 06/02/1910

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    Wroclaw, Poland
  1. 143 % 8 = 7

  2. 143 % 8 = 7

    thanks bluap, I didn't consider that arguments can be non-whole numbers (modulo operation is useful for cargo capacity calculation), but you are right, things shall be done well; a bit modified patch follow: 23a24 > #define CALCTOK_MOD 11 184a186,197 > //modulo > if(t1==CALCTOK_NUM&&t2==CALCTOK_MOD&&t3==CALCTOK_NUM){ > calcpop(cs);calcpop(cs);calcpop(cs); > nt=(CalcTok*)malloc(sizeof(CalcTok)); > if(cs1->value!=0){ > nt->type=CALCTOK_NUM; > nt->value=(int)(cs3->value-(((int)(cs3->value/cs1->value))*cs1->value)); > } else calc_error=CALCERR_DIVIDE; > calcpush(cs,nt); > free(cs1);free(cs2);free(cs3); > return 1; > } 234a248,250 > case '%': > ct->type=CALCTOK_MOD;pos++; > break; retested at test server and it works well diff in requested format: --- calc.c 2009-02-07 11:37:45.000000000 +0100 +++ ../elc-my/calc.c 2009-02-07 17:15:31.000000000 +0100 @@ -21,6 +21,7 @@ #define CALCTOK_END 8 #define CALCTOK_XOP 9 #define CALCTOK_LOP 10 +#define CALCTOK_MOD 11 /*Implementation of #calc command @@ -182,6 +183,18 @@ free(cs2);free(cs3);free(cs4); return 1; } + //modulo + if(t1==CALCTOK_NUM&&t2==CALCTOK_MOD&&t3==CALCTOK_NUM){ + calcpop(cs);calcpop(cs);calcpop(cs); + nt=(CalcTok*)malloc(sizeof(CalcTok)); + if(cs1->value!=0){ + nt->type=CALCTOK_NUM; + nt->value=(int)(cs3->value-(((int)(cs3->value/cs1->value))*cs1->value)); + } else calc_error=CALCERR_DIVIDE; + calcpush(cs,nt); + free(cs1);free(cs2);free(cs3); + return 1; + } //pars if(t1==CALCTOK_CPAR&&t2==CALCTOK_NUM&&t3==CALCTOK_OPAR){ calcpop(cs);calcpop(cs);calcpop(cs); @@ -232,6 +245,9 @@ case '/': ct->type=CALCTOK_DIV;pos++; break; + case '%': + ct->type=CALCTOK_MOD;pos++; + break; case '0': case '1': case '2': jaceks
  3. 143 % 8 = 7

    Hi, IMHO #calc command lacks modulo operator, so I did attempt to enhance it a bit. I tested new functionality at test server and it works well. example of syntax: #calc 143 % 8 patch as follow: 23a24 > #define CALCTOK_MOD 11 184a186,197 > //modulo > if(t1==CALCTOK_NUM&&t2==CALCTOK_MOD&&t3==CALCTOK_NUM){ > calcpop(cs);calcpop(cs);calcpop(cs); > nt=(CalcTok*)malloc(sizeof(CalcTok)); > if(cs1->value!=0){ > nt->type=CALCTOK_NUM; > nt->value=cs3->value-(((int)(cs3->value/cs1->value))*cs1->value); > } else calc_error=CALCERR_DIVIDE; > calcpush(cs,nt); > free(cs1);free(cs2);free(cs3); > return 1; > } 234a248,250 > case '%': > ct->type=CALCTOK_MOD;pos++; > break; please consider to use it in official client jaceks
  4. New engine test

    no luck: jaceks@jubliat:~/download/map_viewer_release_1> tail -20 debug.log [engine/source/lightmanager.cpp:205] 1 lights for object 3191. [engine/source/lightmanager.cpp:205] 1 lights for object 3192. [engine/source/scenemanager.cpp:231] Done loading map file 'maps/startmap.elm'. [engine/source/filesystem.cpp:42] Loading file 'shader/extended-material/shadow_caster.vert'. [engine/source/filesystem.cpp:46] Checking archive './data.zip'. [engine/source/filesystem.cpp:50] Loading file 'shader/extended-material/shadow_caster.vert' in archive './data.zip'. [engine/source/gpuprogram.cpp:180] ARB st_vertex program shader/extended-material/shadow_caster.vert build starts. [engine/source/gpuprogram.cpp:200] ARB st_vertex program shader/extended-material/shadow_caster.vert uniforms: [engine/source/gpuprogram.cpp:204] [name] color_id [shader_type] st_vertex [parameter_type] pt_float4 [array_size] 1 [index] 5 [instanced] 1 [engine/source/gpuprogram.cpp:204] [name] viewproj [shader_type] st_vertex [parameter_type] pt_mat4x4 [array_size] 1 [index] 1 [instanced] 0 [engine/source/gpuprogram.cpp:204] [name] world [shader_type] st_vertex [parameter_type] pt_float4 [array_size] 3 [index] 6 [instanced] 1 [engine/source/gpuprogram.cpp:207] ARB st_vertex program shader/extended-material/shadow_caster.vert instances: 13 [engine/source/gpuprogram.cpp:227] ARB st_vertex program shader/extended-material/shadow_caster.vert info: [engine/source/gpuprogram.cpp:239] ARB st_vertex program shader/extended-material/shadow_caster.vert parameters: 57 [engine/source/gpuprogram.cpp:242] ARB st_vertex program shader/extended-material/shadow_caster.vert build ends. [engine/source/filesystem.cpp:42] Loading file 'shader/extended-material/transparent_shadow_caster.frag'. [engine/source/filesystem.cpp:46] Checking archive './data.zip'. [engine/source/filesystem.cpp:50] Loading file 'shader/extended-material/transparent_shadow_caster.frag' in archive './data.zip'. [engine/source/gpuprogram.cpp:180] ARB st_fragment program shader/extended-material/transparent_shadow_caster.frag build starts. [map_viewer/main.cpp:236] EXTENDED EXCEPTION(5:opengl_error) at file 'engine/source/gpuprogram.cpp' in function 'build' line 186: invalid enumerant my hwinfo in full majesty attached (can't attach zipped output, lame forum) double lame forum, can't post my hwinfo output because of its size as you wish, sir: 26: PCI(AGP) 100.0: 0300 VGA compatible controller (VGA) [Created at pci.301] UDI: /org/freedesktop/Hal/devices/pci_10de_281 Unique ID: VCu0.dh8fFZ8Pa75 Parent ID: vSkL.BQdp9bG_qCD SysFS ID: /devices/pci0000:00/0000:00:01.0/0000:01:00.0 SysFS BusID: 0000:01:00.0 Hardware Class: graphics card Model: "nVidia GeForce4 Ti 4200 with AGP8X" Vendor: pci 0x10de "nVidia Corporation" Device: pci 0x0281 "GeForce4 Ti 4200 with AGP8X" Revision: 0xa1 Driver: "nvidia" Driver Modules: "nvidia" Memory Range: 0xe0000000-0xe0ffffff (rw,non-prefetchable) Memory Range: 0xd8000000-0xdfffffff (rw,prefetchable) Memory Range: 0xe1000000-0xe101ffff (ro,prefetchable,disabled) IRQ: 12 (1143099 events) I/O Ports: 0x3c0-0x3df (rw) Module Alias: "pci:v000010DEd00000281sv00000000sd00000000bc03sc00i00" Driver Info #0: XFree86 v4 Server Module: nvidia Driver Info #1: XFree86 v4 Server Module: nvidia 3D Support: yes Config Status: cfg=no, avail=yes, need=no, active=unknown Attached to: #13 (PCI bridge) LabRat asked me for driver details, here they are pal: jubliat:~ # rpm -qa | grep nvidia x11-video-nvidia-96.43.05-2.1 nvidia-gfx-kmp-default-96.43.05_2.6.22.17_0.1-1.1
×